增肌shell注册

This commit is contained in:
AryanYu 2023-10-04 19:25:47 +08:00
commit 8540a7ae77
3 changed files with 41 additions and 33 deletions

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include<string.h>
#include <stdlib.h> #include <transform.h>
#include "test_rbtree.h" #include"test_rbtree.h"
#ifdef ADD_XIZI_FEATURES
#define rb_parent(r) ((r)->parent) #define rb_parent(r) ((r)->parent)
#define rb_color(r) ((r)->is_red) #define rb_color(r) ((r)->is_red)
@ -540,8 +541,7 @@ void printRbtree(RBRoot *root)
} }
void TestRBTree(void){
int main(void){
int i, ret; int i, ret;
char cmd; char cmd;
RBRoot *root = createRbtree(); RBRoot *root = createRbtree();
@ -622,5 +622,9 @@ int main(void){
} }
destroyRbtree(root); 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_ #ifndef _RED_BLACK_TREE_H_
#define _RED_BLACK_TREE_H_ #define _RED_BLACK_TREE_H_
#include <stdbool.h>
#include <stdio.h>
#define RED 0 // 红色节点 #define RED 0 // 红色节点
#define BLACK 1 // 黑色节点 #define BLACK 1 // 黑色节点
@ -20,6 +22,8 @@ typedef struct RBTreeType{
Node *node; Node *node;
}RBRoot; }RBRoot;
void TestRBTree(void);
// 创建红黑树,返回"红黑树的根" // 创建红黑树,返回"红黑树的根"
RBRoot* createRbtree(); RBRoot* createRbtree();

View File

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