last change

This commit is contained in:
yzd 2023-10-04 04:20:31 -07:00
parent 2dd4f95a10
commit d4a216157f
3 changed files with 41 additions and 33 deletions

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "test_rbtree.h"
#include<string.h>
#include <transform.h>
#include"test_rbtree.h"
#ifdef ADD_XIZI_FEATURES
#define rb_parent(r) ((r)->parent)
#define rb_color(r) ((r)->is_red)
@ -540,8 +541,7 @@ void printRbtree(RBRoot *root)
}
int main(void){
void TestRBTree(void){
int i, ret;
char cmd;
RBRoot *root = createRbtree();
@ -622,5 +622,9 @@ int main(void){
}
destroyRbtree(root);
return 0;
return;
}
PRIV_SHELL_CMD_FUNCTION(TestRBTree, a red-black tree test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@ -1,5 +1,7 @@
#ifndef _RED_BLACK_TREE_H_
#define _RED_BLACK_TREE_H_
#include <stdbool.h>
#include <stdio.h>
#define RED 0 // 红色节点
#define BLACK 1 // 黑色节点
@ -20,6 +22,8 @@ typedef struct RBTreeType{
Node *node;
}RBRoot;
void TestRBTree(void);
// 创建红黑树,返回"红黑树的根"
RBRoot* createRbtree();

View File

@ -1,32 +1,32 @@
// /*
// * Copyright (c) 2020 AIIT XUOS Lab
// * XiUOS is licensed under Mulan PSL v2.
// * You can use this software according to the terms and conditions of the Mulan PSL v2.
// * You may obtain a copy of Mulan PSL v2 at:
// * http://license.coscl.org.cn/MulanPSL2
// * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// * See the Mulan PSL v2 for more details.
// */
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
// #include <stdio.h>
// #include <string.h>
// // #include <user_api.h>
// #include <transform.h>
#include <stdio.h>
#include <string.h>
// #include <user_api.h>
#include <transform.h>
// extern int FrameworkInit();
// extern void ApplicationOtaTaskInit(void);
// int main(void)
// {
// printf("Hello, world! \n");
// FrameworkInit();
// #ifdef APPLICATION_OTA
// ApplicationOtaTaskInit();
// #endif
// return 0;
// }
// // int cppmain(void);
extern int FrameworkInit();
extern void ApplicationOtaTaskInit(void);
int main(void)
{
printf("Hello, world! \n");
FrameworkInit();
#ifdef APPLICATION_OTA
ApplicationOtaTaskInit();
#endif
return 0;
}
// int cppmain(void);