Skip to content

Commit 563a6ad

Browse files
authored
Merge pull request #6 from cm-jones/develop
Develop
2 parents 417aa78 + 0bc1c85 commit 563a6ad

Some content is hidden

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

45 files changed

+530
-472
lines changed

.github/actions/package/action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Package libdsc"
22
description: "Build Debian, RPM, and Arch Linux packages"
33
inputs:
44
distribution:
5-
description: "Distribution to build package for (debian, rpm, or arch)"
5+
description: "Distribution to build package for (Debian, rpm, or Arch)"
66
required: true
77
version:
88
description: "Version tag (e.g., v0.1.0-alpha)"
@@ -76,7 +76,7 @@ runs:
7676
shell: bash
7777
run: |
7878
cd ${{ github.workspace }}
79-
./scripts/build-debian.sh
79+
./scripts/debian.sh
8080
8181
- if: inputs.distribution == 'rpm'
8282
name: Setup RPM packaging environment
@@ -88,7 +88,7 @@ runs:
8888
bash -c "dnf install -y rpm-build rpmdevtools cmake gcc make && \
8989
useradd -m builder && \
9090
chown -R builder:builder . && \
91-
su builder -c './scripts/build-rpm.sh'"
91+
su builder -c './scripts/rpm.sh'"
9292
9393
- if: inputs.distribution == 'arch'
9494
name: Update PKGBUILD version

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- main
6+
- develop
67
pull_request:
78
branches:
89
- main

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create a new release
1+
name: Release
22
on:
33
push:
44
tags: ['v*.*.*']

CONTRIBUTING.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
1. Clone the repository:
66
```bash
7-
git clone https://github.com/yourusername/libdsc.git
7+
git clone https://github.com/cm-jones/libdsc.git
88
cd libdsc
99
```
1010

@@ -13,36 +13,41 @@ cd libdsc
1313
## Building and Testing
1414

1515
### Basic Build
16+
1617
```bash
1718
./scripts/build.sh
1819
```
1920

2021
### Run Tests
22+
2123
```bash
2224
./scripts/build.sh
2325
cd build
2426
ctest --output-on-failure
2527
```
2628

2729
### Run Linter
30+
2831
```bash
2932
./scripts/lint.sh
3033
```
3134

3235
### Format Code
36+
3337
```bash
3438
./scripts/format.sh
3539
```
3640

3741
## Package Management
3842

3943
### Official Releases
44+
4045
The recommended way to create releases is through GitHub:
4146

4247
1. Tag your version:
4348
```bash
44-
git tag v0.1.0-alpha
45-
git push origin v0.1.0-alpha
49+
git tag v0.1.0
50+
git push origin v0.1.0
4651
```
4752

4853
2. GitHub Actions will automatically:
@@ -55,9 +60,11 @@ git push origin v0.1.0-alpha
5560
This ensures consistent, reproducible builds in a clean environment.
5661

5762
### Local Package Testing
63+
5864
For development and testing, you can build packages locally in the dev container:
5965

6066
#### Debian Package
67+
6168
```bash
6269
./scripts/build-debian.sh
6370
```
@@ -66,6 +73,7 @@ Outputs:
6673
- libdsc-dev_*.deb (development)
6774

6875
#### RPM Package
76+
6977
```bash
7078
./scripts/build-rpm.sh
7179
```
@@ -78,6 +86,7 @@ Requirements:
7886
- rpm-build and rpmdevtools packages
7987

8088
#### Arch Package
89+
8190
```bash
8291
./scripts/build-arch.sh
8392
```
@@ -104,10 +113,11 @@ Note: Local package builds are useful for testing but should not be distributed.
104113
- Single package with both runtime and development files
105114

106115
### Version Numbering
107-
- Release tags: v0.1.0-alpha
108-
- Debian format: 0.1.0~alpha1
109-
- RPM format: 0.1.0~alpha
110-
- Arch format: 0.1.0_alpha
116+
117+
- Release tags: v0.1.0
118+
- Debian format: 0.1.0
119+
- RPM format: 0.1.0
120+
- Arch format: 0.1.0
111121

112122
## Adding New Features
113123

Doxyfile

Whitespace-only changes.

README.md

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
<p align="center">
2-
<img src="assets/logo.png" alt="logo" width="200" height="200" style="vertical-align: middle;">
1+
<p align="center" style="margin: 0; padding: 0;">
2+
<img src="assets/logo.png" alt="libdsc logo" width="200" height="200" style="vertical-align: middle;">
33
</p>
44

55
# libdsc
66

77
[![CI](https://github.com/cm-jones/libdsc/actions/workflows/ci.yaml/badge.svg)](https://github.com/cm-jones/libdsc/actions/workflows/ci.yaml)
8-
[![Benchmarks](https://github.com/cm-jones/libdsc/actions/workflows/benchmark.yaml/badge.svg)](https://github.com/cm-jones/libdsc/actions/workflows/benchmark.yaml)
8+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cb3382e664b54cb7b1f023424fcc774c)](https://app.codacy.com/gh/cm-jones/libdsc/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
99
[![Codecov](https://codecov.io/gh/cm-jones/libdsc/branch/main/graph/badge.svg)](https://codecov.io/gh/cm-jones/libdsc)
1010
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
1111

12-
libdsc is an open-source C library featuring generic implementations of some C++ Standard Library containers.
12+
`libdsc` is an open-source C library featuring generic and memory-safe implementations of various containers provided by the C++ Standard Library.
1313

1414
## Features
1515

16-
- **Vector**: Dynamically-sized array
17-
- **Forward List**: Singly-linked list
18-
- **List**: Doubly-linked list
19-
- **Stack**: LIFO container
20-
- **Queue**: FIFO container
21-
- **Unordered Map**: Hash table for key-value pairs
22-
- **Unordered Set**: Hash table for unique elements
16+
`libdsc` implements the following containers:
2317

24-
All of these implementations are:
18+
- `vector`: dynamically-sized array
19+
- `forward_list`: singly-linked list
20+
- `list`: doubly-linked list
21+
- `stack`: LIFO container
22+
- `queue`: FIFO container
23+
- `unordered_map`: hash table for key-value pairs
24+
- `unordered_set`: hash table for unique elements
25+
26+
All containers are:
2527

2628
- Generic (can store any data type)
2729
- Memory safe (with proper error handling)
2830
- Thoroughly tested
29-
- Performance benchmarked against C++ counterparts
31+
- Benchmarked against C++ Standard Library counterparts
3032

3133
## Installing from source
3234

@@ -39,10 +41,9 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF -DB
3941
make
4042
```
4143

42-
Then, install the library system-wide:
44+
Then, to install the library system-wide:
4345

4446
```bash
45-
cd build
4647
sudo make install
4748
```
4849

@@ -52,17 +53,33 @@ This will install:
5253
- Header files to `/usr/local/include/libdsc`
5354
- CMake configuration files to `/usr/local/lib/cmake/libdsc`
5455

56+
## Installing from package
57+
58+
On Debian-based Linux distributions:
59+
60+
```bash
61+
sudo dpkg -i libdsc-<current_version>.deb
62+
```
63+
64+
On RPM-based Linux distributions:
65+
66+
```bash
67+
68+
```
69+
5570
## Usage
5671

5772
```c
5873
#include <libdsc/vector.h>
5974
#include <libdsc/list.h>
6075

76+
// Include other containers as needed ...
77+
6178
#include <stdio.h>
6279

63-
int main() {
80+
int main(int argc, char *argv[]) {
6481
// Create a vector of integers
65-
dsc_vector_t *vec = vector_create(sizeof(int));
82+
dsc_vector *vec = vector_create(sizeof(int));
6683

6784
// Push some values
6885
for (size_t i = 0; i < 5; ++i) {
@@ -79,7 +96,7 @@ int main() {
7996
vector_destroy(vec);
8097

8198
// Create a list of integers
82-
dsc_list_t *list = list_create(sizeof(int));
99+
dsc_list *list = list_create(sizeof(int));
83100

84101
// Push some values
85102
for (size_t i = 0; i < 5; ++i) {
@@ -97,15 +114,15 @@ int main() {
97114
// Clean up
98115
list_destroy(list);
99116

100-
return 0;
117+
return EXIT_SUCCESS;
101118
}
102119
```
103120
104121
More examples can be found in the `examples` directory.
105122
106123
## Testing
107124
108-
libdsc uses Google Test for unit testing. To run the tests:
125+
Google Test is used for unit testing. To run the tests, after building the project:
109126
110127
```bash
111128
cd build
@@ -114,7 +131,7 @@ ctest --output-on-failure
114131

115132
## Benchmarking
116133

117-
Google Benchmark is used for benchmarking libdsc containers against the equivalent containers in the C++ Standard Library. Benchmarks are run weekly and can be found in the [Actions tab](https://github.com/cm-jones/libdsc/actions/workflows/benchmark.yaml) under the Benchmarks workflow. You can also run benchmarks locally:
134+
Google Benchmark is used to measure the performance of libdsc's containers against their equivalents in the C++ Standard Library. Benchmarks are run weekly automatically via GitHub Actions. You can also run the benchmarks locally:
118135

119136
```bash
120137
mkdir -p build
@@ -127,8 +144,8 @@ cd benchmarks
127144

128145
## Contributing
129146

130-
See [CONTRIBUTING.md](CONTRIBUTING.md).
147+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) carefully before you attempt to make contributions to this project.
131148

132149
## License
133150

134-
This project is licensed under the GPLv3. See [LICENSE](LICENSE) for details.
151+
`libdsc` is licensed under the GPLv3. See [LICENSE](LICENSE) for details.

ROADMAP.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# libdsc Roadmap
2+
3+
Containers from the C++ Standard Library yet to be implemented:
4+
5+
[ ] - `std::map`
6+
[ ] - `std::set`
7+
[ ] - `std::multimap`
8+
[ ] - `std::multiset`
9+
[ ] - `std::array`
10+
11+

benchmarks/benchmark_forward_list.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Benchmark push_front
88
static void BM_ForwardListPushFront(benchmark::State &state) {
9-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
9+
dsc_forward_list *list = forward_list_create(sizeof(int));
1010

1111
for (auto _ : state) {
1212
int value = 42;
@@ -30,7 +30,7 @@ BENCHMARK(BM_StdForwardListPushFront)->Range(1, 1 << 20);
3030

3131
// Benchmark push_front and pop_front
3232
static void BM_ForwardListPushPopFront(benchmark::State &state) {
33-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
33+
dsc_forward_list *list = forward_list_create(sizeof(int));
3434

3535
for (auto _ : state) {
3636
int value = 42;
@@ -55,7 +55,7 @@ BENCHMARK(BM_StdForwardListPushPopFront)->Range(1, 1 << 20);
5555

5656
// Benchmark front access
5757
static void BM_ForwardListFront(benchmark::State &state) {
58-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
58+
dsc_forward_list *list = forward_list_create(sizeof(int));
5959
int value = 42;
6060
forward_list_push_front(list, &value);
6161

@@ -80,7 +80,7 @@ BENCHMARK(BM_StdForwardListFront)->Range(1 << 10, 1 << 20);
8080

8181
// Benchmark insert_after
8282
static void BM_ForwardListInsertAfter(benchmark::State &state) {
83-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
83+
dsc_forward_list *list = forward_list_create(sizeof(int));
8484
int value = 42;
8585
forward_list_push_front(list, &value);
8686
forward_list_node_t *pos = forward_list_begin(list);
@@ -108,7 +108,7 @@ BENCHMARK(BM_StdForwardListInsertAfter)->Range(1, 1 << 20);
108108

109109
// Benchmark size operation
110110
static void BM_ForwardListSize(benchmark::State &state) {
111-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
111+
dsc_forward_list *list = forward_list_create(sizeof(int));
112112
int value = 42;
113113
for (size_t i = 0; i < 1000; ++i) {
114114
forward_list_push_front(list, &value);
@@ -138,7 +138,7 @@ BENCHMARK(BM_StdForwardListSize)->Range(1 << 10, 1 << 20);
138138

139139
// Benchmark empty check
140140
static void BM_ForwardListEmpty(benchmark::State &state) {
141-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
141+
dsc_forward_list *list = forward_list_create(sizeof(int));
142142

143143
for (auto _ : state) {
144144
benchmark::DoNotOptimize(forward_list_empty(list));
@@ -160,7 +160,7 @@ BENCHMARK(BM_StdForwardListEmpty)->Range(1 << 10, 1 << 20);
160160

161161
// Benchmark erase_after operation
162162
static void BM_ForwardListEraseAfter(benchmark::State &state) {
163-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
163+
dsc_forward_list *list = forward_list_create(sizeof(int));
164164
int value = 42;
165165
forward_list_push_front(list, &value);
166166
forward_list_node_t *pos = forward_list_begin(list);
@@ -195,7 +195,7 @@ BENCHMARK(BM_StdForwardListEraseAfter)->Range(1 << 10, 1 << 20);
195195

196196
// Benchmark clear operation
197197
static void BM_ForwardListClear(benchmark::State &state) {
198-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
198+
dsc_forward_list *list = forward_list_create(sizeof(int));
199199
int value = 42;
200200

201201
for (auto _ : state) {
@@ -232,7 +232,7 @@ BENCHMARK(BM_StdForwardListClear)->Range(1 << 10, 1 << 20);
232232

233233
// Benchmark iterator operations (begin/end traversal)
234234
static void BM_ForwardListTraversal(benchmark::State &state) {
235-
dsc_forward_list_t *list = forward_list_create(sizeof(int));
235+
dsc_forward_list *list = forward_list_create(sizeof(int));
236236
int value = 42;
237237
for (size_t i = 0; i < 1000; ++i) {
238238
forward_list_push_front(list, &value);

0 commit comments

Comments
 (0)