Skip to content

Commit a436aa2

Browse files
committed
Merge branch 'devel'
2 parents 52eda5b + bbfcf68 commit a436aa2

File tree

227 files changed

+6816
-2546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+6816
-2546
lines changed

AUTHORS

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
-----------
77
Bfdev Designer Group
88

9-
Name : ffashion
10-
11-
Represent : global
12-
139
Name : John Sanpe
1410
15-
Represent : global
11+
Represent : framework
12+
13+
Name : ffashion
14+
15+
Represent : array, cmake

CMakeLists.txt

Lines changed: 39 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
#
66

77
cmake_minimum_required(VERSION 3.12)
8-
project(bfdev VERSION 1.0.0 LANGUAGES C)
8+
project(bfdev VERSION 1.0.1 LANGUAGES C)
99

1010
include(GNUInstallDirs)
1111
include(CheckIncludeFiles)
12-
include(CheckCXXSymbolExists)
13-
include(CheckFunctionExists)
14-
include(CheckCSourceCompiles)
1512

1613
set(BFDEV_ARCH dummy)
1714
set(BFDEV_NAME sirius)
@@ -36,73 +33,40 @@ set(BFDEV_CONFIGURE ${BFDEV_GENERATED_PATH}/bfdev-config.cmake)
3633
include(scripts/asm-generic.cmake)
3734
include(scripts/hostrule.cmake)
3835
include(scripts/packed-header.cmake)
36+
include(scripts/packed-source.cmake)
3937
include(scripts/commit.cmake)
4038

4139
commit_hash(BFDEV_COMMITID)
4240
commit_branch(BFDEV_BRANCH)
4341

4442
option(BFDEV_DEVEL "Enable development mode" OFF)
45-
option(BFDEV_EXAMPLES "Build examples" OFF)
4643
option(BFDEV_STRICT "Enable strict compilation" ON)
44+
option(BFDEV_EXAMPLES "Build examples" OFF)
4745
option(BFDEV_ASAN "Enable Address Sanitizer" OFF)
4846
option(BFDEV_UBSAN "Enable Undefined Behaviour Sanitizer" OFF)
4947

50-
option(BFDEV_DBGLIST "Dynamic debug list" ON)
51-
option(BFDEV_DBGSLIST "Dynamic debug slist" ON)
52-
option(BFDEV_DBGHLIST "Dynamic debug hlist" ON)
53-
option(BFDEV_DBGILIST "Dynamic debug ilist" ON)
54-
option(BFDEV_DBGRBTREE "Dynamic debug rbtree" ON)
55-
option(BFDEV_DBGHEAP "Dynamic debug heap" ON)
56-
option(BFDEV_DBGREFCNT "Dynamic debug refcnt" ON)
48+
option(BFDEV_DEBUG_LIST "Dynamic debug list" ON)
49+
option(BFDEV_DEBUG_SLIST "Dynamic debug slist" ON)
50+
option(BFDEV_DEBUG_HLIST "Dynamic debug hlist" ON)
51+
option(BFDEV_DEBUG_ILIST "Dynamic debug ilist" ON)
52+
option(BFDEV_DEBUG_RBTREE "Dynamic debug rbtree" ON)
53+
option(BFDEV_DEBUG_HEAP "Dynamic debug heap" ON)
54+
option(BFDEV_DEBUG_REFCNT "Dynamic debug refcnt" ON)
55+
option(BFDEV_CRC_EXTEND "CRC loop unfolding optimize" ON)
5756

5857
if(BFDEV_DEVEL)
5958
set(BFDEV_EXAMPLES ON)
6059
set(BFDEV_ASAN ON)
6160
set(BFDEV_UBSAN ON)
6261
endif()
6362

64-
if(BFDEV_DBGLIST)
65-
set(BFDEV_DEBUG_LIST ON)
66-
endif()
67-
68-
if(BFDEV_DBGSLIST)
69-
set(BFDEV_DEBUG_SLIST ON)
70-
endif()
71-
72-
if(BFDEV_DBGHLIST)
73-
set(BFDEV_DEBUG_HLIST ON)
74-
endif()
75-
76-
if(BFDEV_DBGILIST)
77-
set(BFDEV_DEBUG_ILIST ON)
78-
endif()
79-
80-
if(BFDEV_DBGRBTREE)
81-
set(BFDEV_DEBUG_RBTREE ON)
82-
endif()
83-
84-
if(BFDEV_DBGHEAP)
85-
set(BFDEV_DEBUG_HEAP ON)
86-
endif()
87-
88-
if(BFDEV_DBGREFCNT)
89-
set(BFDEV_DEBUG_REFCNT ON)
90-
endif()
91-
9263
asm_generic(
9364
bfdev/asm-generic/
9465
${BFDEV_GENERATED_PATH}/bfdev/asm
9566
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm
9667
${BFDEV_HEADER_PATH}/bfdev/asm-generic
9768
)
9869

99-
packed_header(
100-
bfdev/
101-
_BFDEV_H_
102-
${BFDEV_GENERATED_PATH}/bfdev.h
103-
${BFDEV_HEADER_PATH}/bfdev
104-
)
105-
10670
configure_file(
10771
${BFDEV_MODULE_PATH}/config.h.in
10872
${BFDEV_GENERATED_PATH}/bfdev/config.h
@@ -113,22 +77,6 @@ configure_file(
11377
${BFDEV_CONFIGURE}
11478
)
11579

116-
file(GLOB BFDEV_HEADER
117-
${BFDEV_HEADER_PATH}/bfdev/*.h
118-
)
119-
120-
file(GLOB BFDEV_ASM_HEADER
121-
${BFDEV_HEADER_PATH}/bfdev/asm-generic/*.h
122-
)
123-
124-
file(GLOB BFDEV_ARCH_ASM_HEADER
125-
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm/*.h
126-
)
127-
128-
file(GLOB BFDEV_GENERATED_HEADER
129-
${BFDEV_GENERATED_PATH}/*.h
130-
)
131-
13280
add_compile_options(
13381
-std=gnu11
13482
-Wall
@@ -138,6 +86,8 @@ add_compile_options(
13886
-Wno-sign-compare
13987
-Wno-pointer-sign
14088
-Wno-null-pointer-arithmetic
89+
-Wmissing-prototypes
90+
-Wmissing-declarations
14191
-fvisibility=hidden
14292
)
14393

@@ -185,16 +135,23 @@ include_directories(${PROJECT_BINARY_DIR}/generated)
185135
add_subdirectory(${PROJECT_SOURCE_DIR}/scripts)
186136
include(${PROJECT_SOURCE_DIR}/build.cmake)
187137

188-
set(BFDEV_LIBRARY
138+
set(BFDEV_LIBRARY_HEADER
189139
${BFDEV_HEADER}
190140
${BFDEV_ASM_HEADER}
191141
${BFDEV_ARCH_ASM_HEADER}
192142
${BFDEV_GENERATED_HEADER}
193-
${BFDEV_INCLUDE}
143+
)
144+
145+
set(BFDEV_LIBRARY_SOURCE
194146
${BFDEV_SOURCE}
195147
${BFDEV_ARCH_SOURCE}
196148
)
197149

150+
set(BFDEV_LIBRARY
151+
${BFDEV_LIBRARY_HEADER}
152+
${BFDEV_LIBRARY_SOURCE}
153+
)
154+
198155
macro(bfdev_dependencies target)
199156
add_dependencies(
200157
${target}
@@ -208,6 +165,20 @@ macro(bfdev_dependencies target)
208165
)
209166
endmacro()
210167

168+
packed_header(
169+
bfdev/
170+
_BFDEV_H_
171+
${BFDEV_GENERATED_PATH}/bfdev.h
172+
${BFDEV_HEADER_PATH}/bfdev
173+
)
174+
175+
packed_source(
176+
${PROJECT_BINARY_DIR}/bfdev.c
177+
"${BFDEV_LIBRARY_SOURCE}"
178+
"#undef MODULE_NAME\n"
179+
"#undef bfdev_log_fmt\n"
180+
)
181+
211182
add_library(bfdev_object OBJECT ${BFDEV_LIBRARY})
212183
bfdev_dependencies(bfdev_object)
213184
add_library(bfdev ALIAS bfdev_object)
@@ -245,9 +216,9 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
245216
)
246217

247218
install(FILES
248-
${CMAKE_SOURCE_DIR}/README.md
249-
${CMAKE_SOURCE_DIR}/AUTHORS
250-
${CMAKE_SOURCE_DIR}/COPYING
219+
${PROJECT_SOURCE_DIR}/README.md
220+
${PROJECT_SOURCE_DIR}/AUTHORS
221+
${PROJECT_SOURCE_DIR}/COPYING
251222
DESTINATION ${CMAKE_INSTALL_DOCDIR}
252223
)
253224

README.md

100755100644
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ bfdev is a high-performance, aesthetically pleasing, and portable infrastructure
2222
- Offers a rich and well-organized set of APIs for users.
2323
- Conforms to the GNUC standard, ensuring strong cross-platform compatibility.
2424

25-
### WARNING
26-
27-
This project is not yet fully completed, so it is not recommended for use in a production environment.
25+
> [!NOTE]
26+
> We are seeking developers to collaborate with us on improve this project.
2827
2928
View supported components: [Docs](docs/components.md)
3029

@@ -84,6 +83,9 @@ graph LR
8483

8584
Quickly start, API manual, see [Bfdev Documentation Tutorial](https://openbfdev.github.io/bfdev-docs)
8685

86+
> [!CAUTION]
87+
> This project is not yet fully completed, so it is not recommended for use in a production environment.
88+
8789
## License
8890

8991
This is free software: you can redistribute it and/or modify it under the terms of the latest GNU General Public License as published by the Free Software Foundation.

build.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,21 @@
33
# Copyright(c) 2023 John Sanpe <[email protected]>
44
#
55

6+
file(GLOB BFDEV_HEADER
7+
${BFDEV_HEADER_PATH}/bfdev/*.h
8+
)
9+
10+
file(GLOB BFDEV_ASM_HEADER
11+
${BFDEV_HEADER_PATH}/bfdev/asm-generic/*.h
12+
)
13+
14+
file(GLOB BFDEV_ARCH_ASM_HEADER
15+
${BFDEV_ARCH_HEADER_PATH}/bfdev/asm/*.h
16+
)
17+
18+
file(GLOB BFDEV_GENERATED_HEADER
19+
${BFDEV_GENERATED_PATH}/*.h
20+
)
21+
622
include(${BFDEV_ARCH_PATH}/build.cmake)
723
include(${BFDEV_SOURCE_PATH}/build.cmake)

cmake/config.h.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
BFDEV_BEGIN_DECLS
1515

16-
#define BFDEV_VERSION_MAJOR ${CMAKE_PROJECT_VERSION_MAJOR}
17-
#define BFDEV_VERSION_MINOR ${CMAKE_PROJECT_VERSION_MINOR}
18-
#define BFDEV_VERSION_PATCH ${CMAKE_PROJECT_VERSION_PATCH}
19-
#define BFDEV_VERSION_TWEAK ${CMAKE_PROJECT_VERSION_TWEAK}
16+
#define BFDEV_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}
17+
#define BFDEV_VERSION_MINOR ${PROJECT_VERSION_MINOR}
18+
#define BFDEV_VERSION_PATCH ${PROJECT_VERSION_PATCH}
19+
#define BFDEV_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}
2020
#define BFDEV_EXTREVERSION ${BFDEV_EXTREVERSION}
2121

2222
#define BFDEV_ARCH ${BFDEV_ARCH}
@@ -33,6 +33,7 @@ BFDEV_BEGIN_DECLS
3333
#cmakedefine BFDEV_DEBUG_RBTREE
3434
#cmakedefine BFDEV_DEBUG_HEAP
3535
#cmakedefine BFDEV_DEBUG_REFCNT
36+
#cmakedefine BFDEV_CRC_EXTEND
3637

3738
#define BFDEV_VERSION_CHECK(major, minor, patch) ( \
3839
((major) == BFDEV_VERSION_MAJOR) && \

docs/images/logo.png

100755100644
File mode changed.

examples/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
# Copyright(c) 2023 ffashion <[email protected]>
44
#
55

6+
add_subdirectory(action)
67
add_subdirectory(allocator)
8+
add_subdirectory(arc4)
79
add_subdirectory(array)
810
add_subdirectory(base32)
911
add_subdirectory(base64)
1012
add_subdirectory(bfdev)
1113
add_subdirectory(bloom)
1214
add_subdirectory(btree)
1315
add_subdirectory(cache)
16+
add_subdirectory(circle)
1417
add_subdirectory(crc)
1518
add_subdirectory(fifo)
1619
add_subdirectory(fsm)
@@ -25,11 +28,15 @@ add_subdirectory(list)
2528
add_subdirectory(log)
2629
add_subdirectory(log2)
2730
add_subdirectory(matrix)
31+
add_subdirectory(minpool)
32+
add_subdirectory(mpi)
33+
add_subdirectory(notifier)
2834
add_subdirectory(once)
2935
add_subdirectory(radix)
3036
add_subdirectory(rbtree)
3137
add_subdirectory(ringbuf)
3238
add_subdirectory(segtree)
3339
add_subdirectory(skiplist)
3440
add_subdirectory(slist)
41+
add_subdirectory(sort)
3542
add_subdirectory(textsearch)

examples/action/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
/action-simple

examples/action/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
#
3+
# Copyright(c) 2023 ffashion <[email protected]>
4+
#
5+
6+
add_executable(action-simple simple.c)
7+
target_link_libraries(action-simple bfdev)
8+
add_test(action-simple action-simple)
9+
10+
if(${CMAKE_PROJECT_NAME} STREQUAL "bfdev")
11+
install(FILES
12+
simple.c
13+
DESTINATION
14+
${CMAKE_INSTALL_DOCDIR}/examples/action
15+
)
16+
17+
install(TARGETS
18+
action-simple
19+
DESTINATION
20+
${CMAKE_INSTALL_DOCDIR}/bin
21+
)
22+
endif()

examples/action/simple.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
/*
3+
* Copyright(c) 2023 John Sanpe <[email protected]>
4+
*/
5+
6+
#define MODULE_NAME "action-simple"
7+
#define bfdev_log_fmt(fmt) MODULE_NAME ": " fmt
8+
9+
#include <stdio.h>
10+
#include <bfdev/action.h>
11+
#include <bfdev/log.h>
12+
13+
static int
14+
test_action(void *pdata)
15+
{
16+
bfdev_log_info("%s\n", (char *)pdata);
17+
return 0;
18+
}
19+
20+
int main(int argc, char **argv)
21+
{
22+
BFDEV_DEFINE_ACTION(action, test_action, NULL);
23+
int retval;
24+
25+
bfdev_action_update(&action, "hello world");
26+
retval = bfdev_action_call(&action);
27+
if (retval)
28+
return retval;
29+
30+
bfdev_action_update(&action, "wow bfdev");
31+
retval = bfdev_action_call(&action);
32+
if (retval)
33+
return retval;
34+
35+
return 0;
36+
}

0 commit comments

Comments
 (0)