mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Doxygen: @relates
This commit is contained in:
parent
b70aa312d0
commit
54dfa64c04
@ -36,6 +36,7 @@ free_history(LIST_OF(struct location) *history)
|
||||
}
|
||||
|
||||
|
||||
/** @relates ses_history */
|
||||
void
|
||||
create_history(struct ses_history *history)
|
||||
{
|
||||
@ -43,6 +44,7 @@ create_history(struct ses_history *history)
|
||||
history->current = NULL;
|
||||
}
|
||||
|
||||
/** @relates ses_history */
|
||||
void
|
||||
destroy_history(struct ses_history *history)
|
||||
{
|
||||
@ -50,6 +52,7 @@ destroy_history(struct ses_history *history)
|
||||
history->current = NULL;
|
||||
}
|
||||
|
||||
/** @relates ses_history */
|
||||
void
|
||||
clean_unhistory(struct ses_history *history)
|
||||
{
|
||||
@ -63,6 +66,7 @@ clean_unhistory(struct ses_history *history)
|
||||
}
|
||||
}
|
||||
|
||||
/** @relates ses_history */
|
||||
void
|
||||
add_to_history(struct ses_history *history, struct location *loc)
|
||||
{
|
||||
@ -75,6 +79,7 @@ add_to_history(struct ses_history *history, struct location *loc)
|
||||
history->current = loc;
|
||||
}
|
||||
|
||||
/** @relates ses_history */
|
||||
void
|
||||
del_from_history(struct ses_history *history, struct location *loc)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "util/string.h"
|
||||
|
||||
|
||||
/** @relates location */
|
||||
void
|
||||
copy_location(struct location *dst, struct location *src)
|
||||
{
|
||||
|
@ -16,7 +16,8 @@ struct location {
|
||||
|
||||
void copy_location(struct location *, struct location *);
|
||||
|
||||
/** You probably want to call del_from_history() first! */
|
||||
/** You probably want to call del_from_history() first!
|
||||
* @relates location */
|
||||
void destroy_location(struct location *);
|
||||
|
||||
#endif
|
||||
|
@ -228,6 +228,7 @@ get_master_session(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @relates session */
|
||||
struct download *
|
||||
get_current_download(struct session *ses)
|
||||
{
|
||||
@ -849,6 +850,7 @@ setup_session(struct session *ses, struct uri *uri, struct session *base)
|
||||
}
|
||||
}
|
||||
|
||||
/** @relates session */
|
||||
struct session *
|
||||
init_session(struct session *base_session, struct terminal *term,
|
||||
struct uri *uri, int in_background)
|
||||
@ -1282,6 +1284,7 @@ tabwin_func(struct window *tab, struct term_event *ev)
|
||||
/**
|
||||
* Gets the url being viewed by this session. Writes it into @a str.
|
||||
* A maximum of @a str_size bytes (including null) will be written.
|
||||
* @relates session
|
||||
*/
|
||||
unsigned char *
|
||||
get_current_url(struct session *ses, unsigned char *str, size_t str_size)
|
||||
@ -1307,6 +1310,7 @@ get_current_url(struct session *ses, unsigned char *str, size_t str_size)
|
||||
/**
|
||||
* Gets the title of the page being viewed by this session. Writes it into
|
||||
* @a str. A maximum of @a str_size bytes (including null) will be written.
|
||||
* @relates session
|
||||
*/
|
||||
unsigned char *
|
||||
get_current_title(struct session *ses, unsigned char *str, size_t str_size)
|
||||
@ -1326,6 +1330,7 @@ get_current_title(struct session *ses, unsigned char *str, size_t str_size)
|
||||
/**
|
||||
* Gets the url of the link currently selected. Writes it into @a str.
|
||||
* A maximum of @a str_size bytes (including null) will be written.
|
||||
* @relates session
|
||||
*/
|
||||
unsigned char *
|
||||
get_current_link_url(struct session *ses, unsigned char *str, size_t str_size)
|
||||
@ -1341,7 +1346,8 @@ get_current_link_url(struct session *ses, unsigned char *str, size_t str_size)
|
||||
|
||||
/** get_current_link_name: returns the name of the current link
|
||||
* (the text between <A> and </A>), @a str is a preallocated string,
|
||||
* @a str_size includes the null char. */
|
||||
* @a str_size includes the null char.
|
||||
* @relates session */
|
||||
unsigned char *
|
||||
get_current_link_name(struct session *ses, unsigned char *str, size_t str_size)
|
||||
{
|
||||
@ -1375,12 +1381,14 @@ get_current_link_in_view(struct document_view *doc_view)
|
||||
return link && !link_is_form(link) ? link : NULL;
|
||||
}
|
||||
|
||||
/** @relates session */
|
||||
struct link *
|
||||
get_current_session_link(struct session *ses)
|
||||
{
|
||||
return get_current_link_in_view(current_frame(ses));
|
||||
}
|
||||
|
||||
/** @relates session */
|
||||
int
|
||||
eat_kbd_repeat_count(struct session *ses)
|
||||
{
|
||||
|
@ -213,14 +213,16 @@ extern enum remote_session_flags remote_session_flags;
|
||||
* That's nice for encapsulation and already paid out once ;-). */
|
||||
#define cur_loc(x) ((x)->history.current)
|
||||
|
||||
/** Return if we have anything being loaded in this session already. */
|
||||
/** Return if we have anything being loaded in this session already.
|
||||
* @relates session */
|
||||
static inline int
|
||||
have_location(struct session *ses) {
|
||||
return !!cur_loc(ses);
|
||||
}
|
||||
|
||||
/** Swaps the current session referrer with the new one passed as @a referrer.
|
||||
* @a referrer may be NULL. */
|
||||
* @a referrer may be NULL.
|
||||
* @relates session */
|
||||
void set_session_referrer(struct session *ses, struct uri *referrer);
|
||||
|
||||
void
|
||||
@ -258,7 +260,8 @@ void free_files(struct session *);
|
||||
void display_timer(struct session *ses);
|
||||
|
||||
/** session_is_loading() is like !!get_current_download() but doesn't take
|
||||
* session.req_sent into account. */
|
||||
* session.req_sent into account.
|
||||
* @relates session */
|
||||
int session_is_loading(struct session *ses);
|
||||
struct download *get_current_download(struct session *ses);
|
||||
|
||||
|
@ -13,14 +13,17 @@ struct bitfield {
|
||||
unsigned char bits[1]; /**< Strawberry bitfields forever. */
|
||||
};
|
||||
|
||||
/** @relates bitfield */
|
||||
#define foreach_bitfield_set(bit, bitfield) \
|
||||
for ((bit) = 0; (bit) < (bitfield)->bitsize; (bit)++) \
|
||||
if (test_bitfield_bit(bitfield, bit))
|
||||
|
||||
/** @relates bitfield */
|
||||
#define foreachback_bitfield_set(bit, bitfield) \
|
||||
for ((bit) = (bitfield)->bitsize; (bit) > 0;) \
|
||||
if (test_bitfield_bit(bitfield, --bit))
|
||||
|
||||
/** @relates bitfield */
|
||||
#define foreach_bitfield_cleared(bit, bitfield) \
|
||||
for ((bit) = 0; (bit) < (bitfield)->bitsize; (bit)++) \
|
||||
if (!test_bitfield_bit(bitfield, bit))
|
||||
@ -32,7 +35,8 @@ struct bitfield {
|
||||
/* +7 to round up to nearest byte. */
|
||||
#define get_bitfield_byte_size(bits) ((size_t) (((bits) + 7) / 8))
|
||||
|
||||
/** Allocate a bitfield containing @a bits number of bits. */
|
||||
/** Allocate a bitfield containing @a bits number of bits.
|
||||
* @relates bitfield */
|
||||
static inline struct bitfield *
|
||||
init_bitfield(size_t bits)
|
||||
{
|
||||
@ -45,7 +49,9 @@ init_bitfield(size_t bits)
|
||||
return bitfield;
|
||||
}
|
||||
|
||||
/** Update @a bitfield with the @a bytesize bytes from the bit string in @a bits. */
|
||||
/** Update @a bitfield with the @a bytesize bytes from the bit string
|
||||
* in @a bits.
|
||||
* @relates bitfield */
|
||||
static inline void
|
||||
copy_bitfield(struct bitfield *bitfield,
|
||||
const unsigned char *bits, unsigned int bytesize)
|
||||
@ -55,7 +61,8 @@ copy_bitfield(struct bitfield *bitfield,
|
||||
memcpy(bitfield->bits, bits, bytesize);
|
||||
}
|
||||
|
||||
/** Test whether @a bit is set in the @a bitfield. */
|
||||
/** Test whether @a bit is set in the @a bitfield.
|
||||
* @relates bitfield */
|
||||
static inline int
|
||||
test_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
{
|
||||
@ -70,7 +77,8 @@ test_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
return !!(bitfield->bits[byte_offset] & bit_offset);
|
||||
}
|
||||
|
||||
/** Set @a bit in the @a bitfield. */
|
||||
/** Set @a bit in the @a bitfield.
|
||||
* @relates bitfield */
|
||||
static inline void
|
||||
set_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
{
|
||||
@ -85,7 +93,8 @@ set_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
bitfield->bits[byte_offset] |= bit_offset;
|
||||
}
|
||||
|
||||
/** Unset @a bit in the @a bitfield. */
|
||||
/** Unset @a bit in the @a bitfield.
|
||||
* @relates bitfield */
|
||||
static inline void
|
||||
clear_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
{
|
||||
@ -100,7 +109,8 @@ clear_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
|
||||
bitfield->bits[byte_offset] &= ~bit_offset;
|
||||
}
|
||||
|
||||
/** Count the set bits in @a bitfield. */
|
||||
/** Count the set bits in @a bitfield.
|
||||
* @relates bitfield */
|
||||
static inline unsigned int
|
||||
get_bitfield_set_count(struct bitfield *bitfield)
|
||||
{
|
||||
@ -112,7 +122,8 @@ get_bitfield_set_count(struct bitfield *bitfield)
|
||||
return count;
|
||||
}
|
||||
|
||||
/** Count the unset bits in @a bitfield. */
|
||||
/** Count the unset bits in @a bitfield.
|
||||
* @relates bitfield */
|
||||
static inline unsigned int
|
||||
get_bitfield_cleared_count(struct bitfield *bitfield)
|
||||
{
|
||||
@ -124,7 +135,8 @@ get_bitfield_cleared_count(struct bitfield *bitfield)
|
||||
return count;
|
||||
}
|
||||
|
||||
/** Check whether all bits of @a bitfield are set. */
|
||||
/** Check whether all bits of @a bitfield are set.
|
||||
* @relates bitfield */
|
||||
static inline unsigned int
|
||||
bitfield_is_set(struct bitfield *bitfield)
|
||||
{
|
||||
@ -136,7 +148,8 @@ bitfield_is_set(struct bitfield *bitfield)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Check whether all bits of @a bitfield are unset. */
|
||||
/** Check whether all bits of @a bitfield are unset.
|
||||
* @relates bitfield */
|
||||
static inline unsigned int
|
||||
bitfield_is_cleared(struct bitfield *bitfield)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ struct box {
|
||||
int height;
|
||||
};
|
||||
|
||||
/** @relates box */
|
||||
static inline int
|
||||
is_in_box(struct box *box, int x, int y)
|
||||
{
|
||||
@ -17,12 +18,14 @@ is_in_box(struct box *box, int x, int y)
|
||||
&& y < box->y + box->height);
|
||||
}
|
||||
|
||||
/** @relates box */
|
||||
static inline int
|
||||
row_is_in_box(struct box *box, int y)
|
||||
{
|
||||
return (y >= box->y && y < box->y + box->height);
|
||||
}
|
||||
|
||||
/** @relates box */
|
||||
static inline int
|
||||
col_is_in_box(struct box *box, int x)
|
||||
{
|
||||
@ -30,7 +33,8 @@ col_is_in_box(struct box *box, int x)
|
||||
}
|
||||
|
||||
/** Check whether a span of columns is in @a box.
|
||||
* Mainly intended for use with double-width characters. */
|
||||
* Mainly intended for use with double-width characters.
|
||||
* @relates box */
|
||||
static inline int
|
||||
colspan_is_in_box(struct box *box, int x, int span)
|
||||
{
|
||||
@ -38,6 +42,7 @@ colspan_is_in_box(struct box *box, int x, int span)
|
||||
}
|
||||
|
||||
|
||||
/** @relates box */
|
||||
static inline void
|
||||
set_box(struct box *box, int x, int y, int width, int height)
|
||||
{
|
||||
@ -47,6 +52,7 @@ set_box(struct box *box, int x, int y, int width, int height)
|
||||
box->height = height;
|
||||
}
|
||||
|
||||
/** @relates box */
|
||||
static inline void
|
||||
copy_box(struct box *dst, struct box *src)
|
||||
{
|
||||
|
@ -127,6 +127,7 @@ elinks_longcat(unsigned char *s, unsigned int *slen,
|
||||
}
|
||||
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_long_to_string(struct string *string, long number)
|
||||
{
|
||||
@ -143,6 +144,7 @@ add_long_to_string(struct string *string, long number)
|
||||
return add_bytes_to_string(string, buffer, length);
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_knum_to_string(struct string *string, long num)
|
||||
{
|
||||
@ -169,6 +171,7 @@ add_knum_to_string(struct string *string, long num)
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_xnum_to_string(struct string *string, off_t xnum)
|
||||
{
|
||||
@ -202,6 +205,7 @@ add_xnum_to_string(struct string *string, off_t xnum)
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_duration_to_string(struct string *string, long seconds)
|
||||
{
|
||||
@ -236,6 +240,7 @@ add_duration_to_string(struct string *string, long seconds)
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_timeval_to_string(struct string *string, timeval_T *timeval)
|
||||
{
|
||||
|
@ -53,7 +53,8 @@ struct string *add_timeval_to_string(struct string *string, timeval_T *timeval);
|
||||
#ifdef HAVE_STRFTIME
|
||||
/** Uses strftime() to format @a time according to @a format and adds
|
||||
* the result to @a string. If @a time is NULL, time(NULL) will be
|
||||
* used. */
|
||||
* used.
|
||||
* @relates string */
|
||||
struct string *add_date_to_string(struct string *string,
|
||||
const unsigned char *format,
|
||||
const time_t *time);
|
||||
@ -67,16 +68,19 @@ struct string *add_date_to_string(struct string *string,
|
||||
* @{ */
|
||||
|
||||
/** A simple generic encoder. Should maybe take @a replaceable as a
|
||||
* string so we could also use it for adding shell safe strings. */
|
||||
* string so we could also use it for adding shell safe strings.
|
||||
* @relates string */
|
||||
struct string *
|
||||
add_string_replace(struct string *string, unsigned char *src, int len,
|
||||
unsigned char replaceable, unsigned char replacement);
|
||||
|
||||
/** @relates string */
|
||||
#define add_optname_to_string(str, src, len) \
|
||||
add_string_replace(str, src, len, '.', '*')
|
||||
|
||||
/** Maybe a bad name but it is actually the real name, but you may
|
||||
* also think of it as adding the decoded option name. */
|
||||
* also think of it as adding the decoded option name.
|
||||
* @relates string */
|
||||
#define add_real_optname_to_string(str, src, len) \
|
||||
add_string_replace(str, src, len, '*', '.')
|
||||
|
||||
@ -85,24 +89,29 @@ add_string_replace(struct string *string, unsigned char *src, int len,
|
||||
* resulting HTML will be parsed with the same charset as the original
|
||||
* string. (This function cannot use the @&@#160; syntax for non-ASCII,
|
||||
* because HTML wants Unicode numbers there and this function does not
|
||||
* know the charset of the input data.) */
|
||||
* know the charset of the input data.)
|
||||
* @relates string */
|
||||
struct string *add_html_to_string(struct string *string, const unsigned char *html, int htmllen);
|
||||
|
||||
/** Convert reserved or non-ASCII chars to html @&@#xx;. The resulting
|
||||
* string can be correctly parsed in any charset where bytes
|
||||
* 0x20...0x7E match ASCII. */
|
||||
* 0x20...0x7E match ASCII.
|
||||
* @relates string */
|
||||
struct string *add_cp_html_to_string(struct string *string, int src_codepage,
|
||||
const unsigned char *html, int htmllen);
|
||||
|
||||
/** Escapes @\ and " with a @\ */
|
||||
/** Escapes @\ and " with a @\
|
||||
* @relates string */
|
||||
struct string *add_quoted_to_string(struct string *string, const unsigned char *q, int qlen);
|
||||
|
||||
/** Adds ', @a len bytes of @a src with all single-quotes converted to '\'',
|
||||
* and ' to @a string. */
|
||||
* and ' to @a string.
|
||||
* @relates string */
|
||||
struct string *add_shell_quoted_to_string(struct string *string,
|
||||
unsigned char *src, int len);
|
||||
|
||||
/* Escapes non shell safe chars with '_'. */
|
||||
/* Escapes non shell safe chars with '_'.
|
||||
* @relates string */
|
||||
struct string *add_shell_safe_to_string(struct string *string, unsigned char *cmd, int cmdlen);
|
||||
|
||||
/** @} */
|
||||
|
@ -41,16 +41,19 @@ struct fastfind_index {
|
||||
* @param flags control case sensitivity, compression
|
||||
*
|
||||
* This function must be called once and only once per list.
|
||||
* Failure is not an option, so call it at startup. */
|
||||
* Failure is not an option, so call it at startup.
|
||||
* @relates fastfind_index */
|
||||
struct fastfind_index *fastfind_index(struct fastfind_index *index, enum fastfind_flags flags);
|
||||
|
||||
/* The main reason of all that stuff is here. */
|
||||
/** Search the index for @a key with length @a key_len using the
|
||||
* @a index' handle created with fastfind_index(). */
|
||||
* @a index' handle created with fastfind_index().
|
||||
* @relates fastfind_index */
|
||||
void *fastfind_search(struct fastfind_index *index, unsigned char *key, int key_len);
|
||||
|
||||
/** Fastfind cleanup. It frees the given @a index.
|
||||
* Must be called once per list. */
|
||||
* Must be called once per list.
|
||||
* @relates fastfind_index */
|
||||
void fastfind_done(struct fastfind_index *index);
|
||||
|
||||
#endif
|
||||
|
@ -51,12 +51,14 @@ init_hash(unsigned int width, hash_func_T func)
|
||||
return hash;
|
||||
}
|
||||
|
||||
/** @relates hash */
|
||||
struct hash *
|
||||
init_hash8(void)
|
||||
{
|
||||
return init_hash(8, &strhash);
|
||||
}
|
||||
|
||||
/** @relates hash */
|
||||
void
|
||||
free_hash(struct hash **hashp)
|
||||
{
|
||||
@ -77,7 +79,8 @@ free_hash(struct hash **hashp)
|
||||
* anyway.. ;) --pasky */
|
||||
#define HASH_MAGIC 0xdeadbeef
|
||||
|
||||
/** @returns hash_item if ok, NULL if error. */
|
||||
/** @returns hash_item if ok, NULL if error.
|
||||
* @relates hash */
|
||||
struct hash_item *
|
||||
add_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen,
|
||||
void *value)
|
||||
@ -98,6 +101,7 @@ add_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen,
|
||||
return item;
|
||||
}
|
||||
|
||||
/** @relates hash */
|
||||
struct hash_item *
|
||||
get_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen)
|
||||
{
|
||||
@ -127,7 +131,8 @@ get_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen)
|
||||
|
||||
/** Delete @a item from @a hash.
|
||||
* If key and/or value were dynamically allocated, think about freeing them.
|
||||
* This function doesn't do that. */
|
||||
* This function doesn't do that.
|
||||
* @relates hash */
|
||||
void
|
||||
del_hash_item(struct hash *hash, struct hash_item *item)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ struct hash_item *add_hash_item(struct hash *hash, unsigned char *key, unsigned
|
||||
struct hash_item *get_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen);
|
||||
void del_hash_item(struct hash *hash, struct hash_item *item);
|
||||
|
||||
/** @relates hash */
|
||||
#define foreach_hash_item(item, hash_table, iterator) \
|
||||
for (iterator = 0; iterator < (1 << (hash_table).width); iterator++) \
|
||||
foreach (item, (hash_table).hash[iterator])
|
||||
|
@ -44,7 +44,8 @@ reverse_md5_bytes(unsigned char *buf, unsigned int longs)
|
||||
}
|
||||
|
||||
/** Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants. */
|
||||
* initialization constants.
|
||||
* @relates md5_context */
|
||||
void
|
||||
init_md5(struct md5_context *ctx)
|
||||
{
|
||||
@ -58,7 +59,8 @@ init_md5(struct md5_context *ctx)
|
||||
}
|
||||
|
||||
/** Update context to reflect the concatenation of another buffer full
|
||||
* of bytes. */
|
||||
* of bytes.
|
||||
* @relates md5_context */
|
||||
void
|
||||
update_md5(struct md5_context *ctx, const unsigned char *buf, unsigned long len)
|
||||
{
|
||||
@ -106,7 +108,8 @@ update_md5(struct md5_context *ctx, const unsigned char *buf, unsigned long len)
|
||||
}
|
||||
|
||||
/** Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit
|
||||
* count of bits processed, MSB-first) */
|
||||
* count of bits processed, MSB-first)
|
||||
* @relates md5_context */
|
||||
void
|
||||
done_md5(struct md5_context *ctx, md5_digest_bin_T digest)
|
||||
{
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
/** Create a memory list. If @a p is NULL or allocation fails, it will
|
||||
* return NULL.
|
||||
* It always stops at first NULL element. */
|
||||
* It always stops at first NULL element.
|
||||
* @relates memory_list */
|
||||
#if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS)
|
||||
struct memory_list *
|
||||
debug_getml(unsigned char *file, int line, void *p, ...)
|
||||
@ -70,7 +71,8 @@ getml(void *p, ...)
|
||||
/** Add elements to a memory list.
|
||||
* If memory list exists, it enlarges it, else it creates it.
|
||||
* if there's no elements or first element is NULL, it does nothing.
|
||||
* It always stops at first NULL element. */
|
||||
* It always stops at first NULL element.
|
||||
* @relates memory_list */
|
||||
#if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS)
|
||||
void
|
||||
debug_add_to_ml(unsigned char *file, int line, struct memory_list **ml, ...)
|
||||
@ -124,6 +126,7 @@ add_to_ml(struct memory_list **ml, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/** @relates memory_list */
|
||||
#ifdef DEBUG_MEMLIST
|
||||
void
|
||||
debug_add_one_to_ml(unsigned char *file, int line, struct memory_list **ml, void *p)
|
||||
@ -164,7 +167,8 @@ add_one_to_ml(struct memory_list **ml, void *p)
|
||||
|
||||
|
||||
/** Free elements and memory list.
|
||||
* It returns safely if passed a NULL pointer. */
|
||||
* It returns safely if passed a NULL pointer.
|
||||
* @relates memory_list */
|
||||
void
|
||||
freeml(struct memory_list *ml)
|
||||
{
|
||||
|
@ -84,7 +84,8 @@ struct scanner_info {
|
||||
};
|
||||
|
||||
|
||||
/** Initializes the scanner. */
|
||||
/** Initializes the scanner.
|
||||
* @relates scanner */
|
||||
void init_scanner(struct scanner *scanner, struct scanner_info *scanner_info,
|
||||
unsigned char *string, unsigned char *end);
|
||||
|
||||
@ -129,12 +130,14 @@ struct scanner {
|
||||
struct scanner_token table[SCANNER_TOKENS];
|
||||
};
|
||||
|
||||
/** @relates scanner */
|
||||
#define scanner_has_tokens(scanner) \
|
||||
((scanner)->tokens > 0 && (scanner)->current < (scanner)->table + (scanner)->tokens)
|
||||
|
||||
/** This macro checks if the current scanner state is valid. Meaning if the
|
||||
* scanners table is full the last token skipping or get_next_scanner_token()
|
||||
* call made it possible to get the type of the next token. */
|
||||
* call made it possible to get the type of the next token.
|
||||
* @relates scanner */
|
||||
#define check_scanner(scanner) \
|
||||
(scanner->tokens < SCANNER_TOKENS \
|
||||
|| scanner->current + 1 < scanner->table + scanner->tokens)
|
||||
@ -143,7 +146,8 @@ struct scanner {
|
||||
/** @name Scanner table accessors and mutators
|
||||
* @{ */
|
||||
|
||||
/** Checks the type of the next token */
|
||||
/** Checks the type of the next token
|
||||
* @relates scanner */
|
||||
#define check_next_scanner_token(scanner, token_type) \
|
||||
(scanner_has_tokens(scanner) \
|
||||
&& ((scanner)->current + 1 < (scanner)->table + (scanner)->tokens) \
|
||||
@ -151,14 +155,16 @@ struct scanner {
|
||||
|
||||
/** Access current and next token. Getting the next token might cause
|
||||
* a rescan so any token pointers that has been stored in a local variable
|
||||
* might not be valid after the call. */
|
||||
* might not be valid after the call.
|
||||
* @relates scanner */
|
||||
static inline struct scanner_token *
|
||||
get_scanner_token(struct scanner *scanner)
|
||||
{
|
||||
return scanner_has_tokens(scanner) ? scanner->current : NULL;
|
||||
}
|
||||
|
||||
/** Do a scanning if we do not have also have access to next token. */
|
||||
/** Do a scanning if we do not have also have access to next token.
|
||||
* @relates scanner */
|
||||
static inline struct scanner_token *
|
||||
get_next_scanner_token(struct scanner *scanner)
|
||||
{
|
||||
@ -167,30 +173,35 @@ get_next_scanner_token(struct scanner *scanner)
|
||||
? scanner->info->scan(scanner) : get_scanner_token(scanner));
|
||||
}
|
||||
|
||||
/** This should just make the code more understandable .. hopefully */
|
||||
/** This should just make the code more understandable .. hopefully
|
||||
* @relates scanner */
|
||||
#define skip_scanner_token(scanner) get_next_scanner_token(scanner)
|
||||
|
||||
/** Removes tokens from the scanner until it meets a token of the given type.
|
||||
* This token will then also be skipped. */
|
||||
* This token will then also be skipped.
|
||||
* @relates scanner */
|
||||
struct scanner_token *
|
||||
skip_scanner_tokens(struct scanner *scanner, int skipto, int precedence);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** Looks up the string from @a ident to @a end to in the scanners
|
||||
* string mapping table */
|
||||
* string mapping table
|
||||
* @relates scanner */
|
||||
int
|
||||
map_scanner_string(struct scanner *scanner,
|
||||
unsigned char *ident, unsigned char *end, int base_type);
|
||||
|
||||
#ifdef DEBUG_SCANNER
|
||||
/** @relates scanner */
|
||||
void dump_scanner(struct scanner *scanner);
|
||||
#endif
|
||||
|
||||
/* The begin_token_scanning() and end_token_scanning() functions provide the
|
||||
* basic setup and teardown for the rescan function made public via the
|
||||
* scanner_info->scan member.
|
||||
* @returns NULL if it is not necessary to try to scan for more tokens */
|
||||
* @returns NULL if it is not necessary to try to scan for more tokens
|
||||
* @relates scanner */
|
||||
static inline struct scanner_token *
|
||||
begin_token_scanning(struct scanner *scanner)
|
||||
{
|
||||
@ -228,7 +239,8 @@ begin_token_scanning(struct scanner *scanner)
|
||||
* _after_ the last valid token is taken as the @a end argument.
|
||||
*
|
||||
* It is ok for @a end to be < scanner->table since scanner->tokens
|
||||
* will become <= 0 anyway. */
|
||||
* will become <= 0 anyway.
|
||||
* @relates scanner */
|
||||
static inline struct scanner_token *
|
||||
end_token_scanning(struct scanner *scanner, struct scanner_token *end)
|
||||
{
|
||||
|
@ -201,6 +201,7 @@ end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* @relates secure_save_info */
|
||||
struct secure_save_info *
|
||||
secure_open(unsigned char *file_name)
|
||||
{
|
||||
@ -221,7 +222,8 @@ secure_open(unsigned char *file_name)
|
||||
}
|
||||
|
||||
/** Close a file opened with secure_open(). @returns 0 on success,
|
||||
* errno or -1 on failure. */
|
||||
* errno or -1 on failure.
|
||||
* @relates secure_save_info */
|
||||
int
|
||||
secure_close(struct secure_save_info *ssi)
|
||||
{
|
||||
@ -300,7 +302,8 @@ free:
|
||||
|
||||
|
||||
/** fputs() wrapper, set ssi->err to errno on error. If ssi->err is set when
|
||||
* called, it immediatly returns EOF. */
|
||||
* called, it immediatly returns EOF.
|
||||
* @relates secure_save_info */
|
||||
int
|
||||
secure_fputs(struct secure_save_info *ssi, const char *s)
|
||||
{
|
||||
@ -319,7 +322,8 @@ secure_fputs(struct secure_save_info *ssi, const char *s)
|
||||
|
||||
|
||||
/** fputc() wrapper, set ssi->err to errno on error. If ssi->err is set when
|
||||
* called, it immediatly returns EOF. */
|
||||
* called, it immediatly returns EOF.
|
||||
* @relates secure_save_info */
|
||||
int
|
||||
secure_fputc(struct secure_save_info *ssi, int c)
|
||||
{
|
||||
@ -337,7 +341,8 @@ secure_fputc(struct secure_save_info *ssi, int c)
|
||||
}
|
||||
|
||||
/** fprintf() wrapper, set ssi->err to errno on error and return a negative
|
||||
* value. If ssi->err is set when called, it immediatly returns -1. */
|
||||
* value. If ssi->err is set when called, it immediatly returns -1.
|
||||
* @relates secure_save_info */
|
||||
int
|
||||
secure_fprintf(struct secure_save_info *ssi, const char *format, ...)
|
||||
{
|
||||
|
@ -287,6 +287,7 @@ done_string(struct string *string)
|
||||
memset(string, 0, sizeof(*string));
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
inline struct string *
|
||||
add_to_string(struct string *string, const unsigned char *source)
|
||||
{
|
||||
@ -300,6 +301,7 @@ add_to_string(struct string *string, const unsigned char *source)
|
||||
return add_bytes_to_string(string, source, strlen(source));
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
inline struct string *
|
||||
add_crlf_to_string(struct string *string)
|
||||
{
|
||||
@ -318,6 +320,7 @@ add_crlf_to_string(struct string *string)
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
inline struct string *
|
||||
add_string_to_string(struct string *string, const struct string *from)
|
||||
{
|
||||
@ -332,6 +335,7 @@ add_string_to_string(struct string *string, const struct string *from)
|
||||
return add_bytes_to_string(string, from->source, from->length);
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
struct string *
|
||||
add_file_to_string(struct string *string, const unsigned char *filename)
|
||||
{
|
||||
@ -393,6 +397,7 @@ string_concat(struct string *string, ...)
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string */
|
||||
inline struct string *
|
||||
add_char_to_string(struct string *string, unsigned char character)
|
||||
{
|
||||
@ -494,6 +499,7 @@ add_to_string_list(LIST_OF(struct string_list_item) *list,
|
||||
return string;
|
||||
}
|
||||
|
||||
/** @relates string_list_item */
|
||||
void
|
||||
free_string_list(LIST_OF(struct string_list_item) *list)
|
||||
{
|
||||
|
@ -162,7 +162,8 @@ struct string {
|
||||
/** Initializes the passed string struct by preallocating the
|
||||
* string.source member.
|
||||
* @returns @a string if successful, or NULL if out of memory.
|
||||
* @post done_string(@a string) is safe, even if this returned NULL. */
|
||||
* @post done_string(@a string) is safe, even if this returned NULL.
|
||||
* @relates string */
|
||||
#ifdef DEBUG_MEMLEAK
|
||||
struct string *init_string__(const unsigned char *file, int line, struct string *string);
|
||||
#define init_string(string) init_string__(__FILE__, __LINE__, string)
|
||||
@ -170,7 +171,8 @@ struct string *init_string__(const unsigned char *file, int line, struct string
|
||||
struct string *init_string(struct string *string);
|
||||
#endif
|
||||
|
||||
/** Resets @a string and free()s the string.source member. */
|
||||
/** Resets @a string and free()s the string.source member.
|
||||
* @relates string */
|
||||
void done_string(struct string *string);
|
||||
|
||||
|
||||
@ -182,16 +184,20 @@ struct string *add_file_to_string(struct string *string, const unsigned char *fi
|
||||
struct string *add_crlf_to_string(struct string *string);
|
||||
|
||||
/** Adds each C string to @a string until a terminating
|
||||
* (unsigned char *) NULL is met. */
|
||||
* (unsigned char *) NULL is met.
|
||||
* @relates string */
|
||||
struct string *string_concat(struct string *string, ...);
|
||||
|
||||
/** Extends the string with @a times number of @a character. */
|
||||
/** Extends the string with @a times number of @a character.
|
||||
* @relates string */
|
||||
struct string *add_xchar_to_string(struct string *string, unsigned char character, int times);
|
||||
|
||||
/** Add printf()-style format string to @a string. */
|
||||
/** Add printf()-style format string to @a string.
|
||||
* @relates string */
|
||||
struct string *add_format_to_string(struct string *string, const unsigned char *format, ...);
|
||||
|
||||
/** Get a regular newly allocated stream of bytes from @a string. */
|
||||
/** Get a regular newly allocated stream of bytes from @a string.
|
||||
* @relates string */
|
||||
static unsigned char *squeezastring(struct string *string);
|
||||
|
||||
|
||||
@ -262,7 +268,8 @@ struct string_list_item {
|
||||
};
|
||||
|
||||
/** Adds @a string with @a length chars to the list. If @a length is -1
|
||||
* it will be set to the return value of strlen(). */
|
||||
* it will be set to the return value of strlen().
|
||||
* @relates string_list_item */
|
||||
struct string *
|
||||
add_to_string_list(LIST_OF(struct string_list_item) *list,
|
||||
const unsigned char *string, int length);
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
/** Get the current time.
|
||||
* It attempts to use available functions, granularity
|
||||
* may be as worse as 1 second if time() is used. */
|
||||
* may be as worse as 1 second if time() is used.
|
||||
* @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_now(timeval_T *t)
|
||||
{
|
||||
@ -47,7 +48,8 @@ timeval_now(timeval_T *t)
|
||||
}
|
||||
|
||||
/** Subtract an interval to a timeval, it ensures that
|
||||
* result is never negative. */
|
||||
* result is never negative.
|
||||
* @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_sub_interval(timeval_T *t, timeval_T *interval)
|
||||
{
|
||||
@ -73,6 +75,7 @@ timeval_sub_interval(timeval_T *t, timeval_T *interval)
|
||||
return t;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_sub(timeval_T *res, timeval_T *older, timeval_T *newer)
|
||||
{
|
||||
@ -87,6 +90,7 @@ timeval_sub(timeval_T *res, timeval_T *older, timeval_T *newer)
|
||||
return res;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_add(timeval_T *res, timeval_T *base, timeval_T *t)
|
||||
{
|
||||
@ -101,6 +105,7 @@ timeval_add(timeval_T *res, timeval_T *base, timeval_T *t)
|
||||
return res;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_add_interval(timeval_T *t, timeval_T *interval)
|
||||
{
|
||||
@ -115,6 +120,7 @@ timeval_add_interval(timeval_T *t, timeval_T *interval)
|
||||
return t;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_from_double(timeval_T *t, double x)
|
||||
{
|
||||
@ -124,6 +130,7 @@ timeval_from_double(timeval_T *t, double x)
|
||||
return t;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_from_milliseconds(timeval_T *t, milliseconds_T milliseconds)
|
||||
{
|
||||
@ -136,7 +143,8 @@ timeval_from_milliseconds(timeval_T *t, milliseconds_T milliseconds)
|
||||
}
|
||||
|
||||
/** @bug 923: Assumes time_t values fit in long. (This function is used
|
||||
* for both timestamps and durations.) */
|
||||
* for both timestamps and durations.)
|
||||
* @relates timeval_T */
|
||||
timeval_T *
|
||||
timeval_from_seconds(timeval_T *t, long seconds)
|
||||
{
|
||||
@ -178,6 +186,7 @@ mult_ms(milliseconds_T a, long lb)
|
||||
return (milliseconds_T) (la * lb);
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
milliseconds_T
|
||||
timeval_to_milliseconds(timeval_T *t)
|
||||
{
|
||||
@ -188,20 +197,23 @@ timeval_to_milliseconds(timeval_T *t)
|
||||
}
|
||||
|
||||
/** @bug 923: Assumes time_t values fit in long. (This function is used
|
||||
* for both timestamps and durations.) */
|
||||
* for both timestamps and durations.)
|
||||
* @relates timeval_T */
|
||||
long
|
||||
timeval_to_seconds(timeval_T *t)
|
||||
{
|
||||
return t->sec + t->usec / 1000000L;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
int
|
||||
timeval_is_positive(timeval_T *t)
|
||||
{
|
||||
return (t->sec > 0 || (t->sec == 0 && t->usec > 0));
|
||||
}
|
||||
|
||||
/** Be sure timeval is not negative. */
|
||||
/** Be sure timeval is not negative.
|
||||
* @relates timeval_T */
|
||||
void
|
||||
timeval_limit_to_zero_or_one(timeval_T *t)
|
||||
{
|
||||
@ -216,7 +228,8 @@ timeval_limit_to_zero_or_one(timeval_T *t)
|
||||
/** Compare time values.
|
||||
* @returns 1 if t1 > t2;
|
||||
* -1 if t1 < t2;
|
||||
* 0 if t1 == t2. */
|
||||
* 0 if t1 == t2.
|
||||
* @relates timeval_T */
|
||||
int
|
||||
timeval_cmp(timeval_T *t1, timeval_T *t2)
|
||||
{
|
||||
@ -226,6 +239,7 @@ timeval_cmp(timeval_T *t1, timeval_T *t2)
|
||||
return t1->usec - t2->usec;
|
||||
}
|
||||
|
||||
/** @relates timeval_T */
|
||||
int
|
||||
timeval_div_off_t(off_t n, timeval_T *t)
|
||||
{
|
||||
|
@ -53,6 +53,7 @@ timeval_T *timeval_sub_interval(timeval_T *t, timeval_T *interval);
|
||||
timeval_T *timeval_add_interval(timeval_T *t, timeval_T *interval);
|
||||
int timeval_div_off_t(off_t n, timeval_T *t);
|
||||
|
||||
/** @relates timeval_T */
|
||||
#define timeval_copy(dst, src) copy_struct(dst, src)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user