summaryrefslogtreecommitdiff
path: root/software/apilib/bt/octapi_bt0.c
diff options
context:
space:
mode:
Diffstat (limited to 'software/apilib/bt/octapi_bt0.c')
-rw-r--r--software/apilib/bt/octapi_bt0.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/software/apilib/bt/octapi_bt0.c b/software/apilib/bt/octapi_bt0.c
index e7d2e39..950b435 100644
--- a/software/apilib/bt/octapi_bt0.c
+++ b/software/apilib/bt/octapi_bt0.c
@@ -33,6 +33,7 @@ $Octasic_Revision: 18 $
+#if !SKIP_OctApiBt0GetSize
UINT32 OctApiBt0GetSize(UINT32 number_of_items,UINT32 key_size, UINT32 data_size, UINT32 * b_size)
{
if ((key_size % 4) != 0) return(OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32);
@@ -46,7 +47,9 @@ UINT32 OctApiBt0GetSize(UINT32 number_of_items,UINT32 key_size, UINT32 data_size
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0Init
UINT32 OctApiBt0Init(void ** b,UINT32 number_of_items,UINT32 key_size, UINT32 data_size)
{
UINT32 i;
@@ -93,16 +96,20 @@ UINT32 OctApiBt0Init(void ** b,UINT32 number_of_items,UINT32 key_size, UINT32 da
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0CorrectPointers
void OctApiBt0CorrectPointers(OCTAPI_BT0 * bb)
{
bb->node = (OCTAPI_BT0_NODE *)(((BYTE *)bb) + sizeof(OCTAPI_BT0));
bb->key = (UINT32 *)(((BYTE *)bb->node) + (sizeof(OCTAPI_BT0_NODE) * bb->number_of_items));
bb->data = (UINT32 *)(((BYTE *)bb->key) + (sizeof(UINT32) * bb->number_of_items * bb->key_size));
}
+#endif
+#if !SKIP_OctApiBt0AddNode
UINT32 OctApiBt0AddNode(void * b,void * key,void ** data)
{
OCTAPI_BT0 * bb;
@@ -152,7 +159,9 @@ UINT32 OctApiBt0AddNode(void * b,void * key,void ** data)
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0AddNode2
UINT32 OctApiBt0AddNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 new_node_number)
{
UINT32 result;
@@ -209,8 +218,10 @@ UINT32 OctApiBt0AddNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UI
return(GENERIC_OK);
}
}
+#endif
+#if !SKIP_OctApiBt0AddNode3
UINT32 OctApiBt0AddNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number)
{
UINT32 result;
@@ -271,10 +282,12 @@ UINT32 OctApiBt0AddNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UI
return(GENERIC_OK);
}
}
+#endif
/* state
0 -> first call to the function.
1 -> recursive call.*/
+#if !SKIP_OctApiBt0AddNode4
UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state )
{
UINT32 result;
@@ -373,7 +386,9 @@ UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UI
return(GENERIC_OK);
}
}
+#endif
+#if !SKIP_OctApiBt0KeyCompare
UINT32 OctApiBt0KeyCompare(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey)
{
UINT32 * nkey;
@@ -392,8 +407,10 @@ UINT32 OctApiBt0KeyCompare(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey
return(OCTAPI_BT0_LKEY_EQUAL);
}
+#endif
+#if !SKIP_OctApiBt0UpdateLinkDepth
void OctApiBt0UpdateLinkDepth(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link)
{
OCTAPI_BT0_NODE * this_node;
@@ -406,7 +423,9 @@ void OctApiBt0UpdateLinkDepth(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link)
else
link->depth = this_node->l[1].depth + 1;
}
+#endif
+#if !SKIP_OctApiBt0Rebalance
void OctApiBt0Rebalance(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
{
if (bb->node[root_link->node_number].l[0].depth > (bb->node[root_link->node_number].l[1].depth + 1)) /* Heavy to the left.*/
@@ -484,9 +503,11 @@ void OctApiBt0Rebalance(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
}
}
}
+#endif
/* This function does a rotation towards the outside of the tree*/
/* in order to keep the heavy branches towards the outside.*/
+#if !SKIP_OctApiBt0ExternalHeavy
void OctApiBt0ExternalHeavy(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
{
if (bb->node[root_link->node_number].l[1].depth > bb->node[root_link->node_number].l[0].depth) /* Exterior of tree is towards the left.*/
@@ -534,12 +555,14 @@ void OctApiBt0ExternalHeavy(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
OctApiBt0UpdateLinkDepth(bb,root_link);
}
}
+#endif
/* State:*/
/* 0 = seeking node to be removed.*/
/* 1 = node found, left branch taken.*/
/* 2 = node found, right branch taken.*/
+#if !SKIP_OctApiBt0RemoveNode2
UINT32 OctApiBt0RemoveNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link)
{
UINT32 result;
@@ -701,12 +724,14 @@ UINT32 OctApiBt0RemoveNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lke
return(GENERIC_OK);
}
+#endif
/* State:*/
/* 0 = seeking node to be removed.*/
/* 1 = node found, left branch taken.*/
/* 2 = node found, right branch taken.*/
+#if !SKIP_OctApiBt0RemoveNode3
UINT32 OctApiBt0RemoveNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link, UINT32 *p_prev_node_number )
{
UINT32 result;
@@ -900,7 +925,9 @@ UINT32 OctApiBt0RemoveNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lke
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0RemoveNode
UINT32 OctApiBt0RemoveNode(void * b,void * key)
{
OCTAPI_BT0 * bb;
@@ -920,7 +947,9 @@ UINT32 OctApiBt0RemoveNode(void * b,void * key)
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0QueryNode2
UINT32 OctApiBt0QueryNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 * node_number)
{
UINT32 result;
@@ -955,8 +984,10 @@ UINT32 OctApiBt0QueryNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0QueryNode
UINT32 OctApiBt0QueryNode(void * b,void * key,void ** data)
{
OCTAPI_BT0 * bb;
@@ -981,7 +1012,9 @@ UINT32 OctApiBt0QueryNode(void * b,void * key,void ** data)
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0GetFirstNode
UINT32 OctApiBt0GetFirstNode(void * b,void ** key, void ** data)
{
OCTAPI_BT0 * bb;
@@ -1018,7 +1051,9 @@ UINT32 OctApiBt0GetFirstNode(void * b,void ** key, void ** data)
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0FindOrAddNode
UINT32 OctApiBt0FindOrAddNode(void * b,void * key,void ** data, UINT32 *fnct_result)
{
OCTAPI_BT0 * bb;
@@ -1092,8 +1127,10 @@ UINT32 OctApiBt0FindOrAddNode(void * b,void * key,void ** data, UINT32 *fnct_res
return(GENERIC_OK);
}
+#endif
+#if !SKIP_OctApiBt0AddNodeReportPrevNodeData
UINT32 OctApiBt0AddNodeReportPrevNodeData(void * b,void * key,void ** data, void ** prev_data, PUINT32 fnct_result )
{
OCTAPI_BT0 * bb;
@@ -1176,4 +1213,5 @@ UINT32 OctApiBt0AddNodeReportPrevNodeData(void * b,void * key,void ** data, void
return(GENERIC_OK);
}
+#endif