Radix cross Linux Package Tools

Package Tools – is a set of utilities to create, install, and update RcL packages

8 Commits   0 Branches   2 Tags
     5         kx 
     5         kx /**********************************************************************
     5         kx 
     5         kx   Copyright 2019 Andrey V.Kosteltsev
     5         kx 
     5         kx   Licensed under the Radix.pro License, Version 1.0 (the "License");
     5         kx   you may not use this file  except  in compliance with the License.
     5         kx   You may obtain a copy of the License at
     5         kx 
     5         kx      https://radix.pro/licenses/LICENSE-1.0-en_US.txt
     5         kx 
     5         kx   Unless required by applicable law or agreed to in writing, software
     5         kx   distributed under the License is distributed on an "AS IS" BASIS,
     5         kx   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
     5         kx   implied.
     5         kx 
     5         kx  **********************************************************************/
     5         kx 
     5         kx #ifndef _BTREE_H_
     5         kx #define _BTREE_H_
     5         kx 
     5         kx #ifdef __cplusplus
     5         kx extern "C" {
     5         kx #endif
     5         kx 
     5         kx 
     5         kx struct btree {
     5         kx   struct btree *left, *right;
     5         kx   int           ltag,  rtag;
     5         kx   int           lprn,  rprn;
     5         kx 
     5         kx   struct btree *parent;
     5         kx 
     5         kx   void   *data;
     5         kx };
     5         kx 
     5         kx typedef void (*TREE_FUNC)  ( void *data, void *user_data );
     5         kx typedef int  (*TREE_CMPF)  ( const void *a, const void *b );
     5         kx 
     5         kx 
     5         kx extern struct btree *__btree_alloc( void *data );
     5         kx extern struct btree *btree_insert_left( struct btree *tree, struct btree *node );
     5         kx extern struct btree *btree_insert_right( struct btree *tree, struct btree *node );
     5         kx 
     5         kx extern void btree_preorder_traversal( struct btree *root, TREE_FUNC func, void *user_data );
     5         kx extern void btree_postorder_traversal( struct btree *root, TREE_FUNC func, void *user_data );
     5         kx extern void btree_endorder_traversal( struct btree *root, TREE_FUNC func, void *user_data );
     5         kx 
     5         kx extern int btree_height( struct btree *root );
     5         kx extern int btree_width( struct btree *root );
     5         kx extern int btree_left_width( struct btree *root );
     5         kx extern int btree_right_width( struct btree *root );
     5         kx 
     5         kx extern struct btree *btree_detach( struct btree *node );
     5         kx 
     5         kx extern int btree_compare( struct btree *root_a, struct btree *root_b, TREE_CMPF cmp_func );
     5         kx 
     5         kx void __btree_free( struct btree *root );
     5         kx void btree_free( struct btree *root, TREE_FUNC free_func );
     5         kx 
     5         kx 
     5         kx struct btree_stack {
     5         kx   void   *__mem;
     5         kx   void   *__cur_brk;
     5         kx   size_t  __mem_size;
     5         kx   size_t  __unit_size;
     5         kx };
     5         kx 
     5         kx extern struct btree_stack *btree_stack_alloc( const size_t n, const size_t u );
     5         kx extern void btree_stack_free( struct btree_stack **pstack );
     5         kx extern int btree_stack_push( struct btree_stack *stack, const void *unit );
     5         kx extern int btree_stack_pop( struct btree_stack *stack, void *unit );
     5         kx 
     5         kx extern int btree_stack_is_empty( struct btree_stack *stack );
     5         kx extern int btree_stack_depth( struct btree_stack *stack );
     5         kx 
     5         kx 
     5         kx struct _bctx
     5         kx {
     5         kx   FILE *output;
     5         kx   struct btree *node;
     5         kx   int indent;
     5         kx };
     5         kx 
     5         kx extern void btree_reduce( struct btree *root, TREE_CMPF cmp_func, TREE_FUNC func );
     5         kx extern void btree_print_json( FILE *output, struct btree *root, TREE_FUNC func );
     5         kx 
     5         kx 
     5         kx #ifdef __cplusplus
     5         kx }  /* ... extern "C" */
     5         kx #endif
     5         kx 
     5         kx #endif /* _BTREE_H_ */