Changes below:

- Code style fix in usrtc header file
 - Added autotools stuff for manpages
 - Added manpage for usrtc_init block:
   - usrtc_init()
   - usrtc_create()
   - usrtc_destroy()
master
Alexander Vdolainen 5 years ago
parent 70072351a2
commit dfc1b90513

@ -7,7 +7,7 @@ if BUILD_TESTS
EXTRA += tests EXTRA += tests
endif endif
SUBDIRS = include lib $(EXTRA) SUBDIRS = include lib man $(EXTRA)
libtdatadocdir = ${prefix}/doc/libtdata libtdatadocdir = ${prefix}/doc/libtdata
libtdatadoc_DATA = \ libtdatadoc_DATA = \

@ -62,4 +62,5 @@ Makefile
lib/libtdata.pc lib/libtdata.pc
lib/Makefile lib/Makefile
tests/Makefile tests/Makefile
include/Makefile]) include/Makefile
man/Makefile])

@ -22,14 +22,11 @@
#define USRTC_COUNT_T_MAX ((1 << (sizeof(unsigned long)*(sizeof(char) << 1)))-1) #define USRTC_COUNT_T_MAX ((1 << (sizeof(unsigned long)*(sizeof(char) << 1)))-1)
/*count and some misc typedefs*/ /* count and some misc typedefs */
typedef unsigned long usrtc_count_t; typedef unsigned long usrtc_count_t;
typedef unsigned int usrtc_impl_id_t; typedef unsigned int usrtc_impl_id_t;
/* implementations ids, /* implementation's typedefs */
* if you want to add some
* add the id here, don't forget to do it.
*/
#define USRTC_LIST 0 #define USRTC_LIST 0
#define USRTC_BST 1 #define USRTC_BST 1
#define USRTC_REDBLACK 2 #define USRTC_REDBLACK 2
@ -102,9 +99,14 @@ typedef struct __usrtc_functions_t {
usrtc_impltype_t usrtc_type; usrtc_impltype_t usrtc_type;
} usrtc_functions_t; } usrtc_functions_t;
/*basic rtc functions*/ /* basic usrtc functions */
void usrtc_init(usrtc_t *us,int impl,usrtc_count_t maxcount,usrtc_compare_t compare); /* initialize usrtc core structure */
usrtc_t *usrtc_create(int impl,usrtc_count_t maxcount,usrtc_compare_t compare); void usrtc_init(usrtc_t *us, int impl, usrtc_count_t maxcount,
usrtc_compare_t compare);
/* allocate and initialize core structure: going to be deprecated */
usrtc_t *usrtc_create(int impl, usrtc_count_t maxcount,
usrtc_compare_t compare);
/* destroy(free) usrtc core structure: going to be deprecated */
void usrtc_destroy(usrtc_t *us); void usrtc_destroy(usrtc_t *us);
void usrtc_convert_to(usrtc_t *us,int impl); void usrtc_convert_to(usrtc_t *us,int impl);

@ -0,0 +1,2 @@
man_MANS = usrtc_init.3 usrtc_create.3 usrtc_destroy.3

@ -0,0 +1,24 @@
.TH @F_BLOCK@ 3 "@DoM@ @MONTH@ @YEAR@" "LIBTDATA" "Portable data structures C library manual"
.SH NAME
.br
.SH SYNOPSYS
.br
.SH DESCRIPTION
.br
.SH RETURN VALUE
.br
.SH BUGS
.br
.SH EXAMPLE
.br
.SH RATIONALE
.br
.SH SEE ALSO
.br
.SH COPYRIGHT
This software licensed under GNU LGPL v2.1 or later. See COPYING for further details.
.br
(c) Authors of libtdata. See AUTHORS for further details.
.SH AUTHOR
@GIT_NAME@ (@GIT_EMAIL@)
.br

@ -0,0 +1 @@
usrtc_init.3

@ -0,0 +1 @@
usrtc_init.3

@ -0,0 +1,87 @@
.TH USRTC_INIT 3 "21 May 2019" "LIBTDATA" "Portable data structures C library manual"
.SH NAME
usrtc_init \- Initialize usrtc core structure
.br
usrtc_create \- Allocate and initialize usrtc core structure
.br
usrtc_destroy \- Destroy (free) usrtc core structure
.br
.SH SYNOPSYS
.B #include <tdata/usrtc.h>
.sp
void usrtc_init(usrtc_t *us, int impl, usrtc_count_t maxcount, usrtc_compare_t compare);
usrtc_t *usrtc_create(int impl, usrtc_count_t maxcount, usrtc_compare_t compare);
void usrtc_destroy(usrtc_t *us);
typedef long (*usrtc_compare_t)(const void*, const void*);
.br
.sp
.SH DESCRIPTION
.B usrtc_init
and
.B usrtc_create
are used to initialize a new usrtc core structure. The difference is
.B usrtc_create
will allocate
.B usrtc_t
structure via
.B malloc()
function, but
.B usrtc_init
expect already allocated structure. Argument
.B impl
is used to point the type of search data structure used for this particular usrtc core structure. Possible values are:
.br
.B * USRTC_LIST:
Linked list
.br
.B * USRTC_BST:
Binary search tree
.br
.B * USRTC_REDBLACK:
Redblack tree
.br
.B * USRTC_SPLAY:
Splay tree
.br
.B * USRTC_AVL:
AVL tree
.br
.B maxcount
argument is pointing to a max amount of the nodes within a search data structure.
.B compare
is a pointer to a compare function.
.br
.B usrtc_destroy
is used to destroy (free) usrtc core structure. This function must be used only for structures allocated via
.B usrtc_create
function.
.br
.SH RETURN VALUE
Valid pointer to a newly allocated and initialized core structure, otherwise
.B NULL.
.br
.SH BUGS
Not known yet.
.br
.SH EXAMPLE
.br
.SH RATIONALE
Using functions
.B usrtc_create
and
.B usrtc_destroy
is deprecating.
.br
.SH SEE ALSO
.br
.SH COPYRIGHT
This software licensed under GNU LGPL v2.1 or later. See COPYING for further details.
.br
(c) Authors of libtdata. See AUTHORS for further details.
.SH AUTHOR
Alexander Vdolainen (alex@vapaa.xyz)
.br
Loading…
Cancel
Save