Commit a49aedb9 authored by Pekka Pessi's avatar Pekka Pessi

su: updated some documentation.

darcs-hash:20060914132914-65a35-722564ba83d702dc19ca69033217e3236d342ad9.gz
parent 30330bc8
......@@ -30,6 +30,14 @@
#ifndef SU_ADDRINFO_H
/* Defined when <sofia-sip/su_addrinfo.h> has been included */
#define SU_ADDRINFO_H
/**@ingroup su_socket
*
* @file sofia-sip/su_addrinfo.h Network address and service translation.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Nov 30 17:07:04 EET 2005 ppessi
*/
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
......
......@@ -139,7 +139,7 @@ typedef struct su_root_s su_root_t;
/**Default type of application context for <a href="#su_root_t">su_root_t</a>.
*
* Application may define the typedef ::su_root_magic_t to appropriate type
* by defining macro #SU_ROOT_MAGIC_T before including <su_wait.h>, for
* by defining macro SU_ROOT_MAGIC_T before including <su_wait.h>, for
* example,
* @code
* #define SU_ROOT_MAGIC_T struct context
......@@ -152,7 +152,7 @@ typedef struct su_root_s su_root_t;
/** <a href="#su_root_t">Root context</a> pointer type.
*
* Application may define the typedef ::su_root_magic_t to appropriate type
* by defining macro #SU_ROOT_MAGIC_T before including <su_wait.h>, for
* by defining macro SU_ROOT_MAGIC_T () before including <su_wait.h>, for
* example,
* @code
* #define SU_ROOT_MAGIC_T struct context
......@@ -166,7 +166,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
* @link ::su_wakeup_arg_t argument type @endlink.
*
* The application can define the typedef ::su_wakeup_arg_t by defining
* the #SU_WAKEUP_ARG_T before including <su_wait.h>, for example,
* the SU_WAKEUP_ARG_T () before including <su_wait.h>, for example,
* @code
* #define SU_WAKEUP_ARG_T struct transport
* #include <su_wait.h>
......@@ -178,7 +178,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
/** @link ::su_wakeup_f Wakeup callback @endlink argument type.
*
* The application can define the typedef ::su_wakeup_arg_t by defining
* the #SU_WAKEUP_ARG_T before including <su_wait.h>, for example,
* the SU_WAKEUP_ARG_T () before including <su_wait.h>, for example,
* @code
* #define SU_WAKEUP_ARG_T struct transport
* #include <su_wait.h>
......
......@@ -47,10 +47,10 @@
#endif
struct bw_fwd_table {
unsigned char table[UCHAR_MAX];
unsigned char table[UCHAR_MAX + 1];
};
/** Build forward skip table for Boyer-Moore algorithm */
/** Build forward skip table #bm_fwd_table_t for Boyer-Moore algorithm. */
static
bm_fwd_table_t *
bm_memmem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
......@@ -62,17 +62,37 @@ bm_memmem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
nlen = UCHAR_MAX;
}
for (i = 0; i < UCHAR_MAX; i++)
fwd->table[i] = (unsigned char)nlen;
memset(fwd->table[i], (unsigned char)nlen, sizeof fwd->table);
for (i = 0; i < nlen; i++) {
fwd->table[(unsigned int)needle[i]] = (unsigned char)(nlen - i - 1);
fwd->table[(unsigned short)needle[i]] = (unsigned char)(nlen - i - 1);
}
return fwd;
}
/** Build forward skip table for Boyer-Moore algorithm */
/** @defgroup su_bm Fast string searching with Boyer-Moore algorithm
*
* The Boyer-Moore algorithm is used to implement fast substring search. The
* algorithm has some overhead caused by filling a table. Substring search
* then requires at most 1 / substring-length less string comparisons. On
* modern desktop hardware, Boyer-Moore algorithm is seldom faster than the
* naive implementation if the searched substring is shorter than the cache
* line.
*
*/
/**@ingroup su_bm
* @typedef struct bw_fwd_table bm_fwd_table_t;
*
* Forward skip table for Boyer-Moore algorithm.
*
*/
/** Build case-sensitive forward skip table #bm_fwd_table_t
* for Boyer-Moore algorithm.
* @ingroup su_bm
*/
bm_fwd_table_t *
bm_memmem_study(char const *needle, size_t nlen)
{
......@@ -84,7 +104,9 @@ bm_memmem_study(char const *needle, size_t nlen)
return fwd;
}
/** Search for a substring using Boyer-Moore algorithm. */
/** Search for a substring using Boyer-Moore algorithm.
* @ingroup su_bm
*/
char const*
bm_memmem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
......@@ -167,7 +189,9 @@ bm_memcasemem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
return fwd;
}
/** Build forward skip table for Boyer-Moore algorithm */
/** Build case-insensitive forward skip table for Boyer-Moore algorithm.
* @ingroup su_bm
*/
bm_fwd_table_t *
bm_memcasemem_study(char const *needle, size_t nlen)
{
......@@ -179,11 +203,13 @@ bm_memcasemem_study(char const *needle, size_t nlen)
return fwd;
}
/** Search for substring using Boyer-Moore algorithm. */
/** Search for substring using Boyer-Moore algorithm.
* @ingroup su_bm
*/
char const*
bm_memcasemem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
bm_fwd_table_t *fwd)
char const *needle, size_t nlen,
bm_fwd_table_t *fwd)
{
size_t i, j;
bm_fwd_table_t fwd0[1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment