diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-03-09 17:35:19 +0100 |
---|---|---|
committer | rodarima <rodarima@gmail.com> | 2024-03-09 18:43:51 +0100 |
commit | 4c56214b8c2e130d3709bdca2513aef20b7b0fab (patch) | |
tree | b8cd0c6dafb5850ba116221f6f39a62e84983aa5 /src | |
parent | bde09c45adf0daf252fafbaf87683d3ed7eaab07 (diff) |
Use Doxygen comments for C files
Diffstat (limited to 'src')
-rw-r--r-- | src/IO/IO.c | 32 | ||||
-rw-r--r-- | src/IO/about.c | 2 | ||||
-rw-r--r-- | src/IO/dpi.c | 46 | ||||
-rw-r--r-- | src/IO/http.c | 60 | ||||
-rw-r--r-- | src/IO/iowatch.cc | 16 | ||||
-rw-r--r-- | src/IO/mime.c | 20 | ||||
-rw-r--r-- | src/IO/mime.h | 6 | ||||
-rw-r--r-- | src/IO/tls.c | 15 | ||||
-rw-r--r-- | src/auth.c | 27 | ||||
-rw-r--r-- | src/binaryconst.h | 10 | ||||
-rw-r--r-- | src/bitvec.c | 12 | ||||
-rw-r--r-- | src/bookmark.c | 4 | ||||
-rw-r--r-- | src/bw.c | 32 | ||||
-rw-r--r-- | src/bw.h | 32 | ||||
-rw-r--r-- | src/cache.c | 147 | ||||
-rw-r--r-- | src/cache.h | 20 | ||||
-rw-r--r-- | src/capi.c | 75 | ||||
-rw-r--r-- | src/chain.c | 48 | ||||
-rw-r--r-- | src/chain.h | 4 | ||||
-rw-r--r-- | src/colors.c | 32 | ||||
-rw-r--r-- | src/cookies.c | 35 | ||||
-rw-r--r-- | src/css.hh | 39 | ||||
-rw-r--r-- | src/cssparser.cc | 18 | ||||
-rw-r--r-- | src/decode.c | 18 | ||||
-rw-r--r-- | src/decode.h | 2 | ||||
-rw-r--r-- | src/dialog.cc | 42 | ||||
-rw-r--r-- | src/dicache.c | 55 | ||||
-rw-r--r-- | src/dicache.h | 48 | ||||
-rw-r--r-- | src/digest.c | 8 | ||||
-rw-r--r-- | src/dillo.cc | 24 | ||||
-rw-r--r-- | src/dns.c | 52 | ||||
-rw-r--r-- | src/domain.c | 6 | ||||
-rw-r--r-- | src/dpiapi.c | 8 | ||||
-rw-r--r-- | src/findbar.cc | 12 | ||||
-rw-r--r-- | src/findbar.hh | 2 | ||||
-rw-r--r-- | src/form.cc | 72 | ||||
-rw-r--r-- | src/gif.c | 44 | ||||
-rw-r--r-- | src/history.c | 16 | ||||
-rw-r--r-- | src/hsts.c | 18 | ||||
-rw-r--r-- | src/html.cc | 242 | ||||
-rw-r--r-- | src/html_common.hh | 58 | ||||
-rw-r--r-- | src/image.cc | 26 | ||||
-rw-r--r-- | src/image.hh | 27 | ||||
-rw-r--r-- | src/imgbuf.cc | 12 | ||||
-rw-r--r-- | src/jpeg.c | 19 | ||||
-rw-r--r-- | src/keys.cc | 22 | ||||
-rw-r--r-- | src/klist.c | 18 | ||||
-rw-r--r-- | src/klist.h | 8 | ||||
-rw-r--r-- | src/list.h | 19 | ||||
-rw-r--r-- | src/md5.c | 17 | ||||
-rw-r--r-- | src/md5.h | 8 | ||||
-rw-r--r-- | src/menu.cc | 69 | ||||
-rw-r--r-- | src/misc.c | 28 | ||||
-rw-r--r-- | src/nav.c | 3 | ||||
-rw-r--r-- | src/paths.cc | 8 | ||||
-rw-r--r-- | src/plain.cc | 15 | ||||
-rw-r--r-- | src/png.c | 85 | ||||
-rw-r--r-- | src/prefs.c | 6 | ||||
-rw-r--r-- | src/prefs.h | 4 | ||||
-rw-r--r-- | src/prefsparser.cc | 9 | ||||
-rw-r--r-- | src/table.cc | 11 | ||||
-rw-r--r-- | src/timeout.cc | 10 | ||||
-rw-r--r-- | src/tipwin.cc | 8 | ||||
-rw-r--r-- | src/tipwin.hh | 8 | ||||
-rw-r--r-- | src/ui.cc | 84 | ||||
-rw-r--r-- | src/ui.hh | 6 | ||||
-rw-r--r-- | src/uicmd.cc | 30 | ||||
-rw-r--r-- | src/url.c | 50 | ||||
-rw-r--r-- | src/url.h | 11 | ||||
-rw-r--r-- | src/utf8.cc | 12 | ||||
-rw-r--r-- | src/utf8.hh | 6 | ||||
-rw-r--r-- | src/web.cc | 8 | ||||
-rw-r--r-- | src/web.hh | 16 |
73 files changed, 1091 insertions, 1031 deletions
diff --git a/src/IO/IO.c b/src/IO/IO.c index 706b4ecd..2864ddb7 100644 --- a/src/IO/IO.c +++ b/src/IO/IO.c @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/** @file * Dillo's event driven IO engine */ @@ -58,7 +58,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info, /* IO API - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* +/** * Return a new, initialized, 'io' struct */ static IOData_t *IO_new(int op) @@ -74,7 +74,7 @@ static IOData_t *IO_new(int op) /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* +/** * Register an IO in ValidIOs */ static void IO_ins(IOData_t *io) @@ -86,7 +86,7 @@ static void IO_ins(IOData_t *io) io->Key, a_Klist_length(ValidIOs)); } -/* +/** * Remove an IO from ValidIOs */ static void IO_del(IOData_t *io) @@ -98,7 +98,7 @@ static void IO_del(IOData_t *io) _MSG(" -->ValidIOs: %d\n", a_Klist_length(ValidIOs)); } -/* +/** * Return a io by its Key (NULL if not found) */ static IOData_t *IO_get(int Key) @@ -106,7 +106,7 @@ static IOData_t *IO_get(int Key) return (IOData_t *)a_Klist_get_data(ValidIOs, Key); } -/* +/** * Free an 'io' struct */ static void IO_free(IOData_t *io) @@ -115,7 +115,7 @@ static void IO_free(IOData_t *io) dFree(io); } -/* +/** * Close an open FD, and remove io controls. * (This function can be used for Close and Abort operations) * BUG: there's a race condition for Abort. The file descriptor is closed @@ -151,7 +151,7 @@ static void IO_close_fd(IOData_t *io, int CloseCode) _MSG(" end IO close (%d) <=====\n", io->FD); } -/* +/** * Read data from a file descriptor into a specific buffer */ static bool_t IO_read(IOData_t *io) @@ -213,7 +213,7 @@ static bool_t IO_read(IOData_t *io) return ret; } -/* +/** * Write data, from a specific buffer, into a file descriptor */ static bool_t IO_write(IOData_t *io) @@ -258,8 +258,8 @@ static bool_t IO_write(IOData_t *io) return ret; } -/* - * Handle background IO for a given FD (reads | writes) +/** + * Handle background IO for a given FD (reads | writes). * (This function gets called when there's activity in the FD) */ static int IO_callback(IOData_t *io) @@ -277,7 +277,7 @@ static int IO_callback(IOData_t *io) return (ret) ? 1 : 0; } -/* +/** * Handle the READ event of a FD. */ static void IO_fd_read_cb(int fd, void *data) @@ -300,7 +300,7 @@ static void IO_fd_read_cb(int fd, void *data) } } -/* +/** * Handle the WRITE event of a FD. */ static void IO_fd_write_cb(int fd, void *data) @@ -321,7 +321,7 @@ static void IO_fd_write_cb(int fd, void *data) } } -/* +/** * Receive an IO request (IORead | IOWrite), * Set a watch for it, and let it flow! */ @@ -352,8 +352,8 @@ static void IO_submit(IOData_t *r_io) } } -/* - * CCC function for the IO module +/** + * CCC function for the IO module. * ( Data1 = IOData_t* ; Data2 = NULL ) */ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info, diff --git a/src/IO/about.c b/src/IO/about.c index a8585dce..2df93291 100644 --- a/src/IO/about.c +++ b/src/IO/about.c @@ -12,7 +12,7 @@ #include <config.h> -/* +/** * HTML text for startup screen */ const char *const AboutSplash= diff --git a/src/IO/dpi.c b/src/IO/dpi.c index 1948b0ee..d7dd7d0b 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -9,8 +9,8 @@ * (at your option) any later version. */ -/* - * Dillo plugins (small programs that interact with dillo) +/** @file + * Dillo plugins (small programs that interact with dillo). * * Dillo plugins are designed to handle: * bookmarks, cookies, FTP, downloads, files, preferences, https, @@ -85,7 +85,7 @@ void a_Dpi_init(void) /* empty */ } -/* +/** * Create a new connection data structure */ static dpi_conn_t *Dpi_conn_new(ChainLink *Info) @@ -99,7 +99,7 @@ static dpi_conn_t *Dpi_conn_new(ChainLink *Info) return conn; } -/* +/** * Free a connection data structure */ static void Dpi_conn_free(dpi_conn_t *conn) @@ -109,7 +109,7 @@ static void Dpi_conn_free(dpi_conn_t *conn) dFree(conn); } -/* +/** * Check whether a conn is still valid. * Return: 1 if found, 0 otherwise */ @@ -118,7 +118,7 @@ static int Dpi_conn_valid(int key) return (a_Klist_get_data(ValidConns, key)) ? 1 : 0; } -/* +/** * Append the new buffer in 'dbuf' to Buf in 'conn' */ static void Dpi_append_dbuf(dpi_conn_t *conn, DataBuf *dbuf) @@ -128,7 +128,7 @@ static void Dpi_append_dbuf(dpi_conn_t *conn, DataBuf *dbuf) } } -/* +/** * Split the data stream into tokens. * Here, a token is either: * a) a dpi tag @@ -192,7 +192,7 @@ static int Dpi_get_token(dpi_conn_t *conn) return resp; } -/* +/** * Parse a dpi tag and take the appropriate actions */ static void Dpi_parse_token(dpi_conn_t *conn) @@ -247,7 +247,7 @@ static void Dpi_parse_token(dpi_conn_t *conn) /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* +/** * Write data into a file descriptor taking care of EINTR * and possible data splits. * Return value: 1 on success, -1 on error. @@ -272,7 +272,7 @@ static int Dpi_blocking_write(int fd, const char *msg, int msg_len) return (sent == msg_len) ? 1 : -1; } -/* +/** * Read all the available data from a filedescriptor. * This is intended for short answers, i.e. when we know the server * will write it all before being preempted. For answers that may come @@ -307,7 +307,7 @@ static char *Dpi_blocking_read(int fd) /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* +/** * Get a new data buffer (within a 'dbuf'), save it into local data, * split in tokens and parse the contents. */ @@ -331,7 +331,7 @@ static void Dpi_process_dbuf(int Op, void *Data1, dpi_conn_t *conn) } } -/* +/** * Start dpid. * Return: 0 starting now, 1 Error. */ @@ -386,7 +386,7 @@ static int Dpi_start_dpid(void) return ret; } -/* +/** * Read dpid's communication keys from its saved file. * Return value: 1 on success, -1 on error. */ @@ -416,7 +416,7 @@ static int Dpi_read_comm_keys(int *port) return ret; } -/* +/** * Return a socket file descriptor */ static int Dpi_make_socket_fd() @@ -431,7 +431,7 @@ static int Dpi_make_socket_fd() return ret; } -/* +/** * Make a connection test for a IDS. * Return: 1 OK, -1 Not working. */ @@ -460,7 +460,7 @@ static int Dpi_check_dpid_ids() return ret; } -/* +/** * Confirm that the dpid is running. If not, start it. * Return: 0 running OK, 1 starting (EAGAIN), 2 Error. */ @@ -497,7 +497,7 @@ static int Dpi_check_dpid(int num_tries) return ret; } -/* +/** * Confirm that the dpid is running. If not, start it. * Return: 0 running OK, 2 Error. */ @@ -514,7 +514,7 @@ static int Dpi_blocking_start_dpid(void) return cst; } -/* +/** * Return the dpi server's port number, or -1 on error. * (A query is sent to dpid and then its answer parsed) * note: as the available servers and/or the dpi socket directory can @@ -595,7 +595,7 @@ static int Dpi_get_server_port(const char *server_name) } -/* +/** * Connect a socket to a dpi server and return the socket's FD. * We have to ask 'dpid' (dpi daemon) for the port of the target dpi server. * Once we have it, then the proper file descriptor is returned (-1 on error). @@ -639,8 +639,8 @@ static int Dpi_connect_socket(const char *server_name) return ret; } -/* - * CCC function for the Dpi module +/** + * CCC function for the Dpi module. */ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2) @@ -753,7 +753,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info, } } -/*! Let dpid know dillo is no longer running. +/** Let dpid know dillo is no longer running. * Note: currently disabled. It may serve to let the cookies dpi know * when to expire session cookies. */ @@ -762,7 +762,7 @@ void a_Dpi_dillo_exit() } -/* +/** * Send a command to a dpi server, and block until the answer is got. * Return value: the dpip tag answer as an string, NULL on error. */ diff --git a/src/IO/http.c b/src/IO/http.c index 5e00b6f6..4c4618c5 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -10,7 +10,7 @@ * (at your option) any later version. */ -/* +/** @file * HTTP connect functions */ @@ -112,7 +112,7 @@ static Dlist *servers; */ static Dlist *fd_map; -/* +/** * Initialize proxy vars and Accept-Language header */ int a_Http_init(void) @@ -141,8 +141,8 @@ int a_Http_init(void) return 0; } -/* - * Tell whether the proxy auth is already set (user:password) +/** + * Tell whether the proxy auth is already set (user:password). * Return: 1 Yes, 0 No */ int a_Http_proxy_auth(void) @@ -150,7 +150,7 @@ int a_Http_proxy_auth(void) return (HTTP_Proxy_Auth_base64 ? 1 : 0); } -/* +/** * Activate entered proxy password for HTTP. */ void a_Http_set_proxy_passwd(const char *str) @@ -160,7 +160,7 @@ void a_Http_set_proxy_passwd(const char *str) dFree(http_proxyauth); } -/* +/** * Create and init a new SocketData_t struct, insert into ValidSocks, * and return a primary key for it. */ @@ -171,7 +171,7 @@ static int Http_sock_new(void) return a_Klist_insert(&ValidSocks, S); } -/* +/** * Compare by FD. */ static int Http_fd_map_cmp(const void *v1, const void *v2) @@ -196,7 +196,7 @@ static void Http_fd_map_add_entry(SocketData_t *sd) dList_append(fd_map, e); } -/* +/** * Remove and free entry from fd_map. */ static void Http_fd_map_remove_entry(int fd) @@ -290,7 +290,7 @@ static void Http_connect_queued_sockets(Server_t *srv) } } -/* +/** * Free SocketData_t struct */ static void Http_socket_free(int SKey) @@ -328,9 +328,9 @@ static void Http_socket_free(int SKey) } } -/* +/** * Make the HTTP header's Referer line according to preferences - * (default is "host" i.e. "scheme://hostname/" ) + * (default is "host" i.e. "scheme://hostname/" ). */ static char *Http_get_referer(const DilloUrl *url) { @@ -350,7 +350,7 @@ static char *Http_get_referer(const DilloUrl *url) return referer; } -/* +/** * Generate Content-Type header value for a POST query. */ static Dstr *Http_make_content_type(const DilloUrl *url) @@ -377,7 +377,7 @@ static Dstr *Http_make_content_type(const DilloUrl *url) return dstr; } -/* +/** * Make the http query string */ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy) @@ -476,7 +476,7 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy) return query; } -/* +/** * Create and submit the HTTP query to the IO engine */ static void Http_send_query(SocketData_t *S) @@ -497,7 +497,7 @@ static void Http_send_query(SocketData_t *S) dStr_free(query, 1); } -/* +/** * Prepare an HTTPS connection. If necessary, tunnel through a proxy first. */ static void Http_connect_tls(ChainLink *info) @@ -522,7 +522,7 @@ static void Http_connect_tls(ChainLink *info) } } -/* +/** * connect() couldn't complete before, but now it's ready, so let's try again. */ static void Http_connect_socket_cb(int fd, void *data) @@ -559,7 +559,7 @@ static void Http_connect_socket_cb(int fd, void *data) } } -/* +/** * This function is called after the DNS succeeds in solving a hostname. * Task: Finish socket setup and start connecting the socket. */ @@ -654,8 +654,8 @@ static void Http_connect_socket(ChainLink *Info) } } -/* - * Test proxy settings and check the no_proxy domains list +/** + * Test proxy settings and check the no_proxy domains list. * Return value: whether to use proxy or not. */ static int Http_must_use_proxy(const char *hostname) @@ -685,7 +685,7 @@ static int Http_must_use_proxy(const char *hostname) return ret; } -/* +/** * Return a new string for the request used to tunnel HTTPS through a proxy. */ static char *Http_get_connect_str(const DilloUrl *url) @@ -726,7 +726,7 @@ static char *Http_get_connect_str(const DilloUrl *url) return retstr; } -/* +/** * Callback function for the DNS resolver. * Continue connecting the socket, or abort upon error condition. * S->web is checked to assert the operation wasn't aborted while waiting. @@ -768,8 +768,8 @@ static void Http_dns_cb(int Status, Dlist *addr_list, void *data) } } -/* - * Asynchronously create a new http connection for 'Url' +/** + * Asynchronously create a new http connection for 'Url'. * We'll set some socket parameters; the rest will be set later * when the IP is known. * ( Data1 = Web structure ) @@ -811,8 +811,8 @@ static int Http_get(ChainLink *Info, void *Data1) return 0; } -/* - * Can the old socket's fd be reused for the new socket? +/** + * Can the old socket's fd be reused for the new socket?. * * NOTE: old and new must come from the same Server_t. * This is not built to accept arbitrary sockets. @@ -833,7 +833,7 @@ static bool_t Http_socket_reuse_compatible(SocketData_t *old, return FALSE; } -/* +/** * If any entry in the socket data queue can reuse our connection, set it up * and send off a new query. */ @@ -875,7 +875,7 @@ static void Http_socket_reuse(int SKey) } } -/* +/** * CCC function for the HTTP module */ void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info, @@ -1030,7 +1030,7 @@ void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info, } } -/* +/** * Add socket data to the queue. Pages/stylesheets/etc. have higher priority * than images. */ @@ -1119,8 +1119,8 @@ static void Http_fd_map_remove_all() dList_free(fd_map); } -/* - * Deallocate memory used by http module +/** + * Deallocate memory used by http module. * (Call this one at exit time) */ void a_Http_freeall(void) diff --git a/src/IO/iowatch.cc b/src/IO/iowatch.cc index f5243934..13c537fe 100644 --- a/src/IO/iowatch.cc +++ b/src/IO/iowatch.cc @@ -9,14 +9,16 @@ * (at your option) any later version. */ -// Simple ADT for watching file descriptor activity +/** @file + * Simple ADT for watching file descriptor activity + */ #include <FL/Fl.H> #include "iowatch.hh" -// -// Hook a Callback for a certain activities in a FD -// +/** + * Hook a Callback for a certain activities in a FD + */ void a_IOwatch_add_fd(int fd, int when, Fl_FD_Handler Callback, void *usr_data = 0) { @@ -24,9 +26,9 @@ void a_IOwatch_add_fd(int fd, int when, Fl_FD_Handler Callback, Fl::add_fd(fd, when, Callback, usr_data); } -// -// Remove a Callback for a given FD (or just remove some events) -// +/** + * Remove a Callback for a given FD (or just remove some events) + */ void a_IOwatch_remove_fd(int fd, int when) { if (fd >= 0) diff --git a/src/IO/mime.c b/src/IO/mime.c index 19311b06..9d5e6738 100644 --- a/src/IO/mime.c +++ b/src/IO/mime.c @@ -29,8 +29,8 @@ static int MimeMajItemsSize = 0, MimeMajItemsMax = 8; static MimeItem_t *MimeMajItems = NULL; -/* - * Add a specific MIME type (as "image/png") to our viewer list +/** + * Add a specific MIME type (as "image/png") to our viewer list. * 'Key' is the content-type string that identifies the MIME type * 'Method' is the function that handles it */ @@ -43,8 +43,8 @@ static int Mime_add_minor_type(const char *Key, Viewer_t Method) return 0; } -/* - * Add a major MIME type (as "text") to our viewer list +/** + * Add a major MIME type (as "text") to our viewer list. * 'Key' is the content-type string that identifies the MIME type * 'Method' is the function that handles it */ @@ -57,8 +57,8 @@ static int Mime_add_major_type(const char *Key, Viewer_t Method) return 0; } -/* - * Search the list of specific MIME viewers, for a Method that matches 'Key' +/** + * Search the list of specific MIME viewers for a Method that matches 'Key'. * 'Key' is the content-type string that identifies the MIME type */ static Viewer_t Mime_minor_type_fetch(const char *Key, uint_t Size) @@ -73,8 +73,8 @@ static Viewer_t Mime_minor_type_fetch(const char *Key, uint_t Size) return NULL; } -/* - * Search the list of major MIME viewers, for a Method that matches 'Key' +/** + * Search the list of major MIME viewers for a Method that matches 'Key'. * 'Key' is the content-type string that identifies the MIME type */ static Viewer_t Mime_major_type_fetch(const char *Key, uint_t Size) @@ -90,7 +90,7 @@ static Viewer_t Mime_major_type_fetch(const char *Key, uint_t Size) } -/* +/** * Initializes Mime module and, sets the supported Mime types. */ void a_Mime_init() @@ -115,7 +115,7 @@ void a_Mime_init() } -/* +/** * Get the handler for the MIME type. * * Return Value: diff --git a/src/IO/mime.h b/src/IO/mime.h index 1f3b1ce5..011df4f0 100644 --- a/src/IO/mime.h +++ b/src/IO/mime.h @@ -23,8 +23,8 @@ extern "C" { typedef void* (*Viewer_t) (const char*, void*, CA_Callback_t*, void**); -/* - * Function prototypes defined elsewhere +/** + * Function prototypes defined elsewhere. */ void *a_Html_text (const char *Type,void *web, CA_Callback_t *Call, void **Data); @@ -37,7 +37,7 @@ void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data); -/* +/** * Functions defined inside Mime module */ void a_Mime_init(void); diff --git a/src/IO/tls.c b/src/IO/tls.c index 2a27c1a6..05ae2514 100644 --- a/src/IO/tls.c +++ b/src/IO/tls.c @@ -25,6 +25,9 @@ #include "tls_openssl.h" #include "tls_mbedtls.h" +/** + * Initialize TLS library. + */ void a_Tls_init() { #if ! defined(ENABLE_TLS) @@ -38,7 +41,7 @@ void a_Tls_init() #endif } -/* +/** * Return TLS connection information for a given file * descriptor, or NULL if no TLS connection was found. */ @@ -55,7 +58,7 @@ void *a_Tls_connection(int fd) #endif } -/* +/** * The purpose here is to permit a single initial connection to a server. * Once we have the certificate, know whether we like it -- and whether the * user accepts it -- HTTP can run through queued sockets as normal. @@ -75,9 +78,9 @@ int a_Tls_connect_ready(const DilloUrl *url) #endif } -/* +/** * Did everything seem proper with the certificate -- no warnings to - * click through? + * click through?. */ int a_Tls_certificate_is_clean(const DilloUrl *url) { @@ -92,8 +95,8 @@ int a_Tls_certificate_is_clean(const DilloUrl *url) #endif } -/* - * Clean up the OpenSSL library +/** + * Clean up the TLS library. */ void a_Tls_freeall(void) { @@ -10,7 +10,8 @@ * (at your option) any later version. */ -/* Handling of HTTP AUTH takes place here. +/** @file + * Handling of HTTP AUTH takes place here. * This implementation aims to follow RFC 2617: * http://www.ietf.org/rfc/rfc2617.txt */ @@ -47,12 +48,12 @@ typedef struct { const DilloUrl *url; } AuthDialogData_t; -/* +/** * Local data */ static Dlist *auth_hosts; -/* +/** * Initialize the auth module. */ void a_Auth_init(void) @@ -97,7 +98,7 @@ static int Auth_path_is_inside(const char *path1, const char *path2, int len) (path1[len] == '\0' || path1[len] == '/'); } -/* +/** * Check valid chars. * Return: 0 if invalid, 1 otherwise. */ @@ -107,7 +108,7 @@ static int Auth_is_token_char(char c) return (!isascii(c) || strchr(invalid, c) || iscntrl((uchar_t)c)) ? 0 : 1; } -/* +/** * Unquote the content of a (potentially) quoted string. * Return: newly allocated unquoted content. * @@ -152,7 +153,7 @@ typedef int (Auth_parse_token_value_callback_t)(AuthParse_t *auth_parse, const char *value); -/* +/** * Parse authentication challenge into token-value pairs * and feed them into the callback function. * @@ -350,7 +351,7 @@ static void Auth_parse_challenge(AuthParse_t *auth_parse, char *challenge) Auth_parse_challenge_args(auth_parse, &challenge, cb); } -/* +/** * Return the host that contains a URL, or NULL if there is no such host. */ static AuthHost_t *Auth_host_by_url(const DilloUrl *url) @@ -366,7 +367,7 @@ static AuthHost_t *Auth_host_by_url(const DilloUrl *url) return NULL; } -/* +/** * Search all realms for the one with the given name. */ static AuthRealm_t *Auth_realm_by_name(const AuthHost_t *host, @@ -382,7 +383,7 @@ static AuthRealm_t *Auth_realm_by_name(const AuthHost_t *host, return NULL; } -/* +/** * Search all realms for the one with the best-matching path. */ static AuthRealm_t *Auth_realm_by_path(const AuthHost_t *host, @@ -463,7 +464,7 @@ static void Auth_realm_add_path(AuthRealm_t *realm, const char *path) dList_append(realm->paths, n_path); } -/* +/** * Return the authorization header for an HTTP query. * request_uri is a separate argument because we want it precisely as * formatted in the request. @@ -487,7 +488,7 @@ char *a_Auth_get_auth_str(const DilloUrl *url, const char *request_uri) return ret; } -/* +/** * Determine whether the user needs to authenticate. */ static int Auth_do_auth_required(const AuthParse_t *auth_parse, @@ -639,7 +640,7 @@ static int Auth_do_auth_dialog(const AuthParse_t *auth_parse, return ret; } -/* +/** * Do authorization for an auth string. */ static int Auth_do_auth(char *challenge, enum AuthParseHTTPAuthType_t type, @@ -662,7 +663,7 @@ static int Auth_do_auth(char *challenge, enum AuthParseHTTPAuthType_t type, return reload; } -/* +/** * Given authentication challenge(s), prepare authorization. * Return: 0 on failure * nonzero on success. A new query will be sent to the server. diff --git a/src/binaryconst.h b/src/binaryconst.h index 09d4e7fa..71215c41 100644 --- a/src/binaryconst.h +++ b/src/binaryconst.h @@ -1,14 +1,16 @@ #ifndef __BINARYCONST_H__ #define __BINARYCONST_H__ -/* binaryconst.h was integrated into the Dillo project in April 2004, and +/* @file + * + * Macros for allowing binary constants in C. + * By Tom Torfs - donated to the public domain + * + * binaryconst.h was integrated into the Dillo project in April 2004, and * presumably comes from the ancestor of the code found at * http://cprog.tomsweb.net/binconst.txt */ -/* Macros for allowing binary constants in C - * By Tom Torfs - donated to the public domain */ - #define HEX__(n) 0x##n##LU /* 8-bit conversion function */ diff --git a/src/bitvec.c b/src/bitvec.c index 8ca04f58..bd4475cb 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/** @file * A simple ADT for bit arrays */ @@ -17,7 +17,7 @@ #include "bitvec.h" -/* +/** * Create a new bitvec with 'num_bits' size */ bitvec_t *a_Bitvec_new(int num_bits) @@ -29,7 +29,7 @@ bitvec_t *a_Bitvec_new(int num_bits) return bvec; } -/* +/** * Clear a bitvec */ void a_Bitvec_clear(bitvec_t *bvec) @@ -37,7 +37,7 @@ void a_Bitvec_clear(bitvec_t *bvec) memset(bvec->vec, 0, sizeof(uchar_t) * bvec->len/BVEC_SIZE + 1); } -/* +/** * Free a bitvec */ void a_Bitvec_free(bitvec_t *bvec) @@ -48,7 +48,7 @@ void a_Bitvec_free(bitvec_t *bvec) } } -/* +/** * Get a bit */ int a_Bitvec_get_bit(bitvec_t *bvec, int pos) @@ -57,7 +57,7 @@ int a_Bitvec_get_bit(bitvec_t *bvec, int pos) return (bvec->vec[pos/BVEC_SIZE] & 1 << pos % BVEC_SIZE); } -/* +/** * Set a bit */ void a_Bitvec_set_bit(bitvec_t *bvec, int pos) diff --git a/src/bookmark.c b/src/bookmark.c index 9a594789..00fdfd36 100644 --- a/src/bookmark.c +++ b/src/bookmark.c @@ -19,7 +19,7 @@ -/* +/** * Have a short chat with the bookmarks server, * and finally ask it to add a new bookmark. * (this is an example of dpi chat) @@ -65,7 +65,7 @@ void a_Bookmarks_chat_add(BrowserWindow *Bw, char *Cmd, char *answer) } } -/* +/** * Add the new bookmark through the bookmarks server */ void a_Bookmarks_add(BrowserWindow *bw, const DilloUrl *url) @@ -9,7 +9,9 @@ * (at your option) any later version. */ -/* Data structures for each browser window */ +/** @file + * Data structures for each browser window + */ #include "bw.h" @@ -27,7 +29,7 @@ static BrowserWindow **bws; static int num_bws, num_bws_max; -/* +/** * Initialize global data */ void a_Bw_init(void) @@ -37,7 +39,7 @@ void a_Bw_init(void) bws = NULL; } -/* +/** * Create a new browser window and return it. * (the new window is stored in browser_window[]) */ @@ -78,7 +80,7 @@ BrowserWindow *a_Bw_new() return bw; } -/* +/** * Free resources associated to a bw. */ void a_Bw_free(BrowserWindow *bw) @@ -112,7 +114,7 @@ void a_Bw_free(BrowserWindow *bw) } /*- Clients ----------------------------------------------------------------*/ -/* +/** * Add a reference to a cache-client. It is kept int this bw's list. * This helps us keep track of which are active in the window so that it's * possible to abort/stop them. @@ -136,7 +138,7 @@ void a_Bw_add_client(BrowserWindow *bw, int Key, int Root) a_UIcmd_set_buttons_sens(bw); } -/* +/** * Remove the cache-client from the bw's list * (client can be a image or a html page) * Return: 0 if found, 1 otherwise. @@ -154,7 +156,7 @@ int a_Bw_remove_client(BrowserWindow *bw, int ClientKey) return data ? 0 : 1; } -/* +/** * Close a cache-client upon successful retrieval. * Remove the cache-client from the bw list and update the meters. * (client can be a image or a html page) @@ -170,7 +172,7 @@ void a_Bw_close_client(BrowserWindow *bw, int ClientKey) } } -/* +/** * Stop the active clients of this bw's top page. * Note: rendering stops, but the cache continues to be fed. */ @@ -196,7 +198,7 @@ void a_Bw_stop_clients(BrowserWindow *bw, int flags) } /*- Page -------------------------------------------------------------------*/ -/* +/** * Add an URL to the browser window's list. * This helps us keep track of page-requested URLs so that it's * possible to stop, abort and reload them. @@ -210,7 +212,7 @@ void a_Bw_add_url(BrowserWindow *bw, const DilloUrl *Url) } } -/* +/** * Add a document to the browser window's list. */ void a_Bw_add_doc(BrowserWindow *bw, void *vdoc) @@ -220,7 +222,7 @@ void a_Bw_add_doc(BrowserWindow *bw, void *vdoc) dList_append(bw->Docs, vdoc); } -/* +/** * Get current document. */ void *a_Bw_get_current_doc(BrowserWindow *bw) @@ -236,7 +238,7 @@ void *a_Bw_get_current_doc(BrowserWindow *bw) return doc; } -/* +/** * Get document by URL. * * This is currently used by popup menus that need to ensure that the @@ -252,7 +254,7 @@ void *a_Bw_get_url_doc(BrowserWindow *bw, const DilloUrl *url) return doc; } -/* +/** * Remove a document from the bw's list */ void a_Bw_remove_doc(BrowserWindow *bw, void *vdoc) @@ -265,7 +267,7 @@ void a_Bw_remove_doc(BrowserWindow *bw, void *vdoc) } /*- Cleanup ----------------------------------------------------------------*/ -/* +/** * Empty RootClients, ImageClients and PageUrls lists and * reset progress bar data. */ @@ -302,7 +304,7 @@ int a_Bw_num() return num_bws; } -/* +/** * Return a bw by index */ BrowserWindow *a_Bw_get(int i) @@ -11,50 +11,50 @@ #define BW_Force (4) /* Stop connection too */ -/* browser_window contains the specific data for a single window */ +/** Contains the specific data for a single window */ typedef struct { - /* Pointer to the UI object this bw belongs to */ + /** Pointer to the UI object this bw belongs to */ void *ui; - /* All the rendering is done by this. + /** All the rendering is done by this. * It is defined as a void pointer to avoid C++ in this structure. * C++ sources have to include "dw/core.hh" and cast it into an object. */ void *render_layout; - /* Root document(s). Currently only used by DilloHtml */ + /** Root document(s). Currently only used by DilloHtml */ Dlist *Docs; - /* A list of active cache clients in the window (The primary Key) */ + /** A list of active cache clients in the window (The primary Key) */ Dlist *RootClients; - /* Image Keys for all active connections in the window */ + /** Image Keys for all active connections in the window */ Dlist *ImageClients; - /* Number of images in the page */ + /** Number of images in the page */ int NumImages; - /* Number of images already loaded */ + /** Number of images already loaded */ int NumImagesGot; - /* Number of not yet arrived style sheets */ + /** Number of not yet arrived style sheets */ int NumPendingStyleSheets; - /* List of all Urls requested by this page (and its types) */ + /** List of all Urls requested by this page (and its types) */ Dlist *PageUrls; - /* The navigation stack (holds indexes to history list) */ + /** The navigation stack (holds indexes to history list) */ Dlist *nav_stack; - /* 'nav_stack_ptr' refers to what's being displayed */ + /** 'nav_stack_ptr' refers to what's being displayed */ int nav_stack_ptr; /* [0 based; -1 = empty] */ - /* When the user clicks a link, the URL isn't pushed directly to history; + /** When the user clicks a link, the URL isn't pushed directly to history; * nav_expect_url holds it until a dw is assigned to it. Only then an entry * is made in history and referenced at the top of nav_stack */ DilloUrl *nav_expect_url; - /* Counter for the number of hops on a redirection. Used to stop + /** Counter for the number of hops on a redirection. Used to stop * redirection loops (accounts for WEB_RootUrl only) */ int redirect_level; - /* Url for zero-delay redirections in the META element */ + /** Url for zero-delay redirections in the META element */ int meta_refresh_status; DilloUrl *meta_refresh_url; - /* HTML-bugs detected at parse time */ + /** HTML-bugs detected at parse time */ int num_page_bugs; Dstr *page_bugs; } BrowserWindow; diff --git a/src/cache.c b/src/cache.c index bdda48fd..7ee30d09 100644 --- a/src/cache.c +++ b/src/cache.c @@ -10,6 +10,7 @@ */ /* + * @file * Dillo's cache module */ @@ -35,9 +36,9 @@ #include "timeout.hh" #include "uicmd.hh" -/* Maximum initial size for the automatically-growing data buffer */ +/** Maximum initial size for the automatically-growing data buffer */ #define MAX_INIT_BUF 1024*1024 -/* Maximum filesize for a URL, before offering a download */ +/** Maximum filesize for a URL, before offering a download */ #define HUGE_FILESIZE 15*1024*1024 /* @@ -45,37 +46,37 @@ */ typedef struct { - const DilloUrl *Url; /* Cached Url. Url is used as a primary Key */ - char *TypeDet; /* MIME type string (detected from data) */ - char *TypeHdr; /* MIME type string as from the HTTP Header */ - char *TypeMeta; /* MIME type string from META HTTP-EQUIV */ - char *TypeNorm; /* MIME type string normalized */ - Dstr *Header; /* HTTP header */ - const DilloUrl *Location; /* New URI for redirects */ - Dlist *Auth; /* Authentication fields */ - Dstr *Data; /* Pointer to raw data */ - Dstr *UTF8Data; /* Data after charset translation */ - int DataRefcount; /* Reference count */ - DecodeTransfer *TransferDecoder; /* Transfer decoder (e.g., chunked) */ - Decode *ContentDecoder; /* Data decoder (e.g., gzip) */ - Decode *CharsetDecoder; /* Translates text to UTF-8 encoding */ - int ExpectedSize; /* Goal size of the HTTP transfer (0 if unknown)*/ - int TransferSize; /* Actual length of the HTTP transfer */ - uint_t Flags; /* See Flag Defines in cache.h */ + const DilloUrl *Url; /**< Cached Url. Url is used as a primary Key */ + char *TypeDet; /**< MIME type string (detected from data) */ + char *TypeHdr; /**< MIME type string as from the HTTP Header */ + char *TypeMeta; /**< MIME type string from META HTTP-EQUIV */ + char *TypeNorm; /**< MIME type string normalized */ + Dstr *Header; /**< HTTP header */ + const DilloUrl *Location; /**< New URI for redirects */ + Dlist *Auth; /**< Authentication fields */ + Dstr *Data; /**< Pointer to raw data */ + Dstr *UTF8Data; /**< Data after charset translation */ + int DataRefcount; /**< Reference count */ + DecodeTransfer *TransferDecoder; /**< Transfer decoder (e.g., chunked) */ + Decode *ContentDecoder; /**< Data decoder (e.g., gzip) */ + Decode *CharsetDecoder; /**< Translates text to UTF-8 encoding */ + int ExpectedSize; /**< Goal size of the HTTP transfer (0 if unknown)*/ + int TransferSize; /**< Actual length of the HTTP transfer */ + uint_t Flags; /**< See Flag Defines in cache.h */ } CacheEntry_t; /* * Local data */ -/* A sorted list for cached data. Holds pointers to CacheEntry_t structs */ +/** A sorted list for cached data. Holds pointers to CacheEntry_t structs */ static Dlist *CachedURLs; -/* A list for cache clients. +/** A list for cache clients. * Although implemented as a list, we'll call it ClientQueue --Jcid */ static Dlist *ClientQueue; -/* A list for delayed clients (it holds weak pointers to cache entries, +/** A list for delayed clients (it holds weak pointers to cache entries, * which are used to make deferred calls to Cache_process_queue) */ static Dlist *DelayedQueue; static uint_t DelayedQueueIdleId = 0; @@ -89,7 +90,7 @@ static void Cache_delayed_process_queue(CacheEntry_t *entry); static void Cache_auth_entry(CacheEntry_t *entry, BrowserWindow *bw); static void Cache_entry_inject(const DilloUrl *Url, Dstr *data_ds); -/* +/** * Determine if two cache entries are equal (used by CachedURLs) */ static int Cache_entry_cmp(const void *v1, const void *v2) @@ -99,7 +100,7 @@ static int Cache_entry_cmp(const void *v1, const void *v2) return a_Url_cmp(d1->Url, d2->Url); } -/* +/** * Determine if two cache entries are equal, using a URL as key. */ static int Cache_entry_by_url_cmp(const void *v1, const void *v2) @@ -110,7 +111,7 @@ static int Cache_entry_by_url_cmp(const void *v1, const void *v2) return a_Url_cmp(u1, u2); } -/* +/** * Initialize cache data */ void a_Cache_init(void) @@ -131,7 +132,7 @@ void a_Cache_init(void) /* Client operations ------------------------------------------------------ */ -/* +/** * Add a client to ClientQueue. * - Every client-field is just a reference (except 'Web'). * - Return a unique number for identifying the client. @@ -162,7 +163,7 @@ static int Cache_client_enqueue(const DilloUrl *Url, DilloWeb *Web, return ClientKey; } -/* +/** * Compare function for searching a Client by its key */ static int Cache_client_by_key_cmp(const void *client, const void *key) @@ -170,7 +171,7 @@ static int Cache_client_by_key_cmp(const void *client, const void *key) return ((CacheClient_t *)client)->Key - VOIDP2INT(key); } -/* +/** * Remove a client from the queue */ static void Cache_client_dequeue(CacheClient_t *Client) @@ -185,7 +186,7 @@ static void Cache_client_dequeue(CacheClient_t *Client) /* Entry operations ------------------------------------------------------- */ -/* +/** * Set safe values for a new cache entry */ static void Cache_entry_init(CacheEntry_t *NewEntry, const DilloUrl *Url) @@ -209,7 +210,7 @@ static void Cache_entry_init(CacheEntry_t *NewEntry, const DilloUrl *Url) NewEntry->Flags = CA_IsEmpty | CA_InProgress | CA_KeepAlive; } -/* +/** * Get the data structure for a cached URL (using 'Url' as the search key) * If 'Url' isn't cached, return NULL */ @@ -218,7 +219,7 @@ static CacheEntry_t *Cache_entry_search(const DilloUrl *Url) return dList_find_sorted(CachedURLs, Url, Cache_entry_by_url_cmp); } -/* +/** * Given a URL, find its cache entry, following redirections. */ static CacheEntry_t *Cache_entry_search_with_redirect(const DilloUrl *Url) @@ -242,7 +243,7 @@ static CacheEntry_t *Cache_entry_search_with_redirect(const DilloUrl *Url) return entry; } -/* +/** * Allocate and set a new entry in the cache list */ static CacheEntry_t *Cache_entry_add(const DilloUrl *Url) @@ -260,7 +261,7 @@ static CacheEntry_t *Cache_entry_add(const DilloUrl *Url) return new_entry; } -/* +/** * Inject full page content directly into the cache. * Used for "about:splash". May be used for "about:cache" too. */ @@ -279,7 +280,7 @@ static void Cache_entry_inject(const DilloUrl *Url, Dstr *data_ds) entry->ExpectedSize = entry->TransferSize = entry->Data->len; } -/* +/** * Free Authentication fields. */ static void Cache_auth_free(Dlist *auth) @@ -291,7 +292,7 @@ static void Cache_auth_free(Dlist *auth) dList_free(auth); } -/* +/** * Free the components of a CacheEntry_t struct. */ static void Cache_entry_free(CacheEntry_t *entry) @@ -315,7 +316,7 @@ static void Cache_entry_free(CacheEntry_t *entry) dFree(entry); } -/* +/** * Remove an entry, from the cache. * All the entry clients are removed too! (it may stop rendering of this * same resource on other windows, but nothing more). @@ -349,7 +350,7 @@ static void Cache_entry_remove(CacheEntry_t *entry, DilloUrl *url) Cache_entry_free(entry); } -/* +/** * Wrapper for capi. */ void a_Cache_entry_remove_by_url(DilloUrl *url) @@ -359,7 +360,7 @@ void a_Cache_entry_remove_by_url(DilloUrl *url) /* Misc. operations ------------------------------------------------------- */ -/* +/** * Try finding the url in the cache. If it hits, send the cache contents * from there. If it misses, set up a new connection. * @@ -369,7 +370,7 @@ void a_Cache_entry_remove_by_url(DilloUrl *url) * Note: 'Call' and/or 'CbData' can be NULL, in that case they get set * later by a_Web_dispatch_by_type, based on content/type and 'Web' data. * - * Return value: A primary key for identifying the client, + * @return A primary key for identifying the client, */ int a_Cache_open_url(void *web, CA_Callback_t Call, void *CbData) { @@ -398,7 +399,7 @@ int a_Cache_open_url(void *web, CA_Callback_t Call, void *CbData) return ClientKey; } -/* +/** * Get cache entry status */ uint_t a_Cache_get_flags(const DilloUrl *url) @@ -407,7 +408,7 @@ uint_t a_Cache_get_flags(const DilloUrl *url) return (entry ? entry->Flags : 0); } -/* +/** * Get cache entry status (following redirections). */ uint_t a_Cache_get_flags_with_redirection(const DilloUrl *url) @@ -416,7 +417,7 @@ uint_t a_Cache_get_flags_with_redirection(const DilloUrl *url) return (entry ? entry->Flags : 0); } -/* +/** * Reference the cache data. */ static void Cache_ref_data(CacheEntry_t *entry) @@ -434,7 +435,7 @@ static void Cache_ref_data(CacheEntry_t *entry) } } -/* +/** * Unreference the cache data. */ static void Cache_unref_data(CacheEntry_t *entry) @@ -455,7 +456,7 @@ static void Cache_unref_data(CacheEntry_t *entry) } } -/* +/** * Get current content type. */ static const char *Cache_current_content_type(CacheEntry_t *entry) @@ -464,7 +465,7 @@ static const char *Cache_current_content_type(CacheEntry_t *entry) : entry->TypeHdr ? entry->TypeHdr : entry->TypeDet; } -/* +/** * Get current Content-Type for cache entry found by URL. */ const char *a_Cache_get_content_type(const DilloUrl *url) @@ -474,7 +475,7 @@ const char *a_Cache_get_content_type(const DilloUrl *url) return (entry) ? Cache_current_content_type(entry) : NULL; } -/* +/** * Get pointer to entry's data. */ static Dstr *Cache_data(CacheEntry_t *entry) @@ -482,10 +483,10 @@ static Dstr *Cache_data(CacheEntry_t *entry) return entry->UTF8Data ? entry->UTF8Data : entry->Data; } -/* +/** * Change Content-Type for cache entry found by url. * from = { "http" | "meta" } - * Return new content type. + * @return new content type. */ const char *a_Cache_set_content_type(const DilloUrl *url, const char *ctype, const char *from) @@ -538,9 +539,9 @@ const char *a_Cache_set_content_type(const DilloUrl *url, const char *ctype, return curr; } -/* +/** * Get the pointer to the URL document, and its size, from the cache entry. - * Return: 1 cached, 0 not cached. + * @return 1 cached, 0 not cached. */ int a_Cache_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize) { @@ -558,7 +559,7 @@ int a_Cache_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize) return (entry ? 1 : 0); } -/* +/** * Unreference the data buffer when no longer using it. */ void a_Cache_unref_buf(const DilloUrl *Url) @@ -567,10 +568,10 @@ void a_Cache_unref_buf(const DilloUrl *Url) } -/* +/** * Extract a single field from the header, allocating and storing the value * in 'field'. ('fieldname' must not include the trailing ':') - * Return a new string with the field-content if found (NULL on error) + * @return a new string with the field-content if found (NULL on error) * (This function expects a '\r'-stripped header, with one-line header fields) */ static char *Cache_parse_field(const char *header, const char *fieldname) @@ -604,7 +605,7 @@ static char *Cache_parse_field(const char *header, const char *fieldname) return NULL; } -/* +/** * Extract multiple fields from the header. */ static Dlist *Cache_parse_multiple_fields(const char *header, @@ -646,7 +647,7 @@ static Dlist *Cache_parse_multiple_fields(const char *header, return fields; } -/* +/** * Scan, allocate, and set things according to header info. * (This function needs the whole header to work) */ @@ -810,7 +811,7 @@ static void Cache_parse_header(CacheEntry_t *entry) Cache_ref_data(entry); } -/* +/** * Consume bytes until the whole header is got (up to a "\r\n\r\n" sequence) * (Also unfold multi-line fields and strip '\r' chars from header) */ @@ -879,7 +880,7 @@ static void Cache_finish_msg(CacheEntry_t *entry) } } -/* +/** * Receive new data, update the reception buffer (for next read), update the * cache, and service the client queue. * @@ -982,7 +983,7 @@ bool_t a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, return done; } -/* +/** * Process redirections (HTTP 30x answers) * (This is a work in progress --not finished yet) */ @@ -1041,7 +1042,7 @@ typedef struct { BrowserWindow *bw; } CacheAuthData_t; -/* +/** * Ask for user/password and reload the page. */ static void Cache_auth_callback(void *vdata) @@ -1056,7 +1057,7 @@ static void Cache_auth_callback(void *vdata) a_Timeout_remove(); } -/* +/** * Set a timeout function to ask for user/password. */ static void Cache_auth_entry(CacheEntry_t *entry, BrowserWindow *bw) @@ -1079,9 +1080,9 @@ static void Cache_auth_entry(CacheEntry_t *entry, BrowserWindow *bw) } } -/* +/** * Check whether a URL scheme is downloadable. - * Return: 1 enabled, 0 disabled. + * @return 1 enabled, 0 disabled. */ int a_Cache_download_enabled(const DilloUrl *url) { @@ -1092,7 +1093,7 @@ int a_Cache_download_enabled(const DilloUrl *url) return 0; } -/* +/** * Don't process data any further, but let the cache fill the entry. * (Currently used to handle WEB_RootUrl redirects, * and to ignore image redirects --Jcid) @@ -1119,7 +1120,7 @@ typedef struct { DilloUrl *url; } Cache_savelink_t; -/* +/** * Save link from behind a timeout so that Cache_process_queue() can * get on with its work. */ @@ -1132,7 +1133,7 @@ static void Cache_savelink_cb(void *vdata) dFree(data); } -/* +/** * Let the client know that we're not following a redirection. */ static void Cache_provide_redirection_blocked_page(CacheEntry_t *entry, @@ -1153,7 +1154,7 @@ static void Cache_provide_redirection_blocked_page(CacheEntry_t *entry, dFree(client->Buf); } -/* +/** * Update cache clients for a single cache-entry * Tasks: * - Set the client function (if not already set) @@ -1161,7 +1162,7 @@ static void Cache_provide_redirection_blocked_page(CacheEntry_t *entry, * - Remove clients when done * - Call redirect handler * - * Return: Cache entry, which may be NULL if it has been removed. + * @return Cache entry, which may be NULL if it has been removed. * * TODO: Implement CA_Abort Op in client callback */ @@ -1349,7 +1350,7 @@ static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry) return entry; } -/* +/** * Callback function for Cache_delayed_process_queue. */ static void Cache_delayed_process_queue_callback() @@ -1367,7 +1368,7 @@ static void Cache_delayed_process_queue_callback() a_Timeout_remove(); } -/* +/** * Set a call to Cache_process_queue from the main cycle. */ static void Cache_delayed_process_queue(CacheEntry_t *entry) @@ -1383,9 +1384,9 @@ static void Cache_delayed_process_queue(CacheEntry_t *entry) } } -/* +/** * Last Client for this entry? - * Return: Client if true, NULL otherwise + * @return Client if true, NULL otherwise * (cache.c has only one call to a capi function. This avoids a second one) */ CacheClient_t *a_Cache_client_get_if_unique(int Key) @@ -1404,7 +1405,7 @@ CacheClient_t *a_Cache_client_get_if_unique(int Key) return (n == 1) ? Client : NULL; } -/* +/** * Remove a client from the client queue * TODO: notify the dicache and upper layers */ @@ -1434,7 +1435,7 @@ void a_Cache_stop_client(int Key) } -/* +/** * Memory deallocator (only called at exit time) */ void a_Cache_freeall(void) diff --git a/src/cache.h b/src/cache.h index 833e4394..72ed2196 100644 --- a/src/cache.h +++ b/src/cache.h @@ -37,23 +37,23 @@ extern "C" { typedef struct CacheClient CacheClient_t; -/* +/** * Callback type for cache clients */ typedef void (*CA_Callback_t)(int Op, CacheClient_t *Client); -/* +/** * Data structure for cache clients. */ struct CacheClient { - int Key; /* Primary Key for this client */ - const DilloUrl *Url; /* Pointer to a cache entry Url */ - int Version; /* Dicache version of this Url (0 if not used) */ - void *Buf; /* Pointer to cache-data */ - uint_t BufSize; /* Valid size of cache-data */ - CA_Callback_t Callback; /* Client function */ - void *CbData; /* Client function data */ - void *Web; /* Pointer to the Web structure of our client */ + int Key; /**< Primary Key for this client */ + const DilloUrl *Url; /**< Pointer to a cache entry Url */ + int Version; /**< Dicache version of this Url (0 if not used) */ + void *Buf; /**< Pointer to cache-data */ + uint_t BufSize; /**< Valid size of cache-data */ + CA_Callback_t Callback; /**< Client function */ + void *CbData; /**< Client function data */ + void *Web; /**< Pointer to the Web structure of our client */ }; /* @@ -10,8 +10,9 @@ * (at your option) any later version. */ -/* - * Cache API +/** + * @file + * Cache API. * This is the module that manages the cache and starts the CCC chains * to get the requests served. Kind of a broker. */ @@ -36,7 +37,7 @@ #include "bookmark.h" typedef struct { - DilloUrl *url; /* local copy of web->url */ + DilloUrl *url; /**< local copy of web->url */ void *bw; char *server; char *datastr; @@ -48,7 +49,7 @@ typedef struct { int Ref; } capi_conn_t; -/* Flags for conn */ +/** Flags for conn */ enum { PENDING = 1, TIMEOUT = 2, /* unused */ @@ -58,10 +59,10 @@ enum { /* * Local data */ -/* Data list for active dpi connections */ +/** Data list for active dpi connections */ static Dlist *CapiConns; /* Data list for active connections; it holds * pointers to capi_conn_t structures. */ -/* Last URL asked for view source */ +/** Last URL asked for view source */ static DilloUrl *CapiVsUrl = NULL; /* @@ -73,7 +74,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info, /* ------------------------------------------------------------------------- */ -/* +/** * Initialize capi&cache data */ void a_Capi_init(void) @@ -86,7 +87,7 @@ void a_Capi_init(void) /* ------------------------------------------------------------------------- */ -/* +/** * Create a new connection data structure */ static capi_conn_t * @@ -107,16 +108,16 @@ static capi_conn_t * return conn; } -/* +/** * Validate a capi_conn_t pointer. - * Return value: NULL if not valid, conn otherwise. + * @return NULL if not valid, conn otherwise. */ static capi_conn_t *Capi_conn_valid(capi_conn_t *conn) { return dList_find(CapiConns, conn); } -/* +/** * Increment the reference count and add to the list if not present */ static void Capi_conn_ref(capi_conn_t *conn) @@ -128,7 +129,7 @@ static void Capi_conn_ref(capi_conn_t *conn) _MSG(" Capi_conn_ref #%d %p\n", conn->Ref, conn); } -/* +/** * Decrement the reference count (and remove from list when zero) */ static void Capi_conn_unref(capi_conn_t *conn) @@ -148,7 +149,7 @@ static void Capi_conn_unref(capi_conn_t *conn) _MSG(" Capi_conn_unref CapiConns=%d\n", dList_length(CapiConns)); } -/* +/** * Compare function for searching a conn by server string */ static int Capi_conn_by_server_cmp(const void *v1, const void *v2) @@ -159,7 +160,7 @@ static int Capi_conn_by_server_cmp(const void *v1, const void *v2) return strcmp(node->server, server); } -/* +/** * Find connection data by server */ static capi_conn_t *Capi_conn_find(char *server) @@ -167,7 +168,7 @@ static capi_conn_t *Capi_conn_find(char *server) return dList_find_custom(CapiConns, (void*)server, Capi_conn_by_server_cmp); } -/* +/** * Resume connections that were waiting for dpid to start. */ static void Capi_conn_resume(void) @@ -189,7 +190,7 @@ static void Capi_conn_resume(void) } } -/* +/** * Abort the connection for a given url, using its CCC. * (OpAbort 2,BCK removes the cache entry) * TODO: when conn is already done, the cache entry isn't removed. @@ -216,7 +217,7 @@ void a_Capi_conn_abort_by_url(const DilloUrl *url) /* ------------------------------------------------------------------------- */ -/* +/** * Store the last URL requested by "view source" */ void a_Capi_set_vsource_url(const DilloUrl *url) @@ -225,7 +226,7 @@ void a_Capi_set_vsource_url(const DilloUrl *url) CapiVsUrl = a_Url_dup(url); } -/* +/** * Safety test: only allow GET|POST dpi-urls from dpi-generated pages. */ int a_Capi_dpi_verify_request(BrowserWindow *bw, DilloUrl *url) @@ -262,7 +263,7 @@ int a_Capi_dpi_verify_request(BrowserWindow *bw, DilloUrl *url) return allow; } -/* +/** * If the url belongs to a dpi server, return its name. */ static int Capi_url_uses_dpi(DilloUrl *url, char **server_ptr) @@ -295,7 +296,7 @@ static int Capi_url_uses_dpi(DilloUrl *url, char **server_ptr) return ((*server_ptr = server) ? 1 : 0); } -/* +/** * Build the dpip command tag, according to URL and server. */ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server) @@ -314,7 +315,7 @@ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server) return cmd; } -/* +/** * Send the requested URL's source to the "view source" dpi */ static void Capi_dpi_send_source(BrowserWindow *bw, DilloUrl *url) @@ -340,7 +341,7 @@ static void Capi_dpi_send_source(BrowserWindow *bw, DilloUrl *url) dFree(cmd); } -/* +/** * Shall we permit this request to open a URL? */ static bool_t Capi_request_permitted(DilloWeb *web) @@ -380,13 +381,13 @@ static bool_t Capi_request_permitted(DilloWeb *web) return permit; } -/* +/** * Most used function for requesting a URL. * TODO: clean up the ad-hoc bindings with an API that allows dynamic * addition of new plugins. * - * Return value: A primary key for identifying the client, - * 0 if the client is aborted in the process. + * @return A primary key for identifying the client, + * 0 if the client is aborted in the process. */ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData) { @@ -492,7 +493,7 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData) return ret; } -/* +/** * Convert cache-defined flags to Capi ones. */ static int Capi_map_cache_flags(uint_t flags) @@ -513,7 +514,7 @@ static int Capi_map_cache_flags(uint_t flags) return status; } -/* +/** * Return status information of an URL's content-transfer process. */ int a_Capi_get_flags(const DilloUrl *Url) @@ -523,7 +524,7 @@ int a_Capi_get_flags(const DilloUrl *Url) return status; } -/* +/** * Same as a_Capi_get_flags() but following redirections. */ int a_Capi_get_flags_with_redirection(const DilloUrl *Url) @@ -533,7 +534,7 @@ int a_Capi_get_flags_with_redirection(const DilloUrl *Url) return status; } -/* +/** * Get the cache's buffer for the URL, and its size. * Return: 1 cached, 0 not cached. */ @@ -542,7 +543,7 @@ int a_Capi_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize) return a_Cache_get_buf(Url, PBuf, BufSize); } -/* +/** * Unref the cache's buffer when no longer using it. */ void a_Capi_unref_buf(const DilloUrl *Url) @@ -550,7 +551,7 @@ void a_Capi_unref_buf(const DilloUrl *Url) a_Cache_unref_buf(Url); } -/* +/** * Get the Content-Type associated with the URL */ const char *a_Capi_get_content_type(const DilloUrl *url) @@ -558,7 +559,7 @@ const char *a_Capi_get_content_type(const DilloUrl *url) return a_Cache_get_content_type(url); } -/* +/** * Set the Content-Type for the URL. */ const char *a_Capi_set_content_type(const DilloUrl *url, const char *ctype, @@ -567,8 +568,8 @@ const char *a_Capi_set_content_type(const DilloUrl *url, const char *ctype, return a_Cache_set_content_type(url, ctype, from); } -/* - * Send data to a dpi (e.g. add_bookmark, open_url, send_preferences, ...) +/** + * Send data to a dpi (e.g. add_bookmark, open_url, send_preferences, ...). * Most of the time we send dpi commands, but it also serves for raw data * as with "view source". */ @@ -603,7 +604,7 @@ int a_Capi_dpi_send_data(const DilloUrl *url, void *bw, return 0; } -/* +/** * Send a dpi cmd. * (For instance: add_bookmark, open_url, send_preferences, ...) */ @@ -613,7 +614,7 @@ int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server, return a_Capi_dpi_send_data(url, bw, cmd, strlen(cmd), server, flags); } -/* +/** * Remove a client from the cache client queue. * force = also abort the CCC if this is the last client. */ @@ -631,7 +632,7 @@ void a_Capi_stop_client(int Key, int force) a_Cache_stop_client(Key); } -/* +/** * CCC function for the CAPI module */ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info, diff --git a/src/chain.c b/src/chain.c index a13b3120..daf13f39 100644 --- a/src/chain.c +++ b/src/chain.c @@ -1,8 +1,4 @@ /* - * File: chain.c - * Concomitant control chain (CCC) - * Theory and code by Jorge Arellano Cid - * * Copyright 2001-2007 Jorge Arellano Cid <jcid@dillo.org> * * This program is free software; you can redistribute it and/or modify @@ -11,13 +7,19 @@ * (at your option) any later version. */ +/** + * @file + * Concomitant control chain (CCC). + * Theory and code by Jorge Arellano Cid + */ + #include "msg.h" #include "chain.h" #include "../dlib/dlib.h" #define VERBOSE 0 -/* +/** * Show debugging info */ #if VERBOSE @@ -34,7 +36,7 @@ static void Chain_debug_msg(char *FuncStr, int Op, int Branch, int Dir, static void Chain_debug_msg(char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info) { } #endif -/* +/** * Create and initialize a new chain-link */ ChainLink *a_Chain_new(void) @@ -42,13 +44,13 @@ ChainLink *a_Chain_new(void) return dNew0(ChainLink, 1); } -/* +/** * Create a new link from module A to module B. - * 'Direction' tells whether to make a forward or backward link. - * => The link from 'A' to 'B' has 'Direction' direction. - * => The main flow of information names the FWD direction. - * => AtoB_branch: branch on which 'B' receives communications from 'A' - * => BtoA_branch: branch on which 'A' receives communications from 'B' + * @param Direction tells whether to make a forward or backward link. + * - The link from 'A' to 'B' has @p Direction direction. + * - The main flow of information names the FWD direction. + * @param AtoB_branch branch on which 'B' receives communications from 'A' + * @param BtoA_branch branch on which 'A' receives communications from 'B' */ ChainLink *a_Chain_link_new(ChainLink *AInfo, ChainFunction_t AFunc, int Direction, ChainFunction_t BFunc, @@ -77,9 +79,9 @@ ChainLink *a_Chain_link_new(ChainLink *AInfo, ChainFunction_t AFunc, return NewLink; } -/* +/** * Unlink a previously used link. - * 'Direction' tells whether to unlink the forward or backward link. + * @param Direction tells whether to unlink the forward or backward link. */ void a_Chain_unlink(ChainLink *Info, int Direction) { @@ -94,9 +96,9 @@ void a_Chain_unlink(ChainLink *Info, int Direction) } } -/* +/** * Issue the forward callback of the 'Info' link - * Return value: 1 if OK, 0 if not operative. + * @return 1 if OK, 0 if not operative. */ int a_Chain_fcb(int Op, ChainLink *Info, void *Data1, void *Data2) { @@ -117,9 +119,9 @@ int a_Chain_fcb(int Op, ChainLink *Info, void *Data1, void *Data2) return ret; } -/* +/** * Issue the backward callback of the 'Info' link - * Return value: 1 if OK, 0 if not operative. + * @return 1 if OK, 0 if not operative. */ int a_Chain_bcb(int Op, ChainLink *Info, void *Data1, void *Data2) { @@ -140,10 +142,10 @@ int a_Chain_bcb(int Op, ChainLink *Info, void *Data1, void *Data2) return ret; } -/* +/** * Issue the backward callback of the 'Info' link and then the * forward callback (used for OpAbort and OpStop). - * Return value: 1 if OK, 0 if not operative. + * @return 1 if OK, 0 if not operative. */ int a_Chain_bfcb(int Op, ChainLink *Info, void *Data1, void *Data2) { @@ -163,7 +165,7 @@ int a_Chain_bfcb(int Op, ChainLink *Info, void *Data1, void *Data2) } -/* +/** * Allocate and initialize a new DataBuf structure */ DataBuf *a_Chain_dbuf_new(void *buf, int size, int code) @@ -175,11 +177,11 @@ DataBuf *a_Chain_dbuf_new(void *buf, int size, int code) return dbuf; } -/* +/** * Check whether the CCC is operative. * Also used to hook debug information. * - * Return value: 1 if ready to use, 0 if not operative. + * @return 1 if ready to use, 0 if not operative. */ int a_Chain_check(char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info) diff --git a/src/chain.h b/src/chain.h index 10957dc3..2a83cde0 100644 --- a/src/chain.h +++ b/src/chain.h @@ -33,7 +33,7 @@ typedef struct ChainLink ChainLink; typedef void (*ChainFunction_t)(int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2); -/* This is the main data structure for CCC nodes */ +/** Main data structure for CCC nodes */ struct ChainLink { void *LocalKey; @@ -48,7 +48,7 @@ struct ChainLink { int BcbBranch; }; -/* A convenience data structure for passing data chunks between nodes */ +/** A convenience data structure for passing data chunks between nodes */ typedef struct { char *Buf; int Size; diff --git a/src/colors.c b/src/colors.c index 3e194339..767d5f84 100644 --- a/src/colors.c +++ b/src/colors.c @@ -210,12 +210,12 @@ static const struct key { #define NCOLORS (sizeof(color_keyword) / sizeof(color_keyword[0])) -/* - * Parse a color in hex (RRGGBB) or (RGB) +/** + * Parse a color in hex (RRGGBB) or (RGB). * - * Return Value: - * parsed color if successful (err = 0), - * default_color on error (err = 1). + * @return + * - parsed color if successful (err = 0), + * - default_color on error (err = 1). */ static int32_t Color_parse_hex (const char *s, int32_t default_color, int *err) { @@ -237,7 +237,7 @@ static int32_t Color_parse_hex (const char *s, int32_t default_color, int *err) return ret_color; } -/* +/** * Parse a color string. * * - If the string begins with # or with 0x, return the color number @@ -245,15 +245,15 @@ static int32_t Color_parse_hex (const char *s, int32_t default_color, int *err) * - Else search the set of named colors. * - As a last resort, treat it as bare hex as in the first case. * - * Return Value: - * Parsed color if successful, - * default_color on error. + * @return + * - Parsed color if successful, + * - default_color on error. * * "err" argument: - * 0 if a color beginning with '#' is successfully parsed + * - 0 if a color beginning with '#' is successfully parsed * or the color is a recognized word. - * 1 if the color is bare hex or can't be parsed at all. - * 2 if a color beginning with 0[xX] is successfully parsed. + * - 1 if the color is bare hex or can't be parsed at all. + * - 2 if a color beginning with 0[xX] is successfully parsed. */ int32_t a_Color_parse (const char *str, int32_t default_color, int *err) { @@ -335,11 +335,11 @@ static int Color_distance3(long c1, long c2) (labs((c1 & 0xff0000) - (c2 & 0xff0000)) >= 0x400000); } -/* +/** * Return a suitable "visited link" color - * Return value: - * if candidate has good contrast with C_txt, C_lnk and C_bg -> candidate - * else another color (from the internal list) + * @return + * - if candidate has good contrast with C_txt, C_lnk and C_bg -> candidate + * - else another color (from the internal list) */ int32_t a_Color_vc(int32_t candidate, int32_t C_txt, int32_t C_lnk, int32_t C_bg) diff --git a/src/cookies.c b/src/cookies.c index deaae2ab..589c244f 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -10,13 +10,16 @@ * (at your option) any later version. */ -/* Handling of cookies takes place here. */ +/** + * @file + * Handling of cookies takes place here. + */ #include "msg.h" #ifdef DISABLE_COOKIES -/* +/** * Initialize the cookies module */ void a_Cookies_init(void) @@ -43,7 +46,7 @@ void a_Cookies_init(void) #include "../dpip/dpip.h" -/* The maximum length of a line in the cookie file */ +/** The maximum length of a line in the cookie file */ #define LINE_MAXLEN 4096 typedef enum { @@ -70,7 +73,7 @@ static CookieControlAction Cookies_control_check(const DilloUrl *url); static CookieControlAction Cookies_control_check_domain(const char *domain); static int Cookie_control_init(void); -/* +/** * Return a file pointer. If the file doesn't exist, try to create it, * with the optional 'init_str' as its content. */ @@ -107,7 +110,7 @@ static FILE *Cookies_fopen(const char *filename, char *init_str) return F_in; } -/* +/** * Initialize the cookies module * (The 'disabled' variable is writable only within a_Cookies_init) */ @@ -126,14 +129,14 @@ void a_Cookies_init(void) disabled = FALSE; } -/* +/** * Flush cookies to disk and free all the memory allocated. */ void a_Cookies_freeall() { } -/* +/** * Set the value corresponding to the cookie string */ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url, @@ -176,7 +179,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url, } } -/* +/** * Return a string containing cookie data for an HTTP query. */ char *a_Cookies_get_query(const DilloUrl *query_url, const DilloUrl *requester) @@ -228,12 +231,12 @@ char *a_Cookies_get_query(const DilloUrl *query_url, const DilloUrl *requester) * ------------------------------------------------------------- */ -/* +/** * Get the cookie control rules (from cookiesrc). - * Return value: - * 0 = Parsed OK, with cookies enabled - * 1 = Parsed OK, with cookies disabled - * 2 = Can't open the control file + * @return + * - 0 = Parsed OK, with cookies enabled + * - 1 = Parsed OK, with cookies disabled + * - 2 = Can't open the control file */ static int Cookie_control_init(void) { @@ -326,7 +329,7 @@ static int Cookie_control_init(void) return (enabled ? 0 : 1); } -/* +/** * Check the rules for an appropriate action for this domain. * The rules are ordered by domain length, with longest first, so the * first match is the most specific. @@ -356,8 +359,8 @@ static CookieControlAction Cookies_control_check_domain(const char *domain) return default_action; } -/* - * Same as the above except it takes an URL +/** + * Same as @ref Cookies_control_check_domain except it takes an URL */ static CookieControlAction Cookies_control_check(const DilloUrl *url) { @@ -21,41 +21,43 @@ typedef enum { } CssOrigin; typedef enum { - CSS_TYPE_INTEGER, /* This type is only used internally, for x-* + CSS_TYPE_INTEGER, /**< This type is only used internally, for x-* properties. */ - CSS_TYPE_ENUM, /* Value is i, if represented by + CSS_TYPE_ENUM, /**< Value is i, if represented by enum_symbols[i]. */ - CSS_TYPE_MULTI_ENUM, /* For all enum_symbols[i], 1 << i are + CSS_TYPE_MULTI_ENUM, /**< For all enum_symbols[i], 1 << i are combined. */ - CSS_TYPE_LENGTH_PERCENTAGE, /* <length> or <percentage>. Represented by + CSS_TYPE_LENGTH_PERCENTAGE, /**< <length> or <percentage>. Represented by CssLength. */ - CSS_TYPE_LENGTH, /* <length>, represented as CssLength. + CSS_TYPE_LENGTH, /**< <length>, represented as CssLength. Note: In some cases, CSS_TYPE_LENGTH is used instead of CSS_TYPE_LENGTH_PERCENTAGE, only because Dw cannot handle percentages in this particular case (e.g. 'margin-*-width'). */ - CSS_TYPE_SIGNED_LENGTH, /* As CSS_TYPE_LENGTH but may be negative. */ + CSS_TYPE_SIGNED_LENGTH, /**< As CSS_TYPE_LENGTH but may be negative. */ CSS_TYPE_LENGTH_PERCENTAGE_NUMBER, /* <length> or <percentage>, or <number> */ - CSS_TYPE_AUTO, /* Represented as CssLength of type + CSS_TYPE_AUTO, /**< Represented as CssLength of type CSS_LENGTH_TYPE_AUTO */ - CSS_TYPE_COLOR, /* Represented as integer. */ - CSS_TYPE_FONT_WEIGHT, /* this very special and only used by + CSS_TYPE_COLOR, /**< Represented as integer. */ + CSS_TYPE_FONT_WEIGHT, /**< this very special and only used by 'font-weight' */ - CSS_TYPE_STRING, /* <string> */ - CSS_TYPE_SYMBOL, /* Symbols, which are directly copied (as + CSS_TYPE_STRING, /**< <string> */ + CSS_TYPE_SYMBOL, /**< Symbols, which are directly copied (as opposed to CSS_TYPE_ENUM and CSS_TYPE_MULTI_ENUM). Used for 'font-family'. */ - CSS_TYPE_URI, /* <uri> */ + CSS_TYPE_URI, /**< <uri> */ CSS_TYPE_BACKGROUND_POSITION, - CSS_TYPE_UNUSED /* Not yet used. Will itself get unused some + CSS_TYPE_UNUSED /**< Not yet used. Will itself get unused some day. */ } CssValueType; -/* +/** * Lengths are represented as int in the following way: * + * @verbatim + * * | <------ integer value ------> | * * +---+ - - - +---+---+- - - - - -+---+---+---+---+ @@ -67,24 +69,25 @@ typedef enum { * * | <------ fixed point value ------> | * + * @endverbatim + * * where type is one of the CSS_LENGTH_TYPE_* values. * CSS_LENGTH_TYPE_PX values are stored as * 29 bit signed integer, all other types as fixed point values. */ - typedef int CssLength; typedef enum { CSS_LENGTH_TYPE_NONE, CSS_LENGTH_TYPE_PX, - CSS_LENGTH_TYPE_MM, /* "cm", "in", "pt" and "pc" are converted into + CSS_LENGTH_TYPE_MM, /**< "cm", "in", "pt" and "pc" are converted into millimeters. */ CSS_LENGTH_TYPE_EM, CSS_LENGTH_TYPE_EX, CSS_LENGTH_TYPE_PERCENTAGE, - CSS_LENGTH_TYPE_RELATIVE, /* This does not exist in CSS but + CSS_LENGTH_TYPE_RELATIVE, /**< This does not exist in CSS but is used in HTML */ - CSS_LENGTH_TYPE_AUTO /* This can be used as a simple value. */ + CSS_LENGTH_TYPE_AUTO /**< This can be used as a simple value. */ } CssLengthType; inline CssLength CSS_CREATE_LENGTH (float v, CssLengthType t) { diff --git a/src/cssparser.cc b/src/cssparser.cc index b4a6a305..893f595a 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -288,11 +288,11 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = { typedef struct { const char *symbol; enum { - CSS_SHORTHAND_MULTIPLE, /* [ p1 || p2 || ...], the property pi is + CSS_SHORTHAND_MULTIPLE, /**< [ p1 || p2 || ...], the property pi is * determined by the type */ - CSS_SHORTHAND_DIRECTIONS, /* <t>{1,4} */ - CSS_SHORTHAND_BORDER, /* special, used for 'border' */ - CSS_SHORTHAND_FONT, /* special, used for 'font' */ + CSS_SHORTHAND_DIRECTIONS, /**< <t>{1,4} */ + CSS_SHORTHAND_BORDER, /**< special, used for 'border' */ + CSS_SHORTHAND_FONT, /**< special, used for 'font' */ } type; const CssPropertyName *properties; /* CSS_SHORTHAND_MULTIPLE: * must be terminated by @@ -469,7 +469,7 @@ CssParser::CssParser(CssContext *context, CssOrigin origin, nextToken (); } -/* +/** * Gets the next character from the buffer, or EOF. */ int CssParser::getChar() @@ -487,7 +487,7 @@ int CssParser::getChar() return c; } -/* +/** * Undoes the last getChar(). */ void CssParser::ungetChar() @@ -495,7 +495,7 @@ void CssParser::ungetChar() bufptr--; } -/* +/** * Skip string str if it is found in the input buffer. * If string is found leave bufptr pointing to last matched char. * If not wind back. The first char is passed as parameter c @@ -1209,7 +1209,7 @@ bool CssParser::parseWeight() return false; } -/* +/** * bsearch(3) compare function for searching properties */ static int Css_property_info_cmp(const void *a, const void *b) @@ -1219,7 +1219,7 @@ static int Css_property_info_cmp(const void *a, const void *b) } -/* +/** * bsearch(3) compare function for searching shorthands */ static int Css_shorthand_info_cmp(const void *a, const void *b) diff --git a/src/decode.c b/src/decode.c index 18c22673..974e1c39 100644 --- a/src/decode.c +++ b/src/decode.c @@ -20,7 +20,7 @@ static const int bufsize = 8*1024; -/* +/** * Decode 'Transfer-Encoding: chunked' data */ Dstr *a_Decode_transfer_process(DecodeTransfer *dc, const char *instr, @@ -108,7 +108,7 @@ static void Decode_compression_free(Decode *dc) * for what it accomplished. */ -/* +/** * Decode gzipped data */ static Dstr *Decode_gzip(Decode *dc, const char *instr, int inlen) @@ -144,7 +144,7 @@ static Dstr *Decode_gzip(Decode *dc, const char *instr, int inlen) return output; } -/* +/** * Decode (raw) deflated data */ static Dstr *Decode_raw_deflate(Decode *dc, const char *instr, int inlen) @@ -180,7 +180,7 @@ static Dstr *Decode_raw_deflate(Decode *dc, const char *instr, int inlen) return output; } -/* +/** * Decode deflated data, initially presuming that the required zlib wrapper * is there. On data error, switch to Decode_raw_deflate(). */ @@ -232,7 +232,7 @@ static Dstr *Decode_deflate(Decode *dc, const char *instr, int inlen) return output; } -/* +/** * Translate to desired character set (UTF-8) */ static Dstr *Decode_charset(Decode *dc, const char *instr, int inlen) @@ -285,7 +285,7 @@ static void Decode_charset_free(Decode *dc) dStr_free(dc->leftover, 1); } -/* +/** * Initialize transfer decoder. Currently handles "chunked". */ DecodeTransfer *a_Decode_transfer_init(const char *format) @@ -321,7 +321,7 @@ static Decode *Decode_content_init_common() return dc; } -/* +/** * Initialize content decoder. Currently handles 'gzip' and 'deflate'. */ Decode *a_Decode_content_init(const char *format) @@ -355,7 +355,7 @@ Decode *a_Decode_content_init(const char *format) return dc; } -/* +/** * Initialize decoder to translate from any character set known to iconv() * to UTF-8. * @@ -386,7 +386,7 @@ Decode *a_Decode_charset_init(const char *format) return dc; } -/* +/** * Decode data. */ Dstr *a_Decode_process(Decode *dc, const char *instr, int inlen) diff --git a/src/decode.h b/src/decode.h index 06c987f6..dab0fba3 100644 --- a/src/decode.h +++ b/src/decode.h @@ -21,7 +21,7 @@ typedef struct Decode { typedef struct DecodeTransfer { Dstr *leftover; void *state; - bool_t finished; /* has the terminating chunk been seen? */ + bool_t finished; /**< has the terminating chunk been seen? */ } DecodeTransfer; DecodeTransfer *a_Decode_transfer_init(const char *format); diff --git a/src/dialog.cc b/src/dialog.cc index 64f60e38..da623f98 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -9,7 +9,9 @@ * (at your option) any later version. */ -// UI dialogs +/** @file + * UI dialogs + */ #include <math.h> // for rint() @@ -44,8 +46,8 @@ static int choice_answer; */ //---------------------------------------------------------------------------- -/* - * Used to enable CTRL+{a,e,d,k} in search dialog (for start,end,del,cut) +/** + * Used to enable CTRL+{a,e,d,k} in search dialog (for start,end,del,cut). * TODO: bind down arrow to a search engine selection list. */ class CustInput3 : public Fl_Input { @@ -79,7 +81,7 @@ int CustInput3::handle(int e) return Fl_Input::handle(e); } -/* +/** * Used to make the ENTER key activate the CustChoice */ class CustChoice2 : public Fl_Choice { @@ -117,7 +119,7 @@ int EnterButton::handle(int e) //---------------------------------------------------------------------------- -/* +/** * Display a message in a popup window. */ void a_Dialog_msg(const char *title, const char *msg) @@ -129,7 +131,7 @@ void a_Dialog_msg(const char *title, const char *msg) } -/* +/** * Callback for a_Dialog_input() */ static void input_cb(Fl_Widget *button, void *number) @@ -138,11 +140,11 @@ static void input_cb(Fl_Widget *button, void *number) button->window()->hide(); } -/* +/** * Dialog for one line of Input with a message. * avoids the sound bell in fl_input(), and allows customization * - * Return value: string on success, NULL upon Cancel or Close window + * @return string on success, NULL upon Cancel or Close window */ const char *a_Dialog_input(const char *title, const char *msg) { @@ -223,7 +225,7 @@ const char *a_Dialog_input(const char *title, const char *msg) return (input_answer == 1) ? input_str : NULL; } -/* +/** * Dialog for password */ const char *a_Dialog_passwd(const char *title, const char *msg) @@ -234,10 +236,10 @@ const char *a_Dialog_passwd(const char *title, const char *msg) return fl_password("%s", "", msg); } -/* +/** * Show the save file dialog. * - * Return: pointer to chosen filename, or NULL on Cancel. + * @return pointer to chosen filename, or NULL on Cancel. */ const char *a_Dialog_save_file(const char *title, const char *pattern, const char *fname) @@ -245,10 +247,10 @@ const char *a_Dialog_save_file(const char *title, return fl_file_chooser(title, pattern, fname); } -/* +/** * Show the select file dialog. * - * Return: pointer to chosen filename, or NULL on Cancel. + * @return pointer to chosen filename, or NULL on Cancel. */ const char *a_Dialog_select_file(const char *title, const char *pattern, const char *fname) @@ -260,10 +262,10 @@ const char *a_Dialog_select_file(const char *title, return a_Dialog_save_file(title, pattern, fname); } -/* +/** * Show the open file dialog. * - * Return: pointer to chosen filename, or NULL on Cancel. + * @return pointer to chosen filename, or NULL on Cancel. */ char *a_Dialog_open_file(const char *title, const char *pattern, const char *fname) @@ -274,7 +276,7 @@ char *a_Dialog_open_file(const char *title, return (fc_name) ? a_Misc_escape_chars(fc_name, "% #") : NULL; } -/* +/** * Close text window. */ static void text_window_close_cb(Fl_Widget *, void *vtd) @@ -286,7 +288,7 @@ static void text_window_close_cb(Fl_Widget *, void *vtd) delete buf; } -/* +/** * Show a new window with the provided text */ void a_Dialog_text_window(const char *title, const char *txt) @@ -329,11 +331,11 @@ static void choice_cb(Fl_Widget *button, void *number) button->window()->hide(); } -/* +/** * Make a question-dialog with a question and alternatives. * Last parameter must be NULL. * - * Return value: 0 = dialog was cancelled, >0 = selected alternative. + * @return 0 = dialog was cancelled, >0 = selected alternative. */ int a_Dialog_choice(const char *title, const char *msg, ...) { @@ -402,7 +404,7 @@ static void Dialog_user_password_cb(Fl_Widget *button, void *) button->window()->hide(); } -/* +/** * Make a user/password dialog. * Call the callback with the result (OK or not) and the given user and * password if OK. diff --git a/src/dicache.c b/src/dicache.c index 1fc71e19..48e8e9fc 100644 --- a/src/dicache.c +++ b/src/dicache.c @@ -29,7 +29,7 @@ enum { }; -/* +/** * List of DICacheEntry. May hold several versions of the same image, * although most of the time it holds just one. */ @@ -39,7 +39,7 @@ static uint_t dicache_size_total; /* invariant: dicache_size_total is * the sum of the image sizes (3*w*h) * of all the images in the dicache. */ -/* +/** * Compare function for image entries */ static int Dicache_entry_cmp(const void *v1, const void *v2) @@ -56,7 +56,7 @@ static int Dicache_entry_cmp(const void *v1, const void *v2) return st; } -/* +/** * Initialize dicache data */ void a_Dicache_init(void) @@ -65,7 +65,7 @@ void a_Dicache_init(void) dicache_size_total = 0; } -/* +/** * Create, and initialize a new, empty, dicache entry */ static DICacheEntry *Dicache_entry_new(void) @@ -93,7 +93,7 @@ static DICacheEntry *Dicache_entry_new(void) return entry; } -/* +/** * Add a new entry in the dicache * (a single URL may have several entries) */ @@ -117,9 +117,9 @@ static DICacheEntry *Dicache_add_entry(const DilloUrl *Url) return entry; } -/* +/** * Search a particular version of a URL in the Dicache. - * Return value: a pointer to the entry if found; NULL otherwise. + * @return a pointer to the entry if found; NULL otherwise. * * Notes: DIC_Last means last version of the image. * version zero is not allowed. @@ -138,7 +138,7 @@ DICacheEntry *a_Dicache_get_entry(const DilloUrl *Url, int version) return entry; } -/* +/** * Actually free a dicache entry, given the URL and the version number. */ static void Dicache_remove(const DilloUrl *Url, int version) @@ -168,7 +168,7 @@ static void Dicache_remove(const DilloUrl *Url, int version) dFree(entry); } -/* +/** * Unrefs the counter of a dicache entry (it counts cache clients). * If there're no clients and no imgbuf, remove the entry. * Otherwise, let a_Dicache_cleanup() do the job later @@ -188,7 +188,7 @@ void a_Dicache_unref(const DilloUrl *Url, int version) } } -/* +/** * Refs the counter of a dicache entry. */ DICacheEntry* a_Dicache_ref(const DilloUrl *Url, int version) @@ -201,7 +201,7 @@ DICacheEntry* a_Dicache_ref(const DilloUrl *Url, int version) return entry; } -/* +/** * Invalidate this entry. This is used for the reloading mechanism. * Can't erase current versions, but a_Dicache_get_entry(url, DIC_Last) * must return NULL. @@ -216,7 +216,7 @@ void a_Dicache_invalidate_entry(const DilloUrl *Url) /* ------------------------------------------------------------------------- */ -/* +/** * Set image's width, height & type * - 'width' and 'height' come from the image data. * - HTML width and height attrs are handled with setNonCssHint. @@ -253,7 +253,7 @@ void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image, dicache_size_total += DicEntry->TotalSize; } -/* +/** * Implement the set_cmap method for the Image */ void a_Dicache_set_cmap(DilloUrl *url, int version, int bg_color, @@ -277,7 +277,7 @@ void a_Dicache_set_cmap(DilloUrl *url, int version, int bg_color, DicEntry->State = DIC_SetCmap; } -/* +/** * Reset for a new scan from a multiple-scan image. */ void a_Dicache_new_scan(const DilloUrl *url, int version) @@ -297,7 +297,7 @@ void a_Dicache_new_scan(const DilloUrl *url, int version) a_Imgbuf_new_scan(DicEntry->v_imgbuf); } -/* +/** * Implement the write method * (Write a scan line into the Dicache entry) * buf: row buffer @@ -320,7 +320,7 @@ void a_Dicache_write(DilloUrl *url, int version, const uchar_t *buf, uint_t Y) DicEntry->State = DIC_Write; } -/* +/** * Implement the close method of the decoding process */ void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client) @@ -350,16 +350,15 @@ void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client) /* ------------------------------------------------------------------------- */ -/* +/** * Generic MIME handler for GIF, JPEG and PNG. * Sets a_Dicache_callback as the cache-client, * and also sets the image decoder. * - * Parameters: - * Type: MIME type - * Ptr: points to a Web structure - * Call: Dillo calls this with more data/eod - * Data: Decoding data structure + * @param Type MIME type + * @param Ptr points to a \ref DilloWeb structure + * @param Call Dillo calls this with more data/eod + * @param Data Decoding data structure */ static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr, CA_Callback_t *Call, void **Data) @@ -406,7 +405,7 @@ static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr, return (a_Image_get_dw (web->Image)); } -/* +/** * PNG wrapper for Dicache_image() */ void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, @@ -415,7 +414,7 @@ void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, return Dicache_image(DIC_Png, Type, Ptr, Call, Data); } -/* +/** * GIF wrapper for Dicache_image() */ void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, @@ -424,7 +423,7 @@ void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, return Dicache_image(DIC_Gif, Type, Ptr, Call, Data); } -/* +/** * JPEG wrapper for Dicache_image() */ void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, @@ -433,7 +432,7 @@ void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, return Dicache_image(DIC_Jpeg, Type, Ptr, Call, Data); } -/* +/** * This function is a cache client; (but feeds its clients from dicache) */ void a_Dicache_callback(int Op, CacheClient_t *Client) @@ -501,7 +500,7 @@ void a_Dicache_callback(int Op, CacheClient_t *Client) /* ------------------------------------------------------------------------- */ -/* +/** * Free the imgbuf (RGB data) of unused entries. */ void a_Dicache_cleanup(void) @@ -526,7 +525,7 @@ void a_Dicache_cleanup(void) /* ------------------------------------------------------------------------- */ -/* +/** * Deallocate memory used by dicache module * (Call this one at exit time, with no cache clients queued) */ diff --git a/src/dicache.h b/src/dicache.h index 7d5ef6ee..e0f49dfb 100644 --- a/src/dicache.h +++ b/src/dicache.h @@ -10,42 +10,42 @@ extern "C" { #include "image.hh" #include "cache.h" -/* Symbolic name to request the last version of an image */ +/** Symbolic name to request the last version of an image */ #define DIC_Last -1 -/* Flags: Last version, Valid entry */ +/** Flags: Last version, Valid entry */ #define DIF_Last 1 #define DIF_Valid 2 /* These will reflect the entry's "state" */ typedef enum { - DIC_Empty, /* Just created the entry */ - DIC_SetParms, /* Parameters set */ - DIC_SetCmap, /* Color map set */ - DIC_Write, /* Feeding the entry */ - DIC_Close, /* Whole image got! */ - DIC_Abort /* Image transfer aborted */ + DIC_Empty, /**< Just created the entry */ + DIC_SetParms, /**< Parameters set */ + DIC_SetCmap, /**< Color map set */ + DIC_Write, /**< Feeding the entry */ + DIC_Close, /**< Whole image got! */ + DIC_Abort /**< Image transfer aborted */ } DicEntryState; typedef struct DICacheEntry { - DilloUrl *url; /* Image URL for this entry */ - DilloImgType type; /* Image type */ - uint_t width, height; /* As taken from image data */ - short Flags; /* See Flags */ - short SurvCleanup; /* Cleanup-pass survival for unused images */ - uchar_t *cmap; /* Color map */ - void *v_imgbuf; /* Void pointer to an Imgbuf object */ - uint_t TotalSize; /* Amount of memory the image takes up */ - uint_t ScanNumber; /* Current decoding scan */ - bitvec_t *BitVec; /* Bit vector for decoded rows */ - DicEntryState State; /* Current status for this entry */ - int RefCount; /* Reference Counter */ - int version; /* Version number, used for different + DilloUrl *url; /**< Image URL for this entry */ + DilloImgType type; /**< Image type */ + uint_t width, height; /**< As taken from image data */ + short Flags; /**< See Flags */ + short SurvCleanup; /**< Cleanup-pass survival for unused images */ + uchar_t *cmap; /**< Color map */ + void *v_imgbuf; /**< Void pointer to an Imgbuf object */ + uint_t TotalSize; /**< Amount of memory the image takes up */ + uint_t ScanNumber; /**< Current decoding scan */ + bitvec_t *BitVec; /**< Bit vector for decoded rows */ + DicEntryState State; /**< Current status for this entry */ + int RefCount; /**< Reference Counter */ + int version; /**< Version number, used for different versions of the same URL image */ - uint_t DecodedSize; /* Size of already decoded data */ - CA_Callback_t Decoder; /* Client function */ - void *DecoderData; /* Client function data */ + uint_t DecodedSize; /**< Size of already decoded data */ + CA_Callback_t Decoder; /**< Client function */ + void *DecoderData; /**< Client function data */ } DICacheEntry; diff --git a/src/digest.c b/src/digest.c index d5461950..090b1aec 100644 --- a/src/digest.c +++ b/src/digest.c @@ -35,7 +35,7 @@ static Dstr *md5hexdigest(const Dstr *data) return result; } -/* +/** * Returns a pointer to a newly allocated string containing a cnonce */ char *a_Digest_create_cnonce(void) @@ -48,7 +48,7 @@ char *a_Digest_create_cnonce(void) return result; } -/* +/** * This portion only has to be calculated once. */ int a_Digest_compute_digest(AuthRealm_t *realm, const char *username, @@ -86,7 +86,7 @@ int a_Digest_compute_digest(AuthRealm_t *realm, const char *username, return 1; } -/* +/** * This portion is calculatd for each request. */ static Dstr *Digest_create_response(AuthRealm_t *realm, const char *method, @@ -158,7 +158,7 @@ static void Digest_Dstr_append_token_value(Dstr *str, int delimiter, } } -/* +/** * Construct Digest Authorization header. * * Field ordering: furaisanjin reports that his DVD recorder requires the diff --git a/src/dillo.cc b/src/dillo.cc index c7ae62c2..889b5256 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -17,6 +17,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** @file + * Dillo web browser. + */ + #include <stdio.h> #include <unistd.h> #include <stdlib.h> @@ -61,7 +65,7 @@ #include "dw/textblock.hh" #include "dw/table.hh" -/* +/** * Command line options structure */ typedef enum { @@ -108,7 +112,7 @@ static const CLI_options Options[] = { * SIGCHLD handling ---------------------------------------------------------- */ -/* +/** * Avoid our children (Dpid) to become zombies. :-) * Notes: * . We let sigaction block SIGCHLD while in the handler. @@ -140,7 +144,7 @@ static void raw_sigchld2(int signum) ++signum; /* compiler happiness */ } -/* +/** * Establish SIGCHLD handler */ static void est_sigchld(void) @@ -160,7 +164,7 @@ static void est_sigchld(void) //---------------------------------------------------------------------------- -/* +/** * Print help text generated from the options structure */ static void printHelp(const char *cmdname, const CLI_options *options) @@ -176,7 +180,7 @@ static void printHelp(const char *cmdname, const CLI_options *options) "\n"); } -/* +/** * Return the maximum number of option arguments */ static int numOptions(const CLI_options *options) @@ -189,7 +193,7 @@ static int numOptions(const CLI_options *options) return max; } -/* +/** * Get next command line option. */ static OptID getCmdOption(const CLI_options *options, int argc, char **argv, @@ -240,7 +244,7 @@ static OptID getCmdOption(const CLI_options *options, int argc, char **argv, return opt_id; } -/* +/** * Set FL_NORMAL_LABEL to interpret neither symbols (@) nor shortcuts (&), * and FL_FREE_LABELTYPE to interpret shortcuts. */ @@ -284,7 +288,7 @@ static void custMenuLabelMeasure(const Fl_Label* o, int& W, int& H) fl_measure(o->value, W, H, interpret_symbols); } -/* +/** * Tell the user if default/pref fonts can't be found. */ static void checkFont(const char *name, const char *type) @@ -302,7 +306,7 @@ static void checkPreferredFonts() checkFont(prefs.font_fantasy, "fantasy"); } -/* +/** * Set UI color. 'color' is an 0xrrggbb value, whereas 'default_val' is a fltk * color (index 0-0xFF, or 0xrrggbb00). */ @@ -345,7 +349,7 @@ static void setColors() Fl::get_color(FL_FOREGROUND_COLOR)); } -/* +/** * Given a command line argument, build a DilloUrl for it. */ static DilloUrl *makeStartUrl(char *str, bool local) @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/* @file * Non blocking pthread-handled Dns scheme */ @@ -57,26 +57,26 @@ typedef enum { } DnsServerState_t; typedef struct { - int channel; /* Index of this channel [0 based] */ + int channel; /**< Index of this channel [0 based] */ DnsServerState_t state; - Dlist *addr_list; /* IP address */ - char *hostname; /* Address to resolve */ - int status; /* errno code for resolving function */ + Dlist *addr_list; /**< IP address */ + char *hostname; /**< Address to resolve */ + int status; /**< errno code for resolving function */ #ifdef D_DNS_THREADED - pthread_t th1; /* Thread id */ + pthread_t th1; /**< Thread id */ #endif } DnsServer; typedef struct { - char *hostname; /* host name for cache */ - Dlist *addr_list; /* addresses of host */ + char *hostname; /**< host name for cache */ + Dlist *addr_list; /**< addresses of host */ } GDnsCache; typedef struct { - int channel; /* -2 if waiting, otherwise index to dns_server[] */ - char *hostname; /* The one we're resolving */ - DnsCallback_t cb_func; /* callback function */ - void *cb_data; /* extra data for the callback function */ + int channel; /**< -2 if waiting, otherwise index to dns_server[] */ + char *hostname; /**< The one we're resolving */ + DnsCallback_t cb_func; /**< callback function */ + void *cb_data; /**< extra data for the callback function */ } GDnsQueue; @@ -111,7 +111,7 @@ static void Dns_queue_add(int channel, const char *hostname, dns_queue_size++; } -/* +/** * Find hostname index in dns_queue * (if found, returns queue index; -1 if not) */ @@ -126,7 +126,7 @@ static int Dns_queue_find(const char *hostname) return -1; } -/* +/** * Given an index, remove an entry from the dns_queue */ static void Dns_queue_remove(int index) @@ -158,7 +158,7 @@ void Dns_queue_print() } */ -/* +/** * Add an IP/hostname pair to Dns-cache */ static void Dns_cache_add(char *hostname, Dlist *addr_list) @@ -171,7 +171,7 @@ static void Dns_cache_add(char *hostname, Dlist *addr_list) } -/* +/** * Initializer function */ void a_Dns_init(void) @@ -212,7 +212,7 @@ void a_Dns_init(void) } } -/* +/** * Allocate a host structure and add it to the list */ @@ -259,7 +259,7 @@ static void Dns_note_hosts(Dlist *list, struct addrinfo *res0) } } -/* +/** * Server function (runs on its own thread) */ static void *Dns_server(void *data) @@ -334,7 +334,7 @@ static void *Dns_server(void *data) } -/* +/** * Request function (spawn a server and let it handle the request) */ static void Dns_server_req(int channel, const char *hostname) @@ -364,7 +364,7 @@ static void Dns_server_req(int channel, const char *hostname) #endif } -/* +/** * Return the IP for the given hostname using a callback. * Side effect: a thread is spawned when hostname is not cached. */ @@ -406,7 +406,7 @@ void a_Dns_resolve(const char *hostname, DnsCallback_t cb_func, void *cb_data) } } -/* +/** * Give answer to all queued callbacks on this channel */ static void Dns_serve_channel(int channel) @@ -424,7 +424,7 @@ static void Dns_serve_channel(int channel) } } -/* +/** * Assign free channels to waiting clients (-2) */ static void Dns_assign_channels(void) @@ -454,7 +454,7 @@ static void Dns_assign_channels(void) } } -/* +/** * This function is called on the main thread and * reads the DNS results. */ @@ -481,8 +481,8 @@ static void Dns_timeout_client(int fd, void *data) } -/* - * Dns memory-deallocation +/** + * Dns memory-deallocation. * (Call this one at exit time) * The Dns_queue is deallocated at execution time (no need to do that here) * 'dns_cache' is the only one that grows dynamically @@ -503,7 +503,7 @@ void a_Dns_freeall(void) dFree(dns_cache); } -/* +/** * Writes a string representation of the given DilloHost * into dst. dst will be \0 terminated. * Please note that dst must be at least 40 bytes long for IPv6 diff --git a/src/domain.c b/src/domain.c index 8bff39de..a85bde2f 100644 --- a/src/domain.c +++ b/src/domain.c @@ -25,7 +25,7 @@ static int num_exceptions_max = 1; static bool_t default_deny = FALSE; -/* +/** * Parse domainrc. */ void a_Domain_parse(FILE *fp) @@ -87,7 +87,7 @@ void a_Domain_freeall(void) dFree(exceptions); } -/* +/** * Wildcard ('*') pattern always matches. * "example.org" pattern matches "example.org". * ".example.org" pattern matches "example.org" and "sub.example.org". @@ -110,7 +110,7 @@ static bool_t Domain_match(const char *host, const char *pattern) { return cmp ? FALSE : TRUE; } -/* +/** * Is the resource at 'source' permitted to request the resource at 'dest'? */ bool_t a_Domain_permit(const DilloUrl *source, const DilloUrl *dest) diff --git a/src/dpiapi.c b/src/dpiapi.c index 4cdde96e..34637d95 100644 --- a/src/dpiapi.c +++ b/src/dpiapi.c @@ -9,7 +9,9 @@ * (at your option) any later version. */ -/* Support for dpi/dpip from Dillo's side */ +/** @file + * Support for dpi/dpip from Dillo's side + */ #include "msg.h" #include "bw.h" @@ -27,7 +29,7 @@ static char *dialog_server = NULL; -/* +/** * Generic callback function for dpip dialogs. */ static void Dpiapi_dialog_answer_cb(BrowserWindow *bw, int answer) @@ -44,7 +46,7 @@ static void Dpiapi_dialog_answer_cb(BrowserWindow *bw, int answer) dFree(cmd); } -/* +/** * Process a dpip "dialog" command from any dpi. */ void a_Dpiapi_dialog(BrowserWindow *bw, char *server, char *dpip_tag) diff --git a/src/findbar.cc b/src/findbar.cc index d556a9c2..f0d23d01 100644 --- a/src/findbar.cc +++ b/src/findbar.cc @@ -72,7 +72,7 @@ int MyInput::handle(int e) return ret; } -/* +/** * Find next occurrence of input key */ void Findbar::search_cb(Fl_Widget *, void *vfb) @@ -86,7 +86,7 @@ void Findbar::search_cb(Fl_Widget *, void *vfb) key, case_sens, false); } -/* +/** * Find previous occurrence of input key */ void Findbar::searchBackwards_cb(Fl_Widget *, void *vfb) @@ -101,7 +101,7 @@ void Findbar::searchBackwards_cb(Fl_Widget *, void *vfb) } } -/* +/** * Hide the search bar */ void Findbar::hide_cb(Fl_Widget *, void *vfb) @@ -109,7 +109,7 @@ void Findbar::hide_cb(Fl_Widget *, void *vfb) a_UIcmd_findbar_toggle(a_UIcmd_get_bw_by_widget(vfb), 0); } -/* +/** * Construct text search bar */ Findbar::Findbar(int width, int height) : @@ -176,7 +176,7 @@ Findbar::~Findbar() delete hideImg; } -/* +/** * Handle events. Used to catch FL_Escape events. */ int Findbar::handle(int event) @@ -192,7 +192,7 @@ int Findbar::handle(int event) return Fl_Group::handle(event); } -/* +/** * Show the findbar and focus the input field */ void Findbar::show() diff --git a/src/findbar.hh b/src/findbar.hh index d91c42df..9bcdff84 100644 --- a/src/findbar.hh +++ b/src/findbar.hh @@ -10,7 +10,7 @@ #include "tipwin.hh" -/* +/** * Searchbar to find text in page. */ class Findbar : public Fl_Group { diff --git a/src/form.cc b/src/form.cc index 61dc01d2..aeaa35bd 100644 --- a/src/form.cc +++ b/src/form.cc @@ -268,7 +268,7 @@ void a_Html_form_display_hiddens2(void *vform, bool display) * Form parsing functions */ -/* +/** * Add an HTML control */ static void Html_add_input(DilloHtml *html, DilloHtmlInputType type, @@ -291,7 +291,7 @@ static void Html_add_input(DilloHtml *html, DilloHtmlInputType type, } } -/* +/** * Find radio input by name */ static DilloHtmlInput *Html_get_radio_input(DilloHtml *html, const char *name) @@ -314,7 +314,7 @@ static DilloHtmlInput *Html_get_radio_input(DilloHtml *html, const char *name) return NULL; } -/* +/** * Get the current input if available. */ static DilloHtmlInput *Html_get_current_input(DilloHtml *html) @@ -330,7 +330,7 @@ static DilloHtmlInput *Html_get_current_input(DilloHtml *html) inputs->get (inputs->size() - 1) : NULL; } -/* +/** * Handle <FORM> tag */ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize) @@ -405,7 +405,7 @@ void Html_tag_close_form(DilloHtml *html) html->InFlags &= ~IN_TEXTAREA; } -/* +/** * get size, restrict it to reasonable value */ static int Html_input_get_size(DilloHtml *html, const char *attrbuf) @@ -424,7 +424,7 @@ static int Html_input_get_size(DilloHtml *html, const char *attrbuf) return size; } -/* +/** * Add a new input to current form */ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) @@ -580,7 +580,7 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) dFree(value); } -/* +/** * The ISINDEX tag is just a deprecated form of <INPUT type=text> with * implied FORM, afaics. */ @@ -628,8 +628,8 @@ void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize) html->InFlags |= IN_TEXTAREA; } -/* - * The textarea tag +/** + * The textarea tag. */ void Html_tag_content_textarea(DilloHtml *html, const char *tag, int tagsize) { @@ -686,8 +686,8 @@ void Html_tag_content_textarea(DilloHtml *html, const char *tag, int tagsize) dFree(name); } -/* - * Close textarea +/** + * Close textarea. * (TEXTAREA is parsed in VERBATIM mode, and entities are handled here) */ void Html_tag_close_textarea(DilloHtml *html) @@ -966,7 +966,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize) dFree(type); } -/* +/** * Handle close <BUTTON> */ void Html_tag_close_button(DilloHtml *html) @@ -1065,7 +1065,7 @@ void DilloHtmlForm::submit(DilloHtmlInput *active_input, EventButton *event) } } -/* +/** * Build a new query URL. * (Called by submit()) */ @@ -1123,7 +1123,7 @@ DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input) return new_url; } -/* +/** * Construct the data for a query URL */ Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit) @@ -1245,7 +1245,7 @@ Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit) return DataStr; } -/* +/** * Generate a boundary string for use in separating the parts of a * multipart/form-data submission. */ @@ -1308,7 +1308,7 @@ char *DilloHtmlForm::makeMultipartBoundary(iconv_t char_encoder, return ret; } -/* +/** * Pass input text through character set encoder. * Return value: same input Dstr if no encoding is needed. * new Dstr when encoding (input Dstr is freed). @@ -1377,7 +1377,7 @@ Dstr *DilloHtmlForm::encodeText(iconv_t char_encoder, Dstr **input) return output; } -/* +/** * Urlencode 'str' and append it to 'dstr' */ void DilloHtmlForm::strUrlencodeAppend(Dstr *dstr, const char *str) @@ -1387,7 +1387,7 @@ void DilloHtmlForm::strUrlencodeAppend(Dstr *dstr, const char *str) dFree(encoded); } -/* +/** * Append a name-value pair to url data using url encoding. */ void DilloHtmlForm::inputUrlencodeAppend(Dstr *data, const char *name, @@ -1401,7 +1401,7 @@ void DilloHtmlForm::inputUrlencodeAppend(Dstr *data, const char *name, } } -/* +/** * Append files to URL data using multipart encoding. * Currently only accepts one file. */ @@ -1454,7 +1454,7 @@ void DilloHtmlForm::filesInputMultipartAppend(Dstr* data, } } -/* +/** * Append a name-value pair to url data using multipart encoding. */ void DilloHtmlForm::inputMultipartAppend(Dstr *data, @@ -1477,7 +1477,7 @@ void DilloHtmlForm::inputMultipartAppend(Dstr *data, } } -/* +/** * Append an image button click position to url data using url encoding. */ void DilloHtmlForm::imageInputUrlencodeAppend(Dstr *data, Dstr *name, Dstr *x, @@ -1492,7 +1492,7 @@ void DilloHtmlForm::imageInputUrlencodeAppend(Dstr *data, Dstr *name, Dstr *x, dStr_sprintfa(data, "x=%s&y=%s&", x->str, y->str); } -/* +/** * Append an image button click position to url data using multipart encoding. */ void DilloHtmlForm::imageInputMultipartAppend(Dstr *data, const char *boundary, @@ -1511,7 +1511,7 @@ void DilloHtmlForm::imageInputMultipartAppend(Dstr *data, const char *boundary, dStr_truncate(name, orig_len); } -/* +/** * Reset all inputs containing reset to their initial values. In * general, reset is the reset button for the form. */ @@ -1522,7 +1522,7 @@ void DilloHtmlForm::reset () inputs->get(i)->reset(); } -/* +/** * Show/hide "hidden" form controls */ void DilloHtmlForm::display_hiddens(bool display) @@ -1543,7 +1543,7 @@ void DilloHtmlForm::setEnabled(bool enabled) inputs->get(i)->setEnabled(enabled); } -/* +/** * Add a new input. */ void DilloHtmlForm::addInput(DilloHtmlInput *input, DilloHtmlInputType type) @@ -1561,7 +1561,7 @@ void DilloHtmlForm::addInput(DilloHtmlInput *input, DilloHtmlInputType type) } } -/* +/** * Return the input with a given resource. */ DilloHtmlInput *DilloHtmlForm::getInput (Resource *resource) @@ -1575,7 +1575,7 @@ DilloHtmlInput *DilloHtmlForm::getInput (Resource *resource) return NULL; } -/* +/** * Return a Radio input for the given name. */ DilloHtmlInput *DilloHtmlForm::getRadioInput (const char *name) @@ -1601,7 +1601,7 @@ void DilloHtmlReceiver::activate (Resource *resource) form->eventHandler(resource, NULL); } -/* +/** * Enter a form control, as in "onmouseover". * For _pressing_ enter in a text control, see activate(). */ @@ -1624,7 +1624,7 @@ void DilloHtmlReceiver::enter (Resource *resource) a_UIcmd_set_msg(html->bw, "%s", msg); } -/* +/** * Leave a form control, or "onmouseout". */ void DilloHtmlReceiver::leave (Resource *resource) @@ -1680,7 +1680,7 @@ DilloHtmlInput::~DilloHtmlInput () delete select; } -/* +/** * Connect to a receiver. */ void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver) @@ -1702,7 +1702,7 @@ void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver) } } -/* +/** * Activate a form */ void DilloHtmlInput::activate(DilloHtmlForm *form, int num_entry_fields, @@ -1734,7 +1734,7 @@ void DilloHtmlInput::activate(DilloHtmlForm *form, int num_entry_fields, } } -/* +/** * Read a file into cache */ void DilloHtmlInput::readFile (BrowserWindow *bw) @@ -1754,7 +1754,7 @@ void DilloHtmlInput::readFile (BrowserWindow *bw) } } -/* +/** * Get the values for a "successful control". */ void DilloHtmlInput::appendValuesTo(Dlist *values, bool is_active_submit) @@ -1830,7 +1830,7 @@ void DilloHtmlInput::appendValuesTo(Dlist *values, bool is_active_submit) } } -/* +/** * Reset to the initial value. */ void DilloHtmlInput::reset () @@ -1913,7 +1913,7 @@ void DilloHtmlSelect::addOpt (DilloHtmlOptbase *opt) opts->set (size, opt); } -/* +/** * Select the first option if nothing else is selected. */ void DilloHtmlSelect::ensureSelection() @@ -2007,7 +2007,7 @@ DilloHtmlOption::~DilloHtmlOption () * Utilities */ -/* +/** * Create input image for the form */ static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize) @@ -10,7 +10,7 @@ * (at your option) any later version. */ -/* +/** @file * The GIF decoder for dillo. It is responsible for decoding GIF data * and transferring it to the dicache. */ @@ -94,10 +94,10 @@ typedef struct { uint_t y; - /* state for lwz_read_byte */ + /** state for lwz_read_byte */ int code_size; - /* The original GifScreen from giftopnm */ + /** The original GifScreen from giftopnm */ uint_t Width; uint_t Height; size_t ColorMap_ofs; @@ -109,7 +109,7 @@ typedef struct { uint_t AspectRatio; /* AspectRatio (not used) */ #endif - /* Gif89 extensions */ + /** Gif89 extensions */ int transparent; #if 0 /* None are used: */ @@ -119,10 +119,10 @@ typedef struct { #endif /* state for the new push-oriented decoder */ - int packet_size; /* The amount of the data block left to process */ + int packet_size; /**< The amount of the data block left to process */ uint_t window; int bits_in_window; - uint_t last_code; /* Last "compressed" code in the look up table */ + uint_t last_code; /**< Last "compressed" code in the look up table */ uint_t line_index; uchar_t **spill_lines; int num_spill_lines_max; @@ -147,7 +147,7 @@ static size_t Gif_process_bytes(DilloGif *gif, const uchar_t *buf, int bufsize, void *Buf); -/* +/** * Create a new gif structure for decoding a gif into a RGB buffer */ void *a_Gif_new(DilloImage *Image, DilloUrl *url, int version) @@ -174,7 +174,7 @@ void *a_Gif_new(DilloImage *Image, DilloUrl *url, int version) return gif; } -/* +/** * Free the gif-decoding data structure. */ static void Gif_free(DilloGif *gif) @@ -192,7 +192,7 @@ static void Gif_free(DilloGif *gif) dFree(gif); } -/* +/** * This function is a cache client, it receives data from the cache * and dispatches it to the appropriate gif-processing functions */ @@ -209,7 +209,7 @@ void a_Gif_callback(int Op, void *data) } } -/* +/** * Receive and process new chunks of GIF image data */ static void Gif_write(DilloGif *gif, void *Buf, uint_t BufSize) @@ -236,7 +236,7 @@ static void Gif_write(DilloGif *gif, void *Buf, uint_t BufSize) _MSG("exit Gif_write, bufsize=%ld\n", (long)bufsize); } -/* +/** * Finish the decoding process (and free the memory) */ static void Gif_close(DilloGif *gif, CacheClient_t *Client) @@ -249,8 +249,8 @@ static void Gif_close(DilloGif *gif, CacheClient_t *Client) /* --- GIF Extensions ----------------------------------------------------- */ -/* - * This reads a sequence of GIF data blocks.. and ignores them! +/** + * This reads a sequence of GIF data blocks and ignores them. * Buf points to the first data block. * * Return Value @@ -273,13 +273,13 @@ static inline size_t Gif_data_blocks(const uchar_t *Buf, size_t BSize) return Size + 1; } -/* +/** * This is a GIF extension. We ignore it with this routine. * Buffer points to just after the extension label. * - * Return Value - * 0 -- block not processed - * otherwise the size of the extension label. + * @return + * - 0 -- block not processed + * - otherwise the size of the extension label. */ static inline size_t Gif_do_generic_ext(const uchar_t *Buf, size_t BSize) { @@ -384,7 +384,7 @@ static void Gif_lwz_init(DilloGif *gif) gif->line_index = 0; } -/* +/** * Send the image line to the dicache, also handling the interlacing. */ static void Gif_emit_line(DilloGif *gif, const uchar_t *linebuf) @@ -427,7 +427,7 @@ static void Gif_emit_line(DilloGif *gif, const uchar_t *linebuf) } } -/* +/** * Decode the packetized lwz bytes */ static void Gif_literal(DilloGif *gif, uint_t code) @@ -558,10 +558,10 @@ static void Gif_sequence(DilloGif *gif, uint_t code) gif->spill_line_index = spill_line_index; } -/* - * ? +/** + * * - * Return Value: + * @return * 2 -- quit * 1 -- new last code needs to be done * 0 -- okay, but reset the code table diff --git a/src/history.c b/src/history.c index 15ab19db..de77b5c9 100644 --- a/src/history.c +++ b/src/history.c @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/** @file * Linear history (it also provides indexes for the navigation stack) */ @@ -30,7 +30,7 @@ static int history_size = 0; /* [1 based] */ static int history_size_max = 16; -/* +/** * Debug procedure. */ void History_show() @@ -43,7 +43,7 @@ void History_show() MSG(" }\n"); } -/* +/** * Add a new H_Item at the end of the history list * (taking care of not making a duplicate entry) */ @@ -74,7 +74,7 @@ int a_History_add_url(DilloUrl *url) return idx; } -/* +/** * Return the DilloUrl field (by index) */ const DilloUrl *a_History_get_url(int idx) @@ -87,7 +87,7 @@ const DilloUrl *a_History_get_url(int idx) return history[idx].url; } -/* +/** * Return the title field (by index) * ('force' returns URL_STR when there's no title) */ @@ -103,7 +103,7 @@ const char *a_History_get_title(int idx, int force) return NULL; } -/* +/** * Return the title field (by url) * ('force' returns URL_STR when there's no title) */ @@ -124,7 +124,7 @@ const char *a_History_get_title_by_url(const DilloUrl *url, int force) return NULL; } -/* +/** * Set the page-title for a given URL */ void a_History_set_title_by_url(const DilloUrl *url, const char *title) @@ -146,7 +146,7 @@ void a_History_set_title_by_url(const DilloUrl *url, const char *title) } -/* +/** * Free all the memory used by this module */ void a_History_freeall() @@ -12,6 +12,10 @@ * */ +/** @file + * HTTP Strict Transport Security + */ + /* To preload hosts, as of 2015, chromium is the list keeper: * https://src.chromium.org/viewvc/chrome/trunk/src/net/http/transport_security_state_static.json * although mozilla's is easier to work from (and they trim it based on @@ -62,7 +66,7 @@ void a_Hsts_freeall() } } -/* +/** * Compare function for searching a domain node by domain string */ static int Domain_node_domain_str_cmp(const void *v1, const void *v2) @@ -87,7 +91,7 @@ static void Hsts_remove_policy(HstsData_t *policy) } } -/* +/** * Return the time_t for a future time. */ static time_t Hsts_future_time(long seconds_from_now) @@ -107,7 +111,7 @@ static time_t Hsts_future_time(long seconds_from_now) return ret; } -/* +/** * Compare function for searching domains. */ static int Domain_node_cmp(const void *v1, const void *v2) @@ -134,7 +138,7 @@ static void Hsts_set_policy(const char *host, long max_age, bool_t subdomains) policy->expires_at = exp; } -/* +/** * Read the next attribute. */ static char *Hsts_parse_attr(const char **header_str) @@ -155,7 +159,7 @@ static char *Hsts_parse_attr(const char **header_str) return dStrndup(str, len); } -/* +/** * Get the value in *header_str. */ static char *Hsts_parse_value(const char **header_str) @@ -182,7 +186,7 @@ static char *Hsts_parse_value(const char **header_str) return dStrndup(str, len); } -/* +/** * Advance past any value. */ static void Hsts_eat_value(const char **str) @@ -191,7 +195,7 @@ static void Hsts_eat_value(const char **str) *str += strcspn(*str, ";"); } -/* +/** * The reponse for this url had an HSTS header, so let's take action. */ void a_Hsts_set(const char *header, const DilloUrl *url) diff --git a/src/html.cc b/src/html.cc index 2d29c41d..d8debb4a 100644 --- a/src/html.cc +++ b/src/html.cc @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/** @file * Dillo HTML parsing routines */ @@ -109,7 +109,7 @@ int a_Html_tag_index(const char *tag); /*----------------------------------------------------------------------------- * Local Data *---------------------------------------------------------------------------*/ -/* Parsing table structure */ +/** Parsing table structure */ typedef struct { const char *name; /* element name */ unsigned char Flags; /* flags (explained near the table data) */ @@ -145,7 +145,7 @@ static int *----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ -/* +/** * Collect HTML error strings. */ void DilloHtml::bugMessage(const char *format, ... ) @@ -163,7 +163,7 @@ void DilloHtml::bugMessage(const char *format, ... ) a_UIcmd_set_bug_prog(bw, ++bw->num_page_bugs); } -/* +/** * Wrapper for a_Url_new that adds an error detection message. * If use_base_url is TRUE, it uses base_url. Otherwise it uses html->base_url. */ @@ -194,7 +194,7 @@ DilloUrl *a_Html_url_new(DilloHtml *html, return url; } -/* +/** * Set callback function and callback data for the "html/text" MIME type. */ void *a_Html_text(const char *Type, void *P, CA_Callback_t *Call, void **Data) @@ -213,7 +213,7 @@ static void Html_free(void *data) delete ((DilloHtml*)data); } -/* +/** * Used by the "Load images" page menuitem. */ void a_Html_load_images(void *v_html, DilloUrl *pattern) @@ -223,7 +223,7 @@ void a_Html_load_images(void *v_html, DilloUrl *pattern) html->loadImages(pattern); } -/* +/** * Search for form */ static bool Html_contains_form(DilloHtml *html, void *v_form) @@ -236,7 +236,7 @@ static bool Html_contains_form(DilloHtml *html, void *v_form) return false; } -/* +/** * Used by the "Submit form" form menuitem. */ void a_Html_form_submit(void *v_html, void *v_form) @@ -249,7 +249,7 @@ void a_Html_form_submit(void *v_html, void *v_form) } } -/* +/** * Used by the "Reset form" form menuitem. */ void a_Html_form_reset(void *v_html, void *v_form) @@ -262,7 +262,7 @@ void a_Html_form_reset(void *v_html, void *v_form) } } -/* +/** * Used by the "Show/Hide hiddens" form menuitem. */ void a_Html_form_display_hiddens(void *v_html, void *v_form, bool_t display) @@ -275,7 +275,7 @@ void a_Html_form_display_hiddens(void *v_html, void *v_form, bool_t display) } } -/* +/** * Set the URL data for image maps. */ static void Html_set_link_coordinates(DilloHtml *html, int link, int x, int y) @@ -288,7 +288,7 @@ static void Html_set_link_coordinates(DilloHtml *html, int link, int x, int y) } } -/* +/** * Create a new link, set it as the url's parent * and return the index. */ @@ -300,7 +300,7 @@ static int Html_set_new_link(DilloHtml *html, DilloUrl **url) return nl; } -/* +/** * Evaluates the ALIGN attribute (left|center|right|justify) and * sets the style at the top of the stack. */ @@ -345,7 +345,7 @@ void a_Html_tag_set_align_attr(DilloHtml *html, const char *tag, int tagsize) } } -/* +/** * Evaluates the VALIGN attribute (top|bottom|middle|baseline) and * sets the style in style_attrs. Returns true when set. */ @@ -375,7 +375,7 @@ bool a_Html_tag_set_valign_attr(DilloHtml *html, const char *tag, int tagsize) } -/* +/** * Create and add a new Textblock to the current Textblock. Typically * only one of addBreaks and addBreakOpt is true. */ @@ -415,7 +415,7 @@ static bool Html_must_add_breaks(DilloHtml *html) return HT2TB(html)->mustAddBreaks (html->style ()); } -/* +/** * Create and initialize a new DilloHtml class */ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, @@ -505,7 +505,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, dw->setDeleteCallback(Html_free, this); } -/* +/** * Miscellaneous initializations for Dw */ void DilloHtml::initDw() @@ -519,7 +519,7 @@ void DilloHtml::initDw() dStr_truncate(bw->page_bugs, 0); } -/* +/** * Free memory used by the DilloHtml class. */ DilloHtml::~DilloHtml() @@ -560,7 +560,7 @@ DilloHtml::~DilloHtml() delete styleEngine; } -/* +/** * Process the newly arrived html and put it into the page structure. * (This function is called by Html_callback whenever there's new data) */ @@ -587,7 +587,7 @@ void DilloHtml::write(char *Buf, int BufSize, int Eof) Start_Ofs += token_start; } -/* +/** * Return the line number of the tag/word being processed by the parser. * Also update the offsets. */ @@ -610,7 +610,7 @@ int DilloHtml::getCurrLineNumber() return line; } -/* +/** * Free parsing data. */ void DilloHtml::freeParseData() @@ -623,7 +623,7 @@ void DilloHtml::freeParseData() dFree(charset); } -/* +/** * Finish parsing a HTML page. Close the parser and close the client. * The class is not deleted here, it remains until the widget is destroyed. */ @@ -650,7 +650,7 @@ void DilloHtml::finishParsing(int ClientKey) a_Bw_close_client(bw, ClientKey); } -/* +/** * Allocate and insert form information. */ int DilloHtml::formNew(DilloHtmlMethod method, const DilloUrl *action, @@ -667,7 +667,7 @@ int DilloHtml::formNew(DilloHtmlMethod method, const DilloUrl *action, return forms->size(); } -/* +/** * Get the current form. */ DilloHtmlForm *DilloHtml::getCurrentForm () @@ -685,7 +685,7 @@ bool_t DilloHtml::unloadedImages() return FALSE; } -/* +/** * Load images if they were disabled. */ void DilloHtml::loadImages (const DilloUrl *pattern) @@ -716,7 +716,7 @@ void DilloHtml::loadImages (const DilloUrl *pattern) } } -/* +/** * Save URL in a vector (may be loaded later). */ void DilloHtml::addCssUrl(const DilloUrl *url) @@ -743,7 +743,7 @@ bool DilloHtml::HtmlLinkReceiver::enter (Widget *widget, int link, int img, return true; } -/* +/** * Handle the "press" signal. */ bool DilloHtml::HtmlLinkReceiver::press (Widget *widget, int link, int img, @@ -777,7 +777,7 @@ bool DilloHtml::HtmlLinkReceiver::press (Widget *widget, int link, int img, return ret; } -/* +/** * Handle the "click" signal. */ bool DilloHtml::HtmlLinkReceiver::click (Widget *widget, int link, int img, @@ -826,7 +826,7 @@ bool DilloHtml::HtmlLinkReceiver::click (Widget *widget, int link, int img, return true; } -/* +/** * Initialize the stash buffer */ void a_Html_stash_init(DilloHtml *html) @@ -836,7 +836,7 @@ void a_Html_stash_init(DilloHtml *html) dStr_truncate(html->Stash, 0); } -/* +/** * This is M$ non-standard "smart quotes" (w1252). Now even deprecated by them! * * SGML for HTML4.01 defines c >= 128 and c <= 159 as UNUSED. @@ -858,7 +858,7 @@ static int Html_ms_stupid_quotes_2ucs(int codepoint) return ret; } -/* +/** * Parse a numeric character reference (e.g., "/" or "/"). * The "&#" has already been consumed. */ @@ -941,7 +941,7 @@ static const char *Html_parse_numeric_charref(DilloHtml *html, char *tok, } } -/* +/** * Comparison function for binary search */ static int Html_charref_comp(const void *a, const void *b) @@ -949,7 +949,7 @@ static int Html_charref_comp(const void *a, const void *b) return strcmp(((Charref_t *)a)->ref, ((Charref_t *)b)->ref); } -/* +/** * Binary search of 'key' in charref list */ static Charref_t *Html_charref_search(char *key) @@ -961,7 +961,7 @@ static Charref_t *Html_charref_search(char *key) sizeof(Charref_t), Html_charref_comp); } -/* +/** * Parse a named character reference (e.g., "&" or "…"). * The "&" has already been consumed. */ @@ -1013,7 +1013,7 @@ static const char *Html_parse_named_charref(DilloHtml *html, char *tok, return ret; } -/* +/** * Given an entity, return the corresponding string. * Returns NULL if not a valid entity. * @@ -1052,7 +1052,7 @@ static const char *Html_parse_entity(DilloHtml *html, const char *token, return ret; } -/* +/** * Parse all the entities in a token. Takes the token and its length, and * returns a newly allocated string. */ @@ -1090,7 +1090,7 @@ char *a_Html_parse_entities(DilloHtml *html, const char *token, int toksize) return str; } -/* +/** * For white-space: pre-line, we must break the line if encountering a newline. * Otherwise, collapse whitespace as usual. */ @@ -1113,7 +1113,7 @@ static void Html_process_space_pre_line(DilloHtml *html, const char *space, } } -/* +/** * Parse spaces */ static void Html_process_space(DilloHtml *html, const char *space, @@ -1194,10 +1194,10 @@ static void Html_process_space(DilloHtml *html, const char *space, } } -/* +/** * Handles putting the word into its proper place - * > STASH and VERBATIM --> html->Stash - * > otherwise it goes through addText() + * - STASH and VERBATIM --> html->Stash + * - otherwise it goes through addText() * * Entities are parsed (or not) according to parse_mode. * 'word' is a '\0'-terminated string. @@ -1300,7 +1300,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) } } -/* +/** * Does the tag in tagstr (e.g. "p") match the tag in the tag, tagsize * structure, with the initial < skipped over (e.g. "P align=center>")? */ @@ -1318,7 +1318,7 @@ static bool Html_match_tag(const char *tagstr, char *tag, int tagsize) return false; } -/* +/** * This function is called after popping the stack, to * handle nested Textblock widgets. */ @@ -1332,7 +1332,7 @@ static void Html_eventually_pop_dw(DilloHtml *html, bool hand_over_break) } } -/* +/** * Push the tag (copying attributes from the top of the stack) */ static void Html_push_tag(DilloHtml *html, int tag_idx) @@ -1348,8 +1348,8 @@ static void Html_push_tag(DilloHtml *html, int tag_idx) html->dw = S_TOP(html)->textblock; } -/* - * Push the tag (used to force en element with optional open into the stack) +/** + * Push the tag (used to force en element with optional open into the stack). * Note: now it's the same as Html_push_tag(), but things may change... */ static void Html_force_push_tag(DilloHtml *html, int tag_idx) @@ -1358,7 +1358,7 @@ static void Html_force_push_tag(DilloHtml *html, int tag_idx) Html_push_tag(html, tag_idx); } -/* +/** * Pop the top tag in the stack */ static void Html_real_pop_tag(DilloHtml *html) @@ -1415,7 +1415,7 @@ static CssLength Html_parse_length_or_multi_length (const char *attr, } -/* +/** * Returns a length or a percentage, or UNDEF_LENGTH in case * of an error, or if attr is NULL. */ @@ -1440,7 +1440,7 @@ CssLength a_Html_parse_length (DilloHtml *html, const char *attr) return l; } -/* +/** * Parse a color attribute. * Return value: parsed color, or default_color (+ error msg) on error. */ @@ -1456,8 +1456,8 @@ int32_t a_Html_color_parse(DilloHtml *html, const char *str, return color; } -/* - * Check that 'val' is composed of characters inside [A-Za-z0-9:_.-] +/** + * Check that 'val' is composed of characters inside [A-Za-z0-9:_.-]. * Note: ID can't have entities, but this check is enough (no '&'). * Return value: 1 if OK, 0 otherwise. */ @@ -1487,7 +1487,7 @@ static int } } -/* +/** * Handle DOCTYPE declaration * * Follows the convention that HTML 4.01 @@ -1589,7 +1589,7 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize) dFree(ntag); } -/* +/** * Handle open HTML element */ static void Html_tag_open_html(DilloHtml *html, const char *tag, int tagsize) @@ -1608,8 +1608,8 @@ static void Html_tag_open_html(DilloHtml *html, const char *tag, int tagsize) } } -/* - * Handle close HTML element +/** + * Handle close HTML element. */ static void Html_tag_close_html(DilloHtml *html) { @@ -1620,8 +1620,8 @@ static void Html_tag_close_html(DilloHtml *html) * Also, we defer clearing the IN_HTML flag until IN_EOF */ } -/* - * Handle open HEAD element +/** + * Handle open HEAD element. */ static void Html_tag_open_head(DilloHtml *html, const char *tag, int tagsize) { @@ -1644,8 +1644,8 @@ static void Html_tag_open_head(DilloHtml *html, const char *tag, int tagsize) } } -/* - * Handle close HEAD element +/** + * Handle close HEAD element. * Note: HEAD is parsed once completely got. */ static void Html_tag_close_head(DilloHtml *html) @@ -1670,8 +1670,8 @@ static void Html_tag_close_head(DilloHtml *html) } } -/* - * Handle open TITLE +/** + * Handle open TITLE. * calls stash init, where the title string will be stored */ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize) @@ -1690,8 +1690,8 @@ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize) } } -/* - * Handle close TITLE +/** + * Handle close TITLE. * set page-title in the browser window and in the history. */ static void Html_tag_close_title(DilloHtml *html) @@ -1703,8 +1703,8 @@ static void Html_tag_close_title(DilloHtml *html) } } -/* - * Handle open SCRIPT +/** + * Handle open SCRIPT. * initializes stash, where the embedded code will be stored. * MODE_VERBATIM is used because MODE_STASH catches entities. */ @@ -1714,7 +1714,7 @@ static void Html_tag_open_script(DilloHtml *html, const char *tag, int tagsize) S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_VERBATIM; } -/* +/** * Handle close SCRIPT */ static void Html_tag_close_script(DilloHtml *html) @@ -1722,8 +1722,8 @@ static void Html_tag_close_script(DilloHtml *html) /* eventually the stash will be sent to an interpreter for parsing */ } -/* - * Handle open STYLE +/** + * Handle open STYLE. * Store contents in the stash where the style sheet interpreter can get it. */ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) @@ -1752,8 +1752,8 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_VERBATIM; } -/* - * Handle close STYLE +/** + * Handle close STYLE. */ static void Html_tag_close_style(DilloHtml *html) { @@ -2042,7 +2042,7 @@ static void Html_tag_open_abbr(DilloHtml *html, const char *tag, int tagsize) } } -/* +/** * Read image-associated tag attributes and create new image. */ void a_Html_common_image_attrs(DilloHtml *html, const char *tag, int tagsize) @@ -2164,7 +2164,7 @@ DilloImage *a_Html_image_new(DilloHtml *html, const char *tag, int tagsize) return image; } -/* +/** * Tell cache to retrieve image */ static bool Html_load_image(BrowserWindow *bw, DilloUrl *url, @@ -2243,8 +2243,8 @@ static void Html_tag_open_img(DilloHtml *html, const char *tag, int tagsize) } -/* - * Create a new Image struct and request the image-url to the cache +/** + * Create a new Image struct and request the image-url to the cache. * (If it either hits or misses, is not relevant here; that's up to the * cache functions) */ @@ -2316,8 +2316,8 @@ static void Html_tag_content_map(DilloHtml *html, const char *tag, int tagsize) } } -/* - * Handle close <MAP> +/** + * Handle close <MAP>. */ static void Html_tag_close_map(DilloHtml *html) { @@ -2341,7 +2341,7 @@ static void Html_tag_close_map(DilloHtml *html) html->InFlags &= ~IN_MAP; } -/* +/** * Read coords in a string, returning a vector of ints. */ static @@ -2590,8 +2590,8 @@ static void Html_tag_content_source(DilloHtml *html, const char *tag, HT2TB(html)->addText("[MEDIA SOURCE]", html->wordStyle ()); } -/* - * Media (AUDIO/VIDEO) close function +/** + * Media (AUDIO/VIDEO) close function. */ static void Html_tag_close_media(DilloHtml *html) { @@ -2628,7 +2628,7 @@ static void Html_tag_content_embed(DilloHtml *html,const char *tag,int tagsize) HT2TB(html)->addText("[EMBED]", html->wordStyle ()); } -/* +/** * Test and extract the link from a javascript instruction. */ static const char* Html_get_javascript_link(DilloHtml *html) @@ -2651,7 +2651,7 @@ static const char* Html_get_javascript_link(DilloHtml *html) return Buf->str; } -/* +/** * Register an anchor for this page. */ static void Html_add_anchor(DilloHtml *html, const char *name) @@ -2920,7 +2920,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize) } /* - * Close <LI> + * Close <LI>. */ static void Html_tag_close_li(DilloHtml *html) { @@ -3046,8 +3046,8 @@ static void Html_tag_close_pre(DilloHtml *html) html->InFlags &= ~IN_PRE; } -/* - * Check whether a tag is in the "excluding" element set for PRE +/** + * Check whether a tag is in the "excluding" element set for PRE. * Excl. Set = {IMG, OBJECT, APPLET, BIG, SMALL, SUB, SUP, FONT, BASEFONT} */ static int Html_tag_pre_excludes(DilloHtml *html, int tag_idx) @@ -3070,7 +3070,7 @@ static int Html_tag_pre_excludes(DilloHtml *html, int tag_idx) return 0; } -/* +/** * Update the document's content type information based on meta tag data. */ static void Html_update_content_type(DilloHtml *html, const char *content) @@ -3086,8 +3086,8 @@ static void Html_update_content_type(DilloHtml *html, const char *content) } } -/* - * Handle <META> +/** + * Handle META * We do not support http-equiv=refresh with delay>0 because it's * non standard, (the HTML 4.01 SPEC recommends explicitly to avoid it). * More info at: @@ -3200,7 +3200,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize) } } -/* +/** * Called by the network engine when a stylesheet has new data. */ static void Html_css_load_callback(int Op, CacheClient_t *Client) @@ -3214,7 +3214,7 @@ static void Html_css_load_callback(int Op, CacheClient_t *Client) } } -/* +/** * Tell cache to retrieve a stylesheet */ void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url) @@ -3261,7 +3261,7 @@ void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url) _MSG("\n"); } -/* +/** * Parse the LINK element (Only CSS stylesheets by now). * (If it either hits or misses, is not relevant here; that's up to the * cache functions) @@ -3316,7 +3316,7 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize) a_Url_free(url); } -/* +/** * Set the Document Base URI */ static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize) @@ -3395,7 +3395,7 @@ static void Html_tag_open_div(DilloHtml *html, const char *tag, int tagsize) Html_tag_open_sectioning(html, tag, tagsize); } -/* +/** * Default close for paragraph tags - pop the stack and break. */ static void Html_tag_close_par(DilloHtml *html) @@ -3412,17 +3412,18 @@ static void Html_tag_content_wbr(DilloHtml *html, const char *tag, int tagsize) } -/* - * Function index for the open, content, and close functions for each tag +/** + * Function index for the open, content, and close functions for each tag. * (Alphabetically sorted for a binary search). * The open and close functions are always called. They are used for style * handling and HTML bug reporting. * Content creation (e.g. adding new widgets or text) is done in the content * function, which is not called in the display:none case. - * Note: many tags don't need a content function (e.g. <div>, <span>, ...). + * Note: many tags don't need a content function (e.g. `<div>`, `<span>`, ...). * * Explanation for the 'Flags' field: * + * @verbatim * {"address", B8(01110), ...} * ||||| * ||||`-- inline/block element (1/0 resp.) @@ -3430,6 +3431,7 @@ static void Html_tag_content_wbr(DilloHtml *html, const char *tag, int tagsize) * ||`---- block container * |`----- body element * `------ head element + * @endverbatim * * Notes: * - The upper two bits are not used yet. @@ -3568,8 +3570,8 @@ static int Html_tag_compare(const char *p1, const char *p2) return !strchr(" >/\n\r\t", *p1); } -/* - * Get 'tag' index +/** + * Get 'tag' index. * return -1 if tag is not handled yet */ int a_Html_tag_index(const char *tag) @@ -3591,7 +3593,7 @@ int a_Html_tag_index(const char *tag) return -1; } -/* +/** * For elements with optional close, check whether is time to close, * by also following Firefox's de facto rules. * Called at open time. @@ -3631,7 +3633,7 @@ static int Html_triggers_optional_close(int old_idx, int cur_idx) return 0; } -/* +/** * Check nesting and cross-nesting between BUTTON, SELECT, TEXTAREA and A. * The cleanup process will close any of them before opening another. * This is not an HTML SPEC restriction , but it avoids lots of trouble @@ -3649,7 +3651,7 @@ static inline int Html_forbids_cross_nesting(const int InFlags, return oi; } -/* +/** * Cleanup the stack to a given index. * * 's_idx' stack index to clean up to. @@ -3700,7 +3702,7 @@ static void Html_tag_cleanup_to_idx(DilloHtml *html, int s_idx, } } -/* +/** * Conditional cleanup of the stack (at open time). Handles: * - Forbidden cross nesting (a BUG). * - Block elements inside non block containers (a BUG). @@ -3747,17 +3749,17 @@ static void Html_stack_cleanup_at_open(DilloHtml *html, int ni) Html_tag_cleanup_to_idx(html, s_idx + 1, ni, fi, 'o'); } -/* +/** * Conditional cleanup of the stack, called before closing any tag. * * There are several ways of doing it. Considering the HTML 4.01 spec * which defines optional close tags, and the will to deliver useful diagnose * messages for bad-formed HTML, it'll go as follows: * - * 1.- Search the stack for a matching tag by closing elements that: - * have optional close | are inline in a block container | force closing. - * 2.- If it exists, clean all the tags in between. - * 3.- Cleanup the matching tag. (on error, give a warning message) + * 1. Search the stack for a matching tag by closing elements that: + * have optional close | are inline in a block container | force closing. + * 2. If it exists, clean all the tags in between. + * 3. Cleanup the matching tag. (on error, give a warning message) */ static void Html_tag_cleanup_at_close(DilloHtml *html, int new_idx) { @@ -3802,7 +3804,7 @@ static void Html_tag_cleanup_at_close(DilloHtml *html, int new_idx) } } -/* +/** * HTML, HEAD and BODY elements have optional open and close tags. * Handle this "magic" here. */ @@ -3857,7 +3859,7 @@ static void Html_test_section(DilloHtml *html, int new_idx, int IsCloseTag) } } -/* +/** * Parse attributes that can appear on any tag. */ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) @@ -3910,7 +3912,7 @@ static void Html_parse_common_attrs(DilloHtml *html, char *tag, int tagsize) html->styleEngine->setNonCssHint(PROPERTY_X_LANG, CSS_TYPE_STRING, lang); } -/* +/** * Warn when encountering elements that are obsolete in HTML5. This list * was from the "W3C Candidate Recommendation 6 August 2013". */ @@ -3981,7 +3983,7 @@ static void Html_display_listitem(DilloHtml *html) } } -/* +/** * Process a tag, given as 'tag' and 'tagsize'. -- tagsize is [1 based] * ('tag' must include the enclosing angle brackets) * This function calls the right open or close function for the tag. @@ -4115,7 +4117,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) } } -/* +/** * Get attribute value for 'attrname' and return it. * Tags start with '<' and end with a '>' (Ex: "<P align=center>") * tagsize = strlen(tag) from '<' to '>', inclusive. @@ -4225,7 +4227,7 @@ static const char *Html_get_attr2(DilloHtml *html, return (Found) ? Buf->str : NULL; } -/* +/** * Call Html_get_attr2 telling it to parse entities and strip the result */ const char *a_Html_get_attr(DilloHtml *html, @@ -4237,7 +4239,7 @@ const char *a_Html_get_attr(DilloHtml *html, HTML_LeftTrim | HTML_RightTrim | HTML_ParseEntities); } -/* +/** * "a_Html_get_attr with default" * Call a_Html_get_attr() and dStrdup() the returned string. * If the attribute isn't found a copy of 'def' is returned. @@ -4253,13 +4255,13 @@ char *a_Html_get_attr_wdef(DilloHtml *html, return attrbuf ? dStrdup(attrbuf) : dStrdup(def); } -/* - * Dispatch the apropriate function for 'Op' +/** + * Dispatch the apropriate function for 'Op'. * This function is a Cache client and gets called whenever new data arrives - * Op : operation to perform. - * CbData : a pointer to a DilloHtml structure - * Buf : a pointer to new data - * BufSize : new data size (in bytes) + * @param Op operation to perform. + * @param CbData a pointer to a DilloHtml structure + * @param Buf a pointer to new data + * @param BufSize new data size (in bytes) */ static void Html_callback(int Op, CacheClient_t *Client) { @@ -4273,7 +4275,7 @@ static void Html_callback(int Op, CacheClient_t *Client) } } -/* +/** * Here's where we parse the html and put it into the Textblock structure. * Return value: number of bytes parsed */ diff --git a/src/html_common.hh b/src/html_common.hh index 6f086f5f..cf99d8e6 100644 --- a/src/html_common.hh +++ b/src/html_common.hh @@ -19,16 +19,16 @@ * Macros */ -// "html struct" to Textblock +/** "html struct" to Textblock */ #define HT2TB(html) ((Textblock*)(html->dw)) -// "html struct" to "Layout" +/** "html struct" to "Layout" */ #define HT2LT(html) ((Layout*)html->bw->render_layout) -// "Image" to "Dw Widget" +/** "Image" to "Dw Widget" */ #define IM2DW(Image) ((Widget*)Image->dw) -// Top of the parsing stack +/** Top of the parsing stack */ #define S_TOP(html) (html->stack->getRef(html->stack->size()-1)) -// Add a bug-meter message. +/** Add a bug-meter message. */ #define BUG_MSG(...) \ D_STMT_START { \ html->bugMessage(__VA_ARGS__); \ @@ -56,10 +56,10 @@ typedef enum { } DilloHtmlParseMode; typedef enum { - DILLO_HTML_TABLE_MODE_NONE, /* no table at all */ - DILLO_HTML_TABLE_MODE_TOP, /* outside of <tr> */ - DILLO_HTML_TABLE_MODE_TR, /* inside of <tr>, outside of <td> */ - DILLO_HTML_TABLE_MODE_TD /* inside of <td> */ + DILLO_HTML_TABLE_MODE_NONE, /**< no table at all */ + DILLO_HTML_TABLE_MODE_TOP, /**< outside of <tr> */ + DILLO_HTML_TABLE_MODE_TR, /**< inside of <tr>, outside of <td> */ + DILLO_HTML_TABLE_MODE_TD /**< inside of <td> */ } DilloHtmlTableMode; typedef enum { @@ -111,15 +111,15 @@ typedef struct { DilloHtmlListMode list_type; int list_number; - /* TagInfo index for the tag that's being processed */ + /** TagInfo index for the tag that's being processed */ int tag_idx; dw::core::Widget *textblock, *table; - /* This is used to align list items (especially in enumerated lists) */ + /** This is used to align list items (especially in enumerated lists) */ dw::core::Widget *ref_list_item; - /* This is used for list items etc; if it is set to TRUE, breaks + /** This is used for list items etc. If it is set to TRUE, breaks have to be "handed over" (see Html_add_indented and Html_eventually_pop_dw). */ bool hand_over_break; @@ -168,31 +168,31 @@ public: //BUG: for now everything is public lout::misc::SimpleVector<DilloHtmlState> *stack; StyleEngine *styleEngine; - int InFlags; /* tracks which elements we are in */ + int InFlags; /**< tracks which elements we are in */ Dstr *Stash; bool StashSpace; - int pre_column; /* current column, used in PRE tags with tabs */ - bool PreFirstChar; /* used to skip the first CR or CRLF in PRE tags */ - bool PrevWasCR; /* Flag to help parsing of "\r\n" in PRE tags */ - bool PrevWasOpenTag; /* Flag to help deferred parsing of white space */ - bool InVisitedLink; /* used to 'contrast_visited_colors' */ - bool ReqTagClose; /* Flag to close the stack's top tag */ - bool TagSoup; /* Flag to enable the parser's cleanup functions */ - bool loadCssFromStash; /* current stash content should be loaded as CSS */ - bool PrevWasBodyClose; /* set when </body> is found */ - bool PrevWasHtmlClose; /* set when </html> is found */ - - /* element counters: used for validation purposes. + int pre_column; /**< current column, used in PRE tags with tabs */ + bool PreFirstChar; /**< used to skip the first CR or CRLF in PRE tags */ + bool PrevWasCR; /**< Flag to help parsing of "\r\n" in PRE tags */ + bool PrevWasOpenTag; /**< Flag to help deferred parsing of white space */ + bool InVisitedLink; /**< used to 'contrast_visited_colors' */ + bool ReqTagClose; /**< Flag to close the stack's top tag */ + bool TagSoup; /**< Flag to enable the parser's cleanup functions */ + bool loadCssFromStash; /**< current stash content should be loaded as CSS */ + bool PrevWasBodyClose; /**< set when </body> is found */ + bool PrevWasHtmlClose; /**< set when </html> is found */ + + /** element counters: used for validation purposes. * ATM they're used as three state flags {0,1,>1} */ uchar_t Num_HTML, Num_HEAD, Num_BODY, Num_TITLE; - Dstr *attr_data; /* Buffer for attribute value */ + Dstr *attr_data; /**< Buffer for attribute value */ - int32_t non_css_link_color; /* as provided by link attribute in BODY */ - int32_t non_css_visited_color; /* as provided by vlink attribute in BODY */ - int32_t visited_color; /* as computed according to CSS */ + int32_t non_css_link_color; /**< as provided by link attribute in BODY */ + int32_t non_css_visited_color; /**< as provided by vlink attribute in BODY */ + int32_t visited_color; /**< as computed according to CSS */ /* -------------------------------------------------------------------*/ /* Variables required after parsing (for page functionality) */ diff --git a/src/image.cc b/src/image.cc index 97270eef..940942d4 100644 --- a/src/image.cc +++ b/src/image.cc @@ -10,8 +10,8 @@ * (at your option) any later version. */ -/* - * This file implements image data transfer methods. It handles the transfer +/* @file + * Implements image data transfer methods. It handles the transfer * of data from an Image to a DwImage widget. */ @@ -23,11 +23,11 @@ using namespace dw::core; -// Image to Object-ImgRenderer macro +/** Image to Object-ImgRenderer macro */ #define I2IR(Image) ((dw::core::ImgRenderer*)(Image->img_rndr)) -/* +/** * Create and initialize a new image structure. */ DilloImage *a_Image_new(void *layout, void *img_rndr, int32_t bg_color) @@ -49,7 +49,7 @@ DilloImage *a_Image_new(void *layout, void *img_rndr, int32_t bg_color) return Image; } -/* +/** * Create and initialize a new image structure with an image widget. */ DilloImage *a_Image_new_with_dw(void *layout, const char *alt_text, @@ -59,7 +59,7 @@ DilloImage *a_Image_new_with_dw(void *layout, const char *alt_text, return a_Image_new(layout, (void*)(dw::core::ImgRenderer*)dw, bg_color); } -/* +/** * Return the image renderer as a widget. This is somewhat tricky, * since simple casting leads to wrong (and hard to debug) results, * because of multiple inheritance. This function can be used from C @@ -69,7 +69,7 @@ void *a_Image_get_dw(DilloImage *Image) { return (dw::Image*)(dw::core::ImgRenderer*)Image->img_rndr; } -/* +/** * Deallocate an Image structure */ static void Image_free(DilloImage *Image) @@ -78,7 +78,7 @@ static void Image_free(DilloImage *Image) dFree(Image); } -/* +/** * Unref and free if necessary * Do nothing if the argument is NULL */ @@ -89,7 +89,7 @@ void a_Image_unref(DilloImage *Image) Image_free(Image); } -/* +/** * Add a reference to an Image struct * Do nothing if the argument is NULL */ @@ -99,7 +99,7 @@ void a_Image_ref(DilloImage *Image) ++Image->RefCount; } -/* +/** * Set initial parameters of the image */ void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url, @@ -120,7 +120,7 @@ void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url, Image->State = IMG_SetParms; } -/* +/** * Implement the write method */ void a_Image_write(DilloImage *Image, uint_t y) @@ -134,7 +134,7 @@ void a_Image_write(DilloImage *Image, uint_t y) Image->State = IMG_Write; } -/* +/** * Implement the close method */ void a_Image_close(DilloImage *Image) @@ -143,7 +143,7 @@ void a_Image_close(DilloImage *Image) I2IR(Image)->finish(); } -/* +/** * Implement the abort method */ void a_Image_abort(DilloImage *Image) diff --git a/src/image.hh b/src/image.hh index 39fe0405..dc33f3bc 100644 --- a/src/image.hh +++ b/src/image.hh @@ -1,7 +1,8 @@ #ifndef __IMAGE_HH__ #define __IMAGE_HH__ -// The DilloImage data-structure and methods +/** @file + * The DilloImage data-structure and methods */ #ifdef __cplusplus @@ -16,7 +17,7 @@ extern "C" { * Defines */ -/* Arbitrary maximum for image size (to avoid image size-crafting attacks). */ +/** Arbitrary maximum for image size. To avoid image size-crafting attacks. */ #define IMAGE_MAX_AREA (6000 * 6000) /* @@ -35,12 +36,12 @@ typedef enum { /* These will reflect the Image's "state" */ typedef enum { - IMG_Empty, /* Just created the entry */ - IMG_SetParms, /* Parameters set */ - IMG_SetCmap, /* Color map set */ - IMG_Write, /* Feeding the entry */ - IMG_Close, /* Whole image got! */ - IMG_Abort /* Image transfer aborted */ + IMG_Empty, /**< Just created the entry */ + IMG_SetParms, /**< Parameters set */ + IMG_SetCmap, /**< Color map set */ + IMG_Write, /**< Feeding the entry */ + IMG_Close, /**< Whole image got! */ + IMG_Abort /**< Image transfer aborted */ } ImageState; struct _DilloImage { @@ -50,12 +51,12 @@ struct _DilloImage { uint_t width; uint_t height; - int32_t bg_color; /* Background color */ - bitvec_t *BitVec; /* Bit vector for decoded rows */ - uint_t ScanNumber; /* Current decoding scan */ - ImageState State; /* Processing status */ + int32_t bg_color; /**< Background color */ + bitvec_t *BitVec; /**< Bit vector for decoded rows */ + uint_t ScanNumber; /**< Current decoding scan */ + ImageState State; /**< Processing status */ - int RefCount; /* Reference counter */ + int RefCount; /**< Reference counter */ }; diff --git a/src/imgbuf.cc b/src/imgbuf.cc index 48e6bde5..6b701d6b 100644 --- a/src/imgbuf.cc +++ b/src/imgbuf.cc @@ -70,7 +70,7 @@ static uchar_t *Imgbuf_rgb_line(const uchar_t *buf, // Wrappers for Imgbuf ------------------------------------------------------- -/* +/** * Increment reference count for an Imgbuf */ void a_Imgbuf_ref(void *v_imgbuf) @@ -78,7 +78,7 @@ void a_Imgbuf_ref(void *v_imgbuf) ((Imgbuf*)v_imgbuf)->ref(); } -/* +/** * Decrement reference count for an Imgbuf */ void a_Imgbuf_unref(void *v_imgbuf) @@ -87,7 +87,7 @@ void a_Imgbuf_unref(void *v_imgbuf) ((Imgbuf*)v_imgbuf)->unref(); } -/* +/** * Create a new Imgbuf */ void *a_Imgbuf_new(void *layout, int img_type, uint_t width, uint_t height, @@ -107,7 +107,7 @@ void *a_Imgbuf_new(void *layout, int img_type, uint_t width, uint_t height, gamma); } -/* +/** * Last reference for this Imgbuf? */ int a_Imgbuf_last_reference(void *v_imgbuf) @@ -115,7 +115,7 @@ int a_Imgbuf_last_reference(void *v_imgbuf) return ((Imgbuf*)v_imgbuf)->lastReference () ? 1 : 0; } -/* +/** * Update the root buffer of an imgbuf. */ void a_Imgbuf_update(void *v_imgbuf, const uchar_t *buf, DilloImgType type, @@ -129,7 +129,7 @@ void a_Imgbuf_update(void *v_imgbuf, const uchar_t *buf, DilloImgType type, ((Imgbuf*)v_imgbuf)->copyRow(y, (byte *)newbuf); } -/* +/** * Reset for a new scan from a multiple-scan image. */ void a_Imgbuf_new_scan(void *v_imgbuf) @@ -9,7 +9,8 @@ * (at your option) any later version. */ -/* +/** + * @file * The jpeg decoder for dillo. It is responsible for decoding JPEG data * and transferring it to the dicache. It uses libjpeg to do the actual * decoding. @@ -51,13 +52,13 @@ typedef struct DilloJpeg DilloJpeg; /* An implementation of a suspending source manager */ typedef struct { - struct jpeg_source_mgr pub; /* public fields */ - DilloJpeg *jpeg; /* a pointer back to the jpeg object */ + struct jpeg_source_mgr pub; /**< public fields */ + DilloJpeg *jpeg; /**< a pointer back to the jpeg object */ } my_source_mgr; struct my_error_mgr { - struct jpeg_error_mgr pub; /* "public" fields */ - jmp_buf setjmp_buffer; /* for return to caller */ + struct jpeg_error_mgr pub; /**< "public" fields */ + jmp_buf setjmp_buffer; /**< for return to caller */ }; typedef struct my_error_mgr *my_error_ptr; @@ -84,7 +85,7 @@ struct DilloJpeg { static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize); -/* this is the routine called by libjpeg when it detects an error. */ +/** Routine called by libjpeg when it detects an error. */ METHODDEF(void) Jpeg_errorexit (j_common_ptr cinfo) { /* display message and return to setjmp buffer */ @@ -98,7 +99,7 @@ METHODDEF(void) Jpeg_errorexit (j_common_ptr cinfo) longjmp(myerr->setjmp_buffer, 1); } -/* +/** * Free the jpeg-decoding data structure. */ static void Jpeg_free(DilloJpeg *jpeg) @@ -108,7 +109,7 @@ static void Jpeg_free(DilloJpeg *jpeg) dFree(jpeg); } -/* +/** * Finish the decoding process */ static void Jpeg_close(DilloJpeg *jpeg, CacheClient_t *Client) @@ -234,7 +235,7 @@ void a_Jpeg_callback(int Op, void *data) } } -/* +/** * Receive and process new chunks of JPEG image data */ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize) diff --git a/src/keys.cc b/src/keys.cc index 44f6acd9..a512b8ea 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -142,7 +142,7 @@ static Dlist *bindings; -/* +/** * Initialize the bindings list */ void Keys::init() @@ -163,7 +163,7 @@ void Keys::init() } } -/* +/** * Free data */ void Keys::free() @@ -178,7 +178,7 @@ void Keys::free() dList_free(bindings); } -/* +/** * Compare function by {key,modifier} pairs. */ int Keys::nodeByKeyCmp(const void *node, const void *key) @@ -188,7 +188,7 @@ int Keys::nodeByKeyCmp(const void *node, const void *key) return (n->key != k->key) ? (n->key - k->key) : (n->modifier - k->modifier); } -/* +/** * Look if the just pressed key is bound to a command. * Return value: The command if found, KEYS_NOP otherwise. */ @@ -221,7 +221,7 @@ KeysCommand_t Keys::getKeyCmd() return ret; } -/* +/** * Remove a key binding from the table. */ void Keys::delKeyCmd(int key, int mod) @@ -238,7 +238,7 @@ void Keys::delKeyCmd(int key, int mod) } } -/* +/** * Takes a key name and looks it up in the mapping table. If * found, its key code is returned. Otherwise -1 is given * back. @@ -255,7 +255,7 @@ int Keys::getKeyCode(char *keyName) return -1; } -/* +/** * Takes a command name and searches it in the mapping table. * Return value: command code if found, -1 otherwise */ @@ -270,7 +270,7 @@ KeysCommand_t Keys::getCmdCode(const char *commandName) return KEYS_INVALID; } -/* +/** * Takes a modifier name and looks it up in the mapping table. If * found, its key code is returned. Otherwise -1 is given back. */ @@ -286,7 +286,7 @@ int Keys::getModifier(char *modifierName) return -1; } -/* +/** * Given a keys command, return a shortcut for it, or 0 if there is none * (e.g., for KEYS_NEW_WINDOW, return CTRL+'n'). */ @@ -302,7 +302,7 @@ int Keys::getShortcut(KeysCommand_t cmd) return 0; } -/* +/** * Parse a key-combination/command-name pair, and * insert it into the bindings list. */ @@ -368,7 +368,7 @@ void Keys::parseKey(char *key, char *commandName) } } -/* +/** * Parse the keysrc. */ void Keys::parse(FILE *fp) diff --git a/src/klist.c b/src/klist.c index e5e695e2..c256760b 100644 --- a/src/klist.c +++ b/src/klist.c @@ -9,8 +9,8 @@ * (at your option) any later version. */ -/* - * A simple ADT for Key-Data pairs +/** @file + * A simple ADT for Key-Data pairs. * * NOTE: this ADT is not perfect. The possibility of holding a Key, after * its data has been removed, long enough for the key-counter to reset and @@ -21,7 +21,7 @@ #include "klist.h" -/* +/** * Compare function for searching data by its key */ static int Klist_node_by_key_cmp(const void *Node, const void *key) @@ -29,7 +29,7 @@ static int Klist_node_by_key_cmp(const void *Node, const void *key) return ((KlistNode_t *)Node)->Key - VOIDP2INT(key); } -/* +/** * Compare function for searching data by node */ static int Klist_node_by_node_cmp(const void *Node1, const void *Node2) @@ -37,7 +37,7 @@ static int Klist_node_by_node_cmp(const void *Node1, const void *Node2) return ((KlistNode_t *)Node1)->Key - ((KlistNode_t *)Node2)->Key; } -/* +/** * Return the data pointer for a given Key (or NULL if not found) */ void *a_Klist_get_data(Klist_t *Klist, int Key) @@ -50,7 +50,7 @@ void *a_Klist_get_data(Klist_t *Klist, int Key) return (aux) ? ((KlistNode_t*)aux)->Data : NULL; } -/* +/** * Insert a data pointer and return a key for it. */ int a_Klist_insert(Klist_t **Klist, void *Data) @@ -80,7 +80,7 @@ int a_Klist_insert(Klist_t **Klist, void *Data) return (*Klist)->Counter; } -/* +/** * Remove data by Key */ void a_Klist_remove(Klist_t *Klist, int Key) @@ -96,7 +96,7 @@ void a_Klist_remove(Klist_t *Klist, int Key) Klist->Clean = 1; } -/* +/** * Return the number of elements in the Klist */ int a_Klist_length(Klist_t *Klist) @@ -104,7 +104,7 @@ int a_Klist_length(Klist_t *Klist) return dList_length(Klist->List); } -/* +/** * Free a Klist */ void a_Klist_free(Klist_t **KlistPtr) diff --git a/src/klist.h b/src/klist.h index 04e14d33..429f26f7 100644 --- a/src/klist.h +++ b/src/klist.h @@ -9,14 +9,14 @@ extern "C" { #endif /* __cplusplus */ typedef struct { - int Key; /* primary key */ - void *Data; /* data reference */ + int Key; /**< primary key */ + void *Data; /**< data reference */ } KlistNode_t; typedef struct { Dlist *List; - int Clean; /* check flag */ - int Counter; /* counter (for making keys) */ + int Clean; /**< check flag */ + int Counter; /**< counter (for making keys) */ } Klist_t; @@ -1,5 +1,6 @@ -/* - * Fast list methods +/** + * @file + * Fast list methods. * Feb 2000 --Jcid * */ @@ -7,10 +8,8 @@ #ifndef __LIST_H__ #define __LIST_H__ -/* - * a_List_resize() - * - * Make sure there's space for 'num_items' items within the list +/** + * Make sure there's space for 'num_items' items within the list. * (First, allocate an 'alloc_step' sized chunk, after that, double the * list size --to make it faster) */ @@ -25,18 +24,14 @@ } -/* - * a_List_add() - * +/** * Make sure there's space for one more item within the list. */ #define a_List_add(list,num_items,alloc_step) \ a_List_resize(list,num_items,alloc_step) -/* - * a_List_remove() - * +/** * Quickly remove an item from the list * ==> We preserve relative position, but not the element index <== */ @@ -31,7 +31,8 @@ */ /* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ -/* +/** + @file Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose @@ -46,18 +47,18 @@ <ghost@aladdin.com>. Other authors are noted in the change history that follows (in reverse chronological order): - 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order + - 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order either statically or dynamically; added missing #include <string.h> in library. - 2002-03-11 lpd Corrected argument list for main(), and added int return + - 2002-03-11 lpd Corrected argument list for main(), and added int return type, in test program and T value program. - 2002-02-21 lpd Added missing #include <stdio.h> in test program. - 2000-07-03 lpd Patched to eliminate warnings about "constant is + - 2002-02-21 lpd Added missing #include <stdio.h> in test program. + - 2000-07-03 lpd Patched to eliminate warnings about "constant is unsigned in ANSI C, signed in traditional"; made test program self-checking. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). - 1999-05-03 lpd Original version. + - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). + - 1999-05-03 lpd Original version. */ #include "md5.h" @@ -72,7 +72,7 @@ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ -/* Define the state of the MD5 Algorithm. */ +/** Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ @@ -84,13 +84,13 @@ extern "C" { #endif -/* Initialize the algorithm. */ +/** Initialize the algorithm. */ void md5_init(md5_state_t *pms); -/* Append a string to the message. */ +/** Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -/* Finish the message and return the digest. */ +/** Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #ifdef __cplusplus diff --git a/src/menu.cc b/src/menu.cc index fdf4fc60..9bdf6999 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -9,7 +9,10 @@ * (at your option) any later version. */ -// Functions/Methods for menus +/** + * @file + * Functions for menus + */ #include <FL/Fl.H> #include <FL/Fl_Menu_Item.H> @@ -57,7 +60,7 @@ static void Menu_nop_cb(Fl_Widget*, void*) { } -/* +/** * Static function for File menu callbacks. */ static void filemenu_cb(Fl_Widget*, void *data) @@ -86,7 +89,7 @@ static void Menu_copy_urlstr_cb(Fl_Widget*, void *user_data) } } -/* +/** * Open URL */ static void Menu_open_url_cb(Fl_Widget*, void *user_data) @@ -96,7 +99,7 @@ static void Menu_open_url_cb(Fl_Widget*, void *user_data) a_UIcmd_open_url(popup_bw, url); } -/* +/** * Open URL in new window */ static void Menu_open_url_nw_cb(Fl_Widget*, void *user_data) @@ -106,7 +109,7 @@ static void Menu_open_url_nw_cb(Fl_Widget*, void *user_data) a_UIcmd_open_url_nw(popup_bw, url); } -/* +/** * Open URL in new Tab */ static void Menu_open_url_nt_cb(Fl_Widget*, void *user_data) @@ -117,7 +120,7 @@ static void Menu_open_url_nt_cb(Fl_Widget*, void *user_data) a_UIcmd_open_url_nt(popup_bw, url, focus); } -/* +/** * Add bookmark */ static void Menu_add_bookmark_cb(Fl_Widget*, void *user_data) @@ -126,7 +129,7 @@ static void Menu_add_bookmark_cb(Fl_Widget*, void *user_data) a_UIcmd_add_bookmark(popup_bw, url); } -/* +/** * Find text */ static void Menu_find_text_cb(Fl_Widget*, void*) @@ -134,7 +137,7 @@ static void Menu_find_text_cb(Fl_Widget*, void*) ((UI *)popup_bw->ui)->findbar_toggle(1); } -/* +/** * Save link */ static void Menu_save_link_cb(Fl_Widget*, void *user_data) @@ -143,7 +146,7 @@ static void Menu_save_link_cb(Fl_Widget*, void *user_data) a_UIcmd_save_link(popup_bw, url); } -/* +/** * Save current page */ static void Menu_save_page_cb(Fl_Widget*, void*) @@ -151,7 +154,7 @@ static void Menu_save_page_cb(Fl_Widget*, void*) a_UIcmd_save(popup_bw); } -/* +/** * View current page source */ static void Menu_view_page_source_cb(Fl_Widget*, void *user_data) @@ -160,7 +163,7 @@ static void Menu_view_page_source_cb(Fl_Widget*, void *user_data) a_UIcmd_view_page_source(popup_bw, url); } -/* +/** * View current page's bugs */ static void Menu_view_page_bugs_cb(Fl_Widget*, void*) @@ -168,7 +171,7 @@ static void Menu_view_page_bugs_cb(Fl_Widget*, void*) a_UIcmd_view_page_bugs(popup_bw); } -/* +/** * Load images on current page that match URL pattern */ static void Menu_load_images_cb(Fl_Widget*, void *user_data) @@ -180,7 +183,7 @@ static void Menu_load_images_cb(Fl_Widget*, void *user_data) a_Html_load_images(doc, popup_url); } -/* +/** * Submit form */ static void Menu_form_submit_cb(Fl_Widget*, void*) @@ -191,7 +194,7 @@ static void Menu_form_submit_cb(Fl_Widget*, void*) a_Html_form_submit(doc, popup_form); } -/* +/** * Reset form */ static void Menu_form_reset_cb(Fl_Widget*, void*) @@ -202,7 +205,7 @@ static void Menu_form_reset_cb(Fl_Widget*, void*) a_Html_form_reset(doc, popup_form); } -/* +/** * Toggle display of 'hidden' form controls. */ static void Menu_form_hiddens_cb(Fl_Widget*, void *user_data) @@ -251,7 +254,7 @@ static void Menu_bugmeter_validate(const char *validator_url) } } -/* +/** * Validate URL with the W3C */ static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*) @@ -259,7 +262,7 @@ static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void*) Menu_bugmeter_validate("http://validator.w3.org/check?uri=%s"); } -/* +/** * Validate URL with the WDG */ static void Menu_bugmeter_validate_wdg_cb(Fl_Widget*, void*) @@ -268,7 +271,7 @@ static void Menu_bugmeter_validate_wdg_cb(Fl_Widget*, void*) "http://www.htmlhelp.org/cgi-bin/validate.cgi?url=%s&warnings=yes"); } -/* +/** * Show info page for the bug meter */ static void Menu_bugmeter_about_cb(Fl_Widget*, void*) @@ -276,7 +279,7 @@ static void Menu_bugmeter_about_cb(Fl_Widget*, void*) a_UIcmd_open_urlstr(popup_bw, "https://dillo-browser.github.io/old/help/bug_meter.html"); } -/* +/** * Navigation History callback. * Go to selected URL. */ @@ -335,7 +338,7 @@ static void Menu_popup_cb(void *data) a_Timeout_remove(); } -/* +/** * Page popup menu (construction & popup) */ void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, @@ -437,7 +440,7 @@ static void Menu_set_link_menu_user_data(void *user_data) link_menu[i].user_data(user_data); } -/* +/** * Link popup menu (construction & popup) */ void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url) @@ -455,7 +458,7 @@ void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url) a_Timeout_add(0.0, Menu_popup_cb, (void*)&link_data); } -/* +/** * Image popup menu (construction & popup) */ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, @@ -514,7 +517,7 @@ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url, a_Timeout_add(0.0, Menu_popup_cb, (void*)&image_data); } -/* +/** * Form popup menu (construction & popup) */ void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url, @@ -542,7 +545,7 @@ void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url, a_Timeout_add(0.0, Menu_popup_cb, (void*)&form_data); } -/* +/** * File popup menu (construction & popup) */ void a_Menu_file_popup(BrowserWindow *bw, void *v_wid) @@ -575,7 +578,7 @@ void a_Menu_file_popup(BrowserWindow *bw, void *v_wid) a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } -/* +/** * Bugmeter popup menu (construction & popup) */ void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url) @@ -597,8 +600,8 @@ void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url) a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } -/* - * Navigation History popup menu (construction & popup) +/** + * Navigation History popup menu (construction & popup). * * direction: {backward = -1, forward = 1} */ @@ -634,7 +637,7 @@ void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction) a_Timeout_add(0.0, Menu_simple_popup_cb, (void*)pm); } -/* +/** * Toggle use of remote stylesheets */ static void Menu_remote_css_cb(Fl_Widget *wid, void*) @@ -646,7 +649,7 @@ static void Menu_remote_css_cb(Fl_Widget *wid, void*) a_UIcmd_repush(popup_bw); } -/* +/** * Toggle use of embedded CSS style */ static void Menu_embedded_css_cb(Fl_Widget *wid, void*) @@ -668,7 +671,7 @@ static void Menu_panel_change_cb(Fl_Widget*, void *user_data) ui->change_panel(VOIDP2INT(user_data), ui->get_smallicons()); } -/* +/** * Toggle loading of images -- and load them if enabling. */ static void Menu_imgload_toggle_cb(Fl_Widget *wid, void*) @@ -687,7 +690,7 @@ static void Menu_imgload_toggle_cb(Fl_Widget *wid, void*) } } -/* +/** * Toggle loading of background images. */ static void Menu_bgimg_load_toggle_cb(Fl_Widget *wid, void*) @@ -699,8 +702,8 @@ static void Menu_bgimg_load_toggle_cb(Fl_Widget *wid, void*) a_UIcmd_repush(popup_bw); } -/* - * Tools popup menu (construction & popup) +/** + * Tools popup menu (construction & popup). */ void a_Menu_tools_popup(BrowserWindow *bw, int x, int y) { @@ -19,7 +19,7 @@ #include "msg.h" #include "misc.h" -/* +/** * Escape characters as %XX sequences. * Return value: New string. */ @@ -47,7 +47,7 @@ char *a_Misc_escape_chars(const char *str, const char *esc_set) } #define TAB_SIZE 8 -/* +/** * Takes a string and converts any tabs to spaces. */ int @@ -123,7 +123,7 @@ typedef enum { DT_IMAGE_JPG, } DetectedContentType; -/* +/** * Detects 'Content-Type' from a data stream sample. * * It uses the magic(5) logic from file(1). Currently, it @@ -203,7 +203,7 @@ int a_Misc_get_content_type_from_data(void *Data, size_t Size, const char **PT) return st; } -/* +/** * Parse Content-Type string, e.g., "text/html; charset=utf-8". * Content-Type is defined in RFC 2045 section 5.1. */ @@ -267,7 +267,7 @@ void a_Misc_parse_content_type(const char *type, char **major, char **minor, } } -/* +/** * Compare two Content-Type strings. * Return 0 if they are equivalent, and 1 otherwise. */ @@ -301,13 +301,13 @@ int a_Misc_content_type_cmp(const char *ct1, const char *ct2) return ret; } -/* +/** * Check the server-supplied 'Content-Type' against our detected type. * (some servers seem to default to "text/plain"). * - * Return value: - * 0, if they match - * -1, if a mismatch is detected + * @return + * - 0, if they match + * - -1, if a mismatch is detected * * There are many MIME types Dillo doesn't know, they're handled * as "application/octet-stream" (as the SPEC says). @@ -354,7 +354,7 @@ int a_Misc_content_type_check(const char *EntryType, const char *DetectedType) return st; } -/* +/** * Parse a geometry string. */ int a_Misc_parse_geometry(char *str, int *x, int *y, int *w, int *h) @@ -384,8 +384,8 @@ int a_Misc_parse_geometry(char *str, int *x, int *y, int *w, int *h) return ret; } -/* - * Parse dillorc's search_url string ("[<label> ]<url>") +/** + * Parse dillorc's search_url string (`[<label> ]<url>`) * Return value: -1 on error, 0 on success (and label and urlstr pointers) */ int a_Misc_parse_search_url(char *source, char **label, char **urlstr) @@ -418,7 +418,7 @@ int a_Misc_parse_search_url(char *source, char **label, char **urlstr) return ret; } -/* +/** * Encodes string using base64 encoding. * Return value: new string or NULL if input string is empty. */ @@ -456,7 +456,7 @@ char *a_Misc_encode_base64(const char *in) return out; } -/* +/** * Load a local file into a dStr. * Return value: dStr on success, NULL on error. * TODO: a filesize threshold may be implemented. @@ -9,7 +9,8 @@ * (at your option) any later version. */ -/* Support for a navigation stack */ +/** @file + * Support for a navigation stack */ #include <stdio.h> #include <sys/stat.h> diff --git a/src/paths.cc b/src/paths.cc index bb233de8..94982594 100644 --- a/src/paths.cc +++ b/src/paths.cc @@ -24,7 +24,7 @@ // Dillo works from an unmounted directory (/tmp) static char* oldWorkingDir = NULL; -/* +/** * Changes current working directory to /tmp and creates ~/.dillo * if not exists. */ @@ -58,7 +58,7 @@ void Paths::init(void) dFree(path); } -/* +/** * Return the initial current working directory in a string. */ char *Paths::getOldWorkingDir(void) @@ -66,7 +66,7 @@ char *Paths::getOldWorkingDir(void) return oldWorkingDir; } -/* +/** * Free memory */ void Paths::free(void) @@ -74,7 +74,7 @@ void Paths::free(void) dFree(oldWorkingDir); } -/* +/** * Examines the path for "rcFile" and assign its file pointer to "fp". */ FILE *Paths::getPrefsFP(const char *rcFile) diff --git a/src/plain.cc b/src/plain.cc index ab080886..2783f0b1 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -9,7 +9,8 @@ * (at your option) any later version. */ -/* +/** + * @file * Module for decoding a text/plain object into a dw widget. */ @@ -80,7 +81,7 @@ static void Plain_callback(int Op, CacheClient_t *Client); void a_Plain_free(void *data); -/* +/** * Diplain constructor. */ DilloPlain::DilloPlain(BrowserWindow *p_bw) @@ -110,7 +111,7 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw) dw->setDeleteCallback(a_Plain_free, this); } -/* +/** * Free memory used by the DilloPlain class. */ DilloPlain::~DilloPlain() @@ -119,7 +120,7 @@ DilloPlain::~DilloPlain() widgetStyle->unref(); } -/* +/** * Receive the mouse button press event */ bool DilloPlain::PlainLinkReceiver::press (Widget *widget, int, int, int, int, @@ -156,7 +157,7 @@ void DilloPlain::addLine(char *Buf, uint_t BufSize) DW2TB(dw)->addParbreak(0, widgetStyle); } -/* +/** * Here we parse plain text and put it into the page structure. * (This function is called by Plain_callback whenever there's new data) */ @@ -197,7 +198,7 @@ void DilloPlain::write(void *Buf, uint_t BufSize, int Eof) DW2TB(dw)->flush(); } -/* +/** * Set callback function and callback data for "text/" MIME major-type. */ void *a_Plain_text(const char *type, void *P, CA_Callback_t *Call, void **Data) @@ -217,7 +218,7 @@ void a_Plain_free(void *data) delete ((DilloPlain *)data); } -/* +/** * This function is a cache client */ static void Plain_callback(int Op, CacheClient_t *Client) @@ -1,11 +1,14 @@ /* + * Copyright Geoff Lane nov 1999 zzassgl@twirl.mcc.ac.uk + * Copyright Luca Rota, Jorge Arellano Cid, Eric Gaudet 2000 + * Copyright Jorge Arellano Cid 2009 + */ + +/** + * @file * The png decoder for Dillo. It is responsible for decoding PNG data * and transferring it to the dicache. - * - * Geoff Lane nov 1999 zzassgl@twirl.mcc.ac.uk - * Luca Rota, Jorge Arellano Cid, Eric Gaudet 2000 - * Jorge Arellano Cid 2009 - * + * * "PNG: The Definitive Guide" by Greg Roelofs, O'Reilly * ISBN 1-56592-542-4 */ @@ -37,8 +40,8 @@ static char *prog_state_name[] = }; #endif -/* - * This holds the data that must be saved between calls to this module. +/** + * Holds the data that must be saved between calls to this module. * Each time it is called it is supplied with a vector of data bytes * obtained from the web server. The module can process any amount of the * supplied data. The next time the module is called, the vector may be @@ -57,24 +60,23 @@ static char *prog_state_name[] = * png_ptr and into_ptr so the FSM is very simple - much simpler than the * ones for XBM and PNM are. */ - typedef struct { - DilloImage *Image; /* Image meta data */ - DilloUrl *url; /* Primary Key for the dicache */ - int version; /* Secondary Key for the dicache */ - int bgcolor; /* Parent widget background color */ - - png_uint_32 width; /* png image width */ - png_uint_32 height; /* png image height */ - png_structp png_ptr; /* libpng private data */ - png_infop info_ptr; /* libpng private info */ - uchar_t *image_data; /* decoded image data */ - uchar_t **row_pointers; /* pntr to row starts */ - jmp_buf jmpbuf; /* png error processing */ - int error; /* error flag */ + DilloImage *Image; /**< Image meta data */ + DilloUrl *url; /**< Primary Key for the dicache */ + int version; /**< Secondary Key for the dicache */ + int bgcolor; /**< Parent widget background color */ + + png_uint_32 width; /**< png image width */ + png_uint_32 height; /**< png image height */ + png_structp png_ptr; /**< libpng private data */ + png_infop info_ptr; /**< libpng private info */ + uchar_t *image_data; /**< decoded image data */ + uchar_t **row_pointers; /**< pntr to row starts */ + jmp_buf jmpbuf; /**< png error processing */ + int error; /**< error flag */ png_uint_32 previous_row; - int rowbytes; /* No. bytes in image row */ - short channels; /* No. image channels */ + int rowbytes; /**< No. bytes in image row */ + short channels; /**< No. image channels */ /* * 0 last byte @@ -85,13 +87,13 @@ typedef struct { * ipbuf ipbufstart ipbufsize */ - uchar_t *ipbuf; /* image data in buffer */ - int ipbufstart; /* first valid image byte */ - int ipbufsize; /* size of valid data in */ + uchar_t *ipbuf; /**< image data in buffer */ + int ipbufstart; /**< first valid image byte */ + int ipbufsize; /**< size of valid data in */ - enum prog_state state; /* FSM current state */ + enum prog_state state; /**< FSM current state */ - uchar_t *linebuf; /* o/p raster data */ + uchar_t *linebuf; /**< o/p raster data */ } DilloPng; @@ -292,7 +294,7 @@ static void Png_dataend_callback(png_structp png_ptr, png_infop info_ptr) png->state = IS_finished; } -/* +/** * Free up the resources for this image. */ static void Png_free(DilloPng *png) @@ -309,7 +311,7 @@ static void Png_free(DilloPng *png) dFree(png); } -/* +/** * Finish the decoding process (and free the memory) */ static void Png_close(DilloPng *png, CacheClient_t *Client) @@ -320,7 +322,7 @@ static void Png_close(DilloPng *png, CacheClient_t *Client) Png_free(png); } -/* +/** * Receive and process new chunks of PNG image data */ static void Png_write(DilloPng *png, void *Buf, uint_t BufSize) @@ -389,19 +391,20 @@ static void Png_write(DilloPng *png, void *Buf, uint_t BufSize) } } -/* - * Op: Operation to perform. - * If (Op == 0) +/** + * PNG callback. + * - Op: Operation to perform. + * - If (Op == 0) * start or continue processing an image if image data exists. - * else + * - else * terminate processing, cleanup any allocated memory, * close down the decoding process. * - * Client->CbData : pointer to previously allocated DilloPng work area. - * This holds the current state of the image processing and is kept - * across calls to this routine. - * Client->Buf : Pointer to data start. - * Client->BufSize : the size of the data buffer. + * - Client->CbData : pointer to previously allocated DilloPng work area. + * This holds the current state of the image processing and is kept + * across calls to this routine. + * - Client->Buf : Pointer to data start. + * - Client->BufSize : the size of the data buffer. * * You have to keep track of where you are in the image data and * how much has been processed. @@ -424,7 +427,7 @@ void a_Png_callback(int Op, void *data) } } -/* +/** * Create the image state data that must be kept between calls */ void *a_Png_new(DilloImage *Image, DilloUrl *url, int version) diff --git a/src/prefs.c b/src/prefs.c index c8a16d67..26c86a4d 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -31,7 +31,7 @@ *---------------------------------------------------------------------------*/ DilloPrefs prefs; -/* +/** * Sets the default settings. */ @@ -128,8 +128,8 @@ void a_Prefs_init(void) prefs.stretchability_factor = 100; } -/* - * memory-deallocation +/** + * memory-deallocation. * (Call this one at exit time) */ void a_Prefs_freeall(void) diff --git a/src/prefs.h b/src/prefs.h index 9b9ee392..4eddeb5f 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -31,7 +31,7 @@ extern "C" { #define PREFS_UI_TAB_BG_COLOR 19 #define PREFS_UI_TAB_FG_COLOR 20 -/* Panel sizes */ +/** Panel sizes. */ enum { P_tiny = 0, P_small, P_medium }; typedef struct { @@ -118,7 +118,7 @@ typedef struct { int stretchability_factor; } DilloPrefs; -/* Global Data */ +/** Global Data */ extern DilloPrefs prefs; void a_Prefs_init(void); diff --git a/src/prefsparser.cc b/src/prefsparser.cc index b1b38775..83131d58 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -10,6 +10,11 @@ * (at your option) any later version. */ +/** + * @file + * Preferences parser + */ + #include <sys/types.h> #include <stdlib.h> #include <locale.h> /* for setlocale */ @@ -43,7 +48,7 @@ typedef struct { int count; } SymNode_t; -/* +/** * Parse a name/value pair and set preferences accordingly. */ static int parseOption(char *name, char *value, @@ -137,7 +142,7 @@ static int parseOption(char *name, char *value, return 0; } -/* +/** * Parses the dillorc and sets the values in the prefs structure. */ void PrefsParser::parse(FILE *fp) diff --git a/src/table.cc b/src/table.cc index 1268fbd9..3a1aded4 100644 --- a/src/table.cc +++ b/src/table.cc @@ -10,6 +10,11 @@ * (at your option) any later version. */ +/** + * @file + * Table parsing functions + */ + #include "table.hh" #include "html_common.hh" @@ -288,7 +293,7 @@ void Html_tag_content_th(DilloHtml *html, const char *tag, int tagsize) * Utilities */ -/* +/** * The table border model is stored in the table's stack item */ static int Html_table_get_border_model(DilloHtml *html) @@ -303,7 +308,7 @@ static int Html_table_get_border_model(DilloHtml *html) return html->stack->getRef(s_idx)->table_border_mode; } -/* +/** * Set current table's border model */ static void Html_table_set_border_model(DilloHtml *html, @@ -362,7 +367,7 @@ static void Html_set_collapsing_border_model(DilloHtml *html, Widget *col_tb) } } -/* +/** * Adjust style for separate border model. * (Dw uses this model internally). */ diff --git a/src/timeout.cc b/src/timeout.cc index 1ddcd5e1..f00b374e 100644 --- a/src/timeout.cc +++ b/src/timeout.cc @@ -9,14 +9,16 @@ * (at your option) any later version. */ -// Simple ADT for timeout functions +/** @file + * Simple ADT for timeout functions + */ #include <FL/Fl.H> #include "timeout.hh" // C++ functions with C linkage ---------------------------------------------- -/* +/** * Hook a one-time timeout function 'cb' after 't' seconds * with 'cbdata" as its data. */ @@ -25,7 +27,7 @@ void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata) Fl::add_timeout(t, cb, cbdata); } -/* +/** * To be called from inside the 'cb' function when it wants to keep running */ void a_Timeout_repeat(float t, TimeoutCb_t cb, void *cbdata) @@ -33,7 +35,7 @@ void a_Timeout_repeat(float t, TimeoutCb_t cb, void *cbdata) Fl::add_timeout(t, cb, cbdata); } -/* +/** * Stop running a timeout function */ void a_Timeout_remove() diff --git a/src/tipwin.cc b/src/tipwin.cc index 7cfa0844..c2f37431 100644 --- a/src/tipwin.cc +++ b/src/tipwin.cc @@ -34,7 +34,7 @@ static void show_timeout(void*); static void recent_timeout(void*); -/* +/** * Custom tooltip window */ TipWin::TipWin() : Fl_Menu_Window(1, 1) // will autosize @@ -125,7 +125,7 @@ static void recent_timeout(void*) { //--------------------------------------------------------------------------- -/* +/** * A Button sharing a custom tooltip window */ TipWinButton::TipWinButton(int x, int y, int w, int h, const char *l) : @@ -167,7 +167,7 @@ void TipWinButton::set_tooltip(const char *s) //--------------------------------------------------------------------------- -/* +/** * A Light Button sharing a custom tooltip window */ CustButton::CustButton(int x, int y, int w, int h, const char *l) : @@ -202,7 +202,7 @@ void CustButton::hl_color(Fl_Color col) //--------------------------------------------------------------------------- -/* +/** * An Input with custom tooltip window */ TipWinInput::TipWinInput (int x, int y, int w, int h, const char *l) : diff --git a/src/tipwin.hh b/src/tipwin.hh index d3aeeac5..940dd1f6 100644 --- a/src/tipwin.hh +++ b/src/tipwin.hh @@ -6,7 +6,7 @@ #include <FL/Fl_Input.H> -/* +/** * Custom tooltip window */ class TipWin : public Fl_Menu_Window { @@ -29,7 +29,7 @@ public: extern TipWin *my_tipwin(void); -/* +/** * A Button sharing a custom tooltip window */ class TipWinButton : public Fl_Button { @@ -43,7 +43,7 @@ class TipWinButton : public Fl_Button { void set_tooltip(const char *s); }; -/* +/** * A button that highlights on mouse over */ class CustButton : public TipWinButton { @@ -55,7 +55,7 @@ public: }; -/* +/** * An Input with custom tooltip window */ class TipWinInput : public Fl_Input { @@ -9,7 +9,9 @@ * (at your option) any later version. */ -// UI for Dillo +/** @file + * UI for Dillo + */ #include <unistd.h> #include <stdio.h> @@ -87,8 +89,8 @@ static struct iconset *icons = &standard_icons; //---------------------------------------------------------------------------- -/* - * (Used to avoid certain shortcuts in the location bar) +/** + * Used to avoid certain shortcuts in the location bar */ class CustInput : public TipWinInput { public: @@ -97,7 +99,7 @@ public: virtual int handle(int e); }; -/* +/** * Disable keys: Up, Down, Page_Up, Page_Down, Tab and * CTRL+{o,r,Home,End} SHIFT+{Left,Right}. */ @@ -162,7 +164,7 @@ int CustInput::handle(int e) //---------------------------------------------------------------------------- -/* +/** * Used to handle "paste" within the toolbar's Clear button. */ class CustPasteButton : public CustButton { @@ -187,7 +189,7 @@ int CustPasteButton::handle(int e) //---------------------------------------------------------------------------- -/* +/** * Used to resize the progress boxes automatically. */ class CustProgressBox : public Fl_Box { @@ -219,7 +221,7 @@ public: // Callback functions -------------------------------------------------------- // -/* +/** * Callback for the search button. */ static void search_cb(Fl_Widget *wid, void *data) @@ -231,7 +233,7 @@ static void search_cb(Fl_Widget *wid, void *data) } } -/* +/** * Callback for the help button. */ static void help_cb(Fl_Widget *w, void *) @@ -251,7 +253,7 @@ static void help_cb(Fl_Widget *w, void *) dFree(path); } -/* +/** * Callback for the File menu button. */ static void filemenu_cb(Fl_Widget *wid, void *) @@ -262,7 +264,7 @@ static void filemenu_cb(Fl_Widget *wid, void *) } } -/* +/** * Callback for the location's clear-button. */ static void clear_cb(Fl_Widget *w, void *data) @@ -278,7 +280,7 @@ static void clear_cb(Fl_Widget *w, void *data) } } -/* +/** * Send the browser to the new URL in the location. */ static void location_cb(Fl_Widget *wid, void *data) @@ -294,7 +296,7 @@ static void location_cb(Fl_Widget *wid, void *data) } -/* +/** * Callback handler for button press on the panel */ static void b1_cb(Fl_Widget *wid, void *cb_data) @@ -358,7 +360,7 @@ static void b1_cb(Fl_Widget *wid, void *cb_data) } } -/* +/** * Callback for the bug meter button. */ static void bugmeter_cb(Fl_Widget *wid, void *data) @@ -379,7 +381,7 @@ static void bugmeter_cb(Fl_Widget *wid, void *data) // Panel construction methods //---------------------------- -/* +/** * Make a generic navigation button */ CustButton *UI::make_button(const char *label, Fl_Image *img, Fl_Image *deimg, @@ -402,7 +404,7 @@ CustButton *UI::make_button(const char *label, Fl_Image *img, Fl_Image *deimg, return b; } -/* +/** * Create the archetipic browser buttons */ void UI::make_toolbar(int tw, int th) @@ -441,7 +443,7 @@ void UI::make_toolbar(int tw, int th) Tools->set_tooltip("Settings"); } -/* +/** * Create the location box (Clear/Input/Search) */ void UI::make_location(int ww) @@ -486,7 +488,7 @@ void UI::make_location(int ww) } -/* +/** * Create the progress bars */ void UI::make_progress_bars(int wide, int thin_up) @@ -504,8 +506,8 @@ void UI::make_progress_bars(int wide, int thin_up) PProg->update_label(wide ? "Page\n0.0 KB" : "0.0 KB"); } -/* - * Create the "File" menu +/** + * Create the "File" menu. * Static function for File menu callbacks. */ void UI::make_filemenu_button() @@ -532,7 +534,7 @@ void UI::make_filemenu_button() } -/* +/** * Create the control panel */ void UI::make_panel(int ww) @@ -612,7 +614,7 @@ void UI::make_panel(int ww) } } -/* +/** * Create the status panel */ void UI::make_status_bar(int ww, int wh) @@ -643,7 +645,7 @@ void UI::make_status_bar(int ww, int wh) StatusBar->rearrange(); } -/* +/** * User Interface constructor */ UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) : @@ -700,7 +702,7 @@ UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) : } } -/* +/** * UI destructor */ UI::~UI() @@ -708,7 +710,7 @@ UI::~UI() _MSG("UI::~UI()\n"); } -/* +/** * FLTK event handler for this window. */ int UI::handle(int event) @@ -802,7 +804,7 @@ int UI::handle(int event) // API for the User Interface //---------------------------- -/* +/** * Get the text from the location input-box. */ const char *UI::get_location() @@ -810,7 +812,7 @@ const char *UI::get_location() return Location->value(); } -/* +/** * Set a new URL in the location input-box. */ void UI::set_location(const char *str) @@ -820,7 +822,7 @@ void UI::set_location(const char *str) Location->position((Fl::focus() == Location) ? strlen(str) : 0); } -/* +/** * Focus location entry. * If it's not visible, show it until the callback is done. */ @@ -835,7 +837,7 @@ void UI::focus_location() Location->position(Location->size(), 0); } -/* +/** * Focus Main area. */ void UI::focus_main() @@ -843,7 +845,7 @@ void UI::focus_main() Main->take_focus(); } -/* +/** * Set a new message in the status bar. */ void UI::set_status(const char *str) @@ -851,8 +853,8 @@ void UI::set_status(const char *str) StatusOutput->value(str); } -/* - * Set the page progress text +/** + * Set the page progress text. * cmd: 0 Deactivate, 1 Update, 2 Clear */ void UI::set_page_prog(size_t nbytes, int cmd) @@ -883,8 +885,8 @@ void UI::set_page_prog(size_t nbytes, int cmd) } } -/* - * Set the image progress text +/** + * Set the image progress text. * cmd: 0 Deactivate, 1 Update, 2 Clear */ void UI::set_img_prog(int n_img, int t_img, int cmd) @@ -905,7 +907,7 @@ void UI::set_img_prog(int n_img, int t_img, int cmd) } } -/* +/** * Set the bug meter progress text */ void UI::set_bug_prog(int n_bug) @@ -927,7 +929,7 @@ void UI::set_bug_prog(int n_bug) StatusBar->rearrange(); } -/* +/** * Customize the UI's panel (show/hide buttons) */ void UI::customize() @@ -967,7 +969,7 @@ void UI::customize() LocBar->rearrange(); } -/* +/** * On-the-fly panel style change */ void UI::change_panel(int new_size, int small_icons) @@ -998,7 +1000,7 @@ void UI::change_panel(int new_size, int small_icons) dFree(loc_text); } -/* +/** * Set 'nw' as the main render area widget */ void UI::set_render_layout(Fl_Group *nw) @@ -1013,7 +1015,7 @@ void UI::set_render_layout(Fl_Group *nw) TopGroup->resizable(Main); } -/* +/** * Set button sensitivity (Back/Forw/Stop) */ void UI::button_set_sens(UIButton btn, int sens) @@ -1033,7 +1035,7 @@ void UI::button_set_sens(UIButton btn, int sens) } } -/* +/** * Paste a middle-click-selection into "Clear" button as URL */ void UI::paste_url() @@ -1041,7 +1043,7 @@ void UI::paste_url() Fl::paste(*Clear, false); } -/* +/** * Adjust space for the findbar (if necessary) and show or remove it */ void UI::findbar_toggle(bool add) @@ -1069,7 +1071,7 @@ void UI::findbar_toggle(bool add) TopGroup->rearrange(); } -/* +/** * Make panels disappear growing the render area. * WORKAROUND: here we avoid hidden widgets resize by setting their * size to (0,0) while hidden. @@ -28,7 +28,7 @@ typedef enum { } UIButton; typedef enum { - UI_NORMAL = 0, /* make sure it's compatible with bool */ + UI_NORMAL = 0, /**< make sure it's compatible with bool */ UI_HIDDEN = 1 } UIPanelmode; @@ -43,7 +43,7 @@ class CustTabs; // Class definitions --------------------------------------------------------- -/* +/** * Used to reposition group's widgets when some of them are hidden. * All children get the height of the group but retain their original width. * The resizable child get's the remaining space. @@ -155,7 +155,7 @@ public: UI(int x,int y,int w,int h, const char* label = 0, const UI *cur_ui=NULL); ~UI(); - // To manage what events to catch and which to let pass + /** To manage what events to catch and which to let pass */ int handle(int event); const char *get_location(); diff --git a/src/uicmd.cc b/src/uicmd.cc index 5eb64b7b..02d2a141 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -10,8 +10,10 @@ * (at your option) any later version. */ -// Functions/Methods for commands triggered from the UI - +/** + * @file + * Functions/Methods for commands triggered from the UI + */ #include <string.h> #include <stdio.h> @@ -80,7 +82,7 @@ static void UIcmd_set_window_labels(Fl_Window *win, const char *str); * CustTabs --------------------------------------------------------------- */ -/* +/** * stores the respective UI pointer */ class CustTabButton : public Fl_Button { @@ -102,7 +104,7 @@ static int btn_cmp(const void *p1, const void *p2) (*(CustTabButton * const *)p2)->focus_num() ); } -/* +/** * Allows fine control of the tabbed interface */ class CustTabs : public Fl_Group { @@ -182,7 +184,7 @@ public: void set_tab_label(UI *ui, const char *title); }; -/* +/** * Callback for mouse click */ static void tab_btn_cb (Fl_Widget *w, void *cb_data) @@ -200,7 +202,7 @@ static void tab_btn_cb (Fl_Widget *w, void *cb_data) } } -/* +/** * Callback for the close-tab button */ static void close_tab_btn_cb (Fl_Widget *, void *cb_data) @@ -263,7 +265,7 @@ int CustTabs::handle(int e) return (ret) ? ret : Fl_Group::handle(e); } -/* +/** * Create a new tab with its own UI */ UI *CustTabs::add_new_tab(UI *old_ui, int focus) @@ -320,7 +322,7 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus) return new_ui; } -/* +/** * Remove tab by UI */ void CustTabs::remove_tab(UI *ui) @@ -377,8 +379,8 @@ int CustTabs::get_btn_idx(UI *ui) return -1; } -/* - * Keep active tab visible +/** + * Keep active tab visible. * (Pack children have unusable x() coordinate) */ void CustTabs::update_pack_offset() @@ -410,8 +412,8 @@ void CustTabs::update_pack_offset() _MSG(" >>scr_x=%d btn0_x=%d\n", scr_x, Pack->child(0)->x()); } -/* - * Make cbtn's tab the active one +/** + * Make cbtn's tab the active one. */ void CustTabs::switch_tab(CustTabButton *cbtn) { @@ -471,8 +473,8 @@ void CustTabs::next_tab() switch_tab((CustTabButton*)Pack->child((idx+1<num_tabs()) ? idx+1 : 0)); } -/* - * Set this UI's tab button label +/** + * Set this UI's tab button label. */ void CustTabs::set_tab_label(UI *ui, const char *label) { @@ -9,7 +9,7 @@ * (at your option) any later version. */ -/* +/** @file * Parse and normalize all URL's inside Dillo. * - <scheme> <authority> <path> <query> and <fragment> point to 'buffer'. * - 'url_string' is built upon demand (transparent to the caller). @@ -57,7 +57,7 @@ static const char *HEX = "0123456789ABCDEF"; #define URL_STR_FIELD_I_CMP(s1,s2) \ (s1) && (s2) ? dStrAsciiCasecmp(s1,s2) : !(s1) && !(s2) ? 0 : (s1) ? 1 : -1 -/* +/** * Return the url as a string. * (initializing 'url_string' field if necessary) */ @@ -88,7 +88,7 @@ char *a_Url_str(const DilloUrl *u) return url->url_string->str; } -/* +/** * Return the hostname as a string. * (initializing 'hostname' and 'port' fields if necessary) * Note: a similar approach can be taken for user:password auth. @@ -128,7 +128,7 @@ const char *a_Url_hostname(const DilloUrl *u) return url->hostname; } -/* +/** * Create a DilloUrl object and initialize it. * (buffer, scheme, authority, path, query and fragment). */ @@ -199,8 +199,8 @@ static DilloUrl *Url_object_new(const char *uri_str) return url; } -/* - * Free a DilloUrl +/** + * Free a DilloUrl. * Do nothing if the argument is NULL */ void a_Url_free(DilloUrl *url) @@ -216,7 +216,7 @@ void a_Url_free(DilloUrl *url) } } -/* +/** * Resolve the URL as RFC3986 suggests. */ static Dstr *Url_resolve_relative(const char *RelStr, @@ -344,10 +344,11 @@ done: return SolvedUrl; } -/* +/** * Transform (and resolve) an URL string into the respective DilloURL. * If URL = "http://dillo.sf.net:8080/index.html?long#part2" * then the resulting DilloURL should be: + * @code * DilloURL = { * url_string = "http://dillo.sf.net:8080/index.html?long#part2" * scheme = "http" @@ -361,6 +362,7 @@ done: * data = Dstr * ("") * ismap_url_len = 0 * } + * @endcode * * Return NULL if URL is badly formed. */ @@ -451,7 +453,7 @@ DilloUrl* a_Url_new(const char *url_str, const char *base_url) } -/* +/** * Duplicate a Url structure */ DilloUrl* a_Url_dup(const DilloUrl *ori) @@ -472,7 +474,7 @@ DilloUrl* a_Url_dup(const DilloUrl *ori) return url; } -/* +/** * Compare two Url's to check if they're the same, or which one is bigger. * * The fields which are compared here are: @@ -501,7 +503,7 @@ int a_Url_cmp(const DilloUrl *A, const DilloUrl *B) return st; } -/* +/** * Set DilloUrl flags */ void a_Url_set_flags(DilloUrl *u, int flags) @@ -510,7 +512,7 @@ void a_Url_set_flags(DilloUrl *u, int flags) u->flags = flags; } -/* +/** * Set DilloUrl data (like POST info, etc.) */ void a_Url_set_data(DilloUrl *u, Dstr **data) @@ -522,8 +524,8 @@ void a_Url_set_data(DilloUrl *u, Dstr **data) } } -/* - * Set DilloUrl ismap coordinates +/** + * Set DilloUrl ismap coordinates. * (this is optimized for not hogging the CPU) */ void a_Url_set_ismap_coords(DilloUrl *u, char *coord_str) @@ -541,7 +543,7 @@ void a_Url_set_ismap_coords(DilloUrl *u, char *coord_str) } } -/* +/** * Given an hex octet (e.g., e3, 2F, 20), return the corresponding * character if the octet is valid, and -1 otherwise */ @@ -559,7 +561,7 @@ static int Url_decode_hex_octet(const char *s) return -1; } -/* +/** * Parse possible hexadecimal octets in the URI path. * Returns a new allocated string. */ @@ -587,8 +589,8 @@ char *a_Url_decode_hex_str(const char *str) return new_str; } -/* - * Urlencode 'str' +/** + * Urlencode 'str'. * -RL :: According to the RFC 1738, only alphanumerics, the special * characters "$-_.+!*'(),", and reserved characters ";/?:@=&" used * for their *reserved purposes* may be used unencoded within a URL. @@ -630,7 +632,7 @@ char *a_Url_encode_hex_str(const char *str) } -/* +/** * RFC-3986 suggests this stripping when "importing" URLs from other media. * Strip: "URL:", enclosing < >, and embedded whitespace. * (We also strip illegal chars: 00-1F and 7F-FF) @@ -657,7 +659,7 @@ char *a_Url_string_strip_delimiters(const char *str) return new_str; } -/* +/** * What type of host is this? */ int a_Url_host_type(const char *host) @@ -680,8 +682,8 @@ int a_Url_host_type(const char *host) return URL_HOST_NAME; } -/* - * How many internal dots are in the public portion of this hostname? +/** + * How many internal dots are in the public portion of this hostname?. * e.g., for "www.dillo.org", it is one because everything under "dillo.org", * as a .org domain, is part of one organization. * @@ -734,8 +736,8 @@ static uint_t Url_host_public_internal_dots(const char *host) return ret; } -/* - * Given a URL host string, return the portion that is public, i.e., the +/** + * Given a URL host string, return the portion that is public. i.e., the * domain that is in a registry outside the organization. * For 'www.dillo.org', that would be 'dillo.org'. */ @@ -3,6 +3,9 @@ * * Copyright (C) 2001 Jorge Arellano Cid <jcid@dillo.org> * + */ + +/** @file * Parse and normalize all URL's inside Dillo. */ @@ -93,10 +96,10 @@ typedef struct { const char *hostname; /**/ int port; int flags; - Dstr *data; /* POST */ - int ismap_url_len; /* Used by server side image maps */ - int illegal_chars; /* number of illegal chars */ - int illegal_chars_spc; /* number of illegal space chars */ + Dstr *data; /**< POST */ + int ismap_url_len; /**< Used by server side image maps */ + int illegal_chars; /**< number of illegal chars */ + int illegal_chars_spc; /**< number of illegal space chars */ } DilloUrl; diff --git a/src/utf8.cc b/src/utf8.cc index 3d25f4f5..71b4159d 100644 --- a/src/utf8.cc +++ b/src/utf8.cc @@ -16,7 +16,7 @@ // C++ functions with C linkage ---------------------------------------------- -/* +/** * Return index of the last byte of the UTF-8-encoded character that str + i * points to or into. */ @@ -36,7 +36,7 @@ uint_t a_Utf8_end_of_char(const char *str, uint_t i) return i; } -/* +/** * Decode a single UTF-8-encoded character starting at p. * The resulting Unicode value (in the range 0-0x10ffff) is returned, * and len is set to the number of bytes in the UTF-8 encoding. @@ -48,7 +48,7 @@ uint_t a_Utf8_decode(const char* str, const char* end, int* len) return fl_utf8decode(str, end, len); } -/* +/** * Write UTF-8 encoding of ucs into buf and return number of bytes written. */ int a_Utf8_encode(unsigned int ucs, char *buf) @@ -56,7 +56,7 @@ int a_Utf8_encode(unsigned int ucs, char *buf) return fl_utf8encode(ucs, buf); } -/* +/** * Examine first srclen bytes of src. * Return 0 if not legal UTF-8, 1 if all ASCII, 2 if all below 0x800, * 3 if all below 0x10000, and 4 otherwise. @@ -66,8 +66,8 @@ int a_Utf8_test(const char* src, unsigned int srclen) return fl_utf8test(src, srclen); } -/* - * Does s point to a UTF-8-encoded ideographic character? +/** + * Does s point to a UTF-8-encoded ideographic character?. * * This is based on http://unicode.org/reports/tr14/#ID plus some guesses * for what might make the most sense for Dillo. Surprisingly, they include diff --git a/src/utf8.hh b/src/utf8.hh index ce575118..3348ba6e 100644 --- a/src/utf8.hh +++ b/src/utf8.hh @@ -8,14 +8,14 @@ extern "C" { #include "d_size.h" -/* - * Unicode replacement character U+FFFD +/** + * Unicode replacement character U+FFFD. * "used to replace an incoming character whose value is unknown or otherwise * unrepresentable in Unicode" */ static const char utf8_replacement_char[] = "\xEF\xBF\xBD"; -/* Unicode zero width space U+200B */ +/** Unicode zero width space U+200B */ static const char utf8_zero_width_space[] = "\xE2\x80\x8B"; uint_t a_Utf8_end_of_char(const char *str, uint_t i); @@ -39,7 +39,7 @@ void a_Web_init(void) ValidWebs = dList_new(32); } -/* +/** * Given the MIME content type, and a fd to read it from, * this function connects the proper MIME viewer to it. * Return value: @@ -113,7 +113,7 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, } -/* +/** * Allocate and set safe values for a DilloWeb structure */ DilloWeb* a_Web_new(BrowserWindow *bw, const DilloUrl *url, @@ -136,7 +136,7 @@ DilloWeb* a_Web_new(BrowserWindow *bw, const DilloUrl *url, return web; } -/* +/** * Validate a DilloWeb pointer */ int a_Web_valid(DilloWeb *web) @@ -144,7 +144,7 @@ int a_Web_valid(DilloWeb *web) return (dList_find(ValidWebs, web) != NULL); } -/* +/** * Deallocate a DilloWeb structure */ void a_Web_free(DilloWeb *web) @@ -22,16 +22,16 @@ extern "C" { typedef struct _DilloWeb DilloWeb; struct _DilloWeb { - DilloUrl *url; /* Requested URL */ - DilloUrl *requester; /* URL that caused this request, or - * NULL if user-initiated. */ - BrowserWindow *bw; /* The requesting browser window [reference] */ - int flags; /* Additional info */ + DilloUrl *url; /**< Requested URL */ + DilloUrl *requester; /**< URL that caused this request, or + **< NULL if user-initiated. */ + BrowserWindow *bw; /**< The requesting browser window [reference] */ + int flags; /**< Additional info */ - DilloImage *Image; /* For image urls [reference] */ + DilloImage *Image; /**< For image urls [reference] */ - int32_t bgColor; /* for image backgrounds */ - char *filename; /* Variables for Local saving */ + int32_t bgColor; /**< for image backgrounds */ + char *filename; /**< Variables for Local saving */ FILE *stream; int SavedBytes; }; |