Skip to content

Commit 2f946a8

Browse files
authored
remove submodule, add source files (#134)
* remove submodule * add alex-c-collections, remove submodule
1 parent 9170e30 commit 2f946a8

File tree

19 files changed

+1360
-27
lines changed

19 files changed

+1360
-27
lines changed

.cppcheck.supp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
unusedFunction:lib/col/*c
12
unusedFunction:tst/wrap-log.c
23
unusedFunction:tst/util.c

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
with:
15-
submodules: true
1614
- name: deps
1715
run: |
1816
sudo add-apt-repository universe

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ Most will be available if you are running a wlroots based compositor like sway.
2020

2121
yaml-cpp will need to be installed via your distribution's package manager.
2222

23-
## Library Submodules
24-
25-
Following clone the libraries must be fetched.
26-
27-
`git submodule update --init`
28-
2923
## Development
3024

3125
gcc is the default for packaging reasons, however clang is preferred.

GNUmakefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
include config.mk
22

3-
INC_H = $(wildcard inc/*.h)
3+
INC_H = $(wildcard inc/*.h) $(wildcard lib/col/inc/*.h)
44

5-
SRC_C = $(wildcard src/*.c)
5+
SRC_C = $(wildcard src/*.c) $(wildcard lib/col/src/*.c)
66
SRC_CXX = $(wildcard src/*.cpp)
77
SRC_O = $(SRC_C:.c=.o) $(SRC_CXX:.cpp=.o)
88

9-
LIB_H = $(wildcard lib/alex-c-collections/inc/*.h)
10-
LIB_C = $(wildcard lib/alex-c-collections/src/*.c)
11-
LIB_O = $(LIB_C:.c=.o)
12-
139
EXAMPLE_C = $(wildcard examples/*.c)
1410
EXAMPLE_O = $(EXAMPLE_C:.c=.o)
1511
EXAMPLE_E = $(EXAMPLE_C:.c=)
@@ -28,11 +24,10 @@ TST_T = $(patsubst tst%,test%,$(TST_E))
2824
all: way-displays
2925

3026
$(SRC_O): $(INC_H) $(PRO_H) config.mk GNUmakefile
31-
$(LIB_O): $(LIB_H) $(LIB_C) config.mk GNUmakefile
3227
$(PRO_O): $(PRO_H) config.mk GNUmakefile
3328
$(EXAMPLE_O): $(INC_H) $(PRO_H) config.mk GNUmakefile
3429

35-
way-displays: $(SRC_O) $(PRO_O) $(LIB_O)
30+
way-displays: $(SRC_O) $(PRO_O)
3631
$(CXX) -o $(@) $(^) $(LDFLAGS) $(LDLIBS)
3732

3833
$(PRO_H): $(PRO_X)
@@ -42,7 +37,7 @@ $(PRO_C): $(PRO_X)
4237
wayland-scanner private-code $(@:.c=.xml) $@
4338

4439
clean:
45-
rm -f way-displays $(SRC_O) $(PRO_O) $(PRO_H) $(PRO_C) $(LIB_O) $(TST_O) $(TST_E) $(EXAMPLE_E) $(EXAMPLE_O)
40+
rm -f way-displays $(SRC_O) $(PRO_O) $(PRO_H) $(PRO_C) $(TST_O) $(TST_E) $(EXAMPLE_E) $(EXAMPLE_O)
4641

4742
install: way-displays way-displays.1 cfg.yaml
4843
mkdir -p $(DESTDIR)$(PREFIX)/bin
@@ -84,7 +79,7 @@ $(TST_T): all
8479
$(VALGRIND) ./$(EXE)
8580

8681
examples: $(EXAMPLE_E)
87-
examples/%: examples/%.o $(filter-out src/main.o,$(SRC_O)) $(PRO_O) $(LIB_O)
82+
examples/%: examples/%.o $(filter-out src/main.o,$(SRC_O)) $(PRO_O)
8883
$(CXX) -o $(@) $(^) $(LDFLAGS) $(LDLIBS)
8984

9085
.PHONY: all clean install uninstall man cppcheck iwyu test test-vg $(TST_T)

config.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PREFIX ?= /usr/local
44
PREFIX_ETC ?= /usr/local
55
ROOT_ETC ?= /etc
66

7-
INCS = -Iinc -Ipro -Ilib/alex-c-collections/inc
7+
INCS = -Iinc -Ipro -Ilib/col/inc
88

99
CPPFLAGS += $(INCS) -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" -DROOT_ETC=\"$(ROOT_ETC)\"
1010

lib/alex-c-collections

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/col/.source

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[email protected]:alex-courtis/alex-c-collections.git v1.1.1

lib/col/inc/itable.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef ITABLE_H
2+
#define ITABLE_H
3+
4+
#include <stddef.h>
5+
#include <stdint.h>
6+
7+
/*
8+
* Array backed integer indexed table.
9+
* Entries preserve insertion order.
10+
* Operations linearly traverse keys.
11+
* NULL values permitted.
12+
* Not thread safe.
13+
*/
14+
struct ITable;
15+
16+
/*
17+
* Entry iterator.
18+
*/
19+
struct ITableIter {
20+
const uint64_t key;
21+
const void* const val;
22+
};
23+
24+
/*
25+
* Lifecycle
26+
*/
27+
28+
// construct a table with initial size, growing as necessary, NULL on zero param
29+
const struct ITable *itable_init(const size_t initial, const size_t grow);
30+
31+
// free table
32+
void itable_free(const void* const tab);
33+
34+
// free table and vals, null free_val uses free()
35+
void itable_free_vals(const struct ITable* const tab, void (*free_val)(const void* const val));
36+
37+
// free iter
38+
void itable_iter_free(const struct ITableIter* const iter);
39+
40+
/*
41+
* Access
42+
*/
43+
44+
// return val, NULL not present
45+
const void *itable_get(const struct ITable* const tab, const uint64_t key);
46+
47+
// create an iterator, caller must itable_iter_free or invoke itable_next until NULL
48+
const struct ITableIter *itable_iter(const struct ITable* const tab);
49+
50+
// next iterator value, NULL at end of list
51+
const struct ITableIter *itable_next(const struct ITableIter* const iter);
52+
53+
// number of entries with val
54+
size_t itable_size(const struct ITable* const tab);
55+
56+
/*
57+
* Mutate
58+
*/
59+
60+
// set key/val, return old val if overwritten
61+
const void *itable_put(const struct ITable* const tab, const uint64_t key, const void* const val);
62+
63+
// remove key, return old val if present
64+
const void *itable_remove(const struct ITable* const tab, const uint64_t key);
65+
66+
#endif // ITABLE_H
67+

lib/col/inc/oset.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#ifndef OSET_H
2+
#define OSET_H
3+
4+
#include <stdbool.h>
5+
#include <stddef.h>
6+
7+
/*
8+
* Array backed ordered set.
9+
* Operations linearly traverse values.
10+
* NULL not permitted.
11+
* Not thread safe.
12+
*/
13+
struct OSet;
14+
15+
/*
16+
* Entry iterator.
17+
*/
18+
struct OSetIter {
19+
const void* const val;
20+
};
21+
22+
/*
23+
* Lifecycle
24+
*/
25+
26+
// construct a set with initial size, grow as needed, NULL on zero param
27+
const struct OSet *oset_init(const size_t initial, const size_t grow);
28+
29+
// free set
30+
void oset_free(const void* const set);
31+
32+
// free map and vals, NULL free_val uses free()
33+
void oset_free_vals(const struct OSet* const set, void (*free_val)(const void* const val));
34+
35+
// free iter
36+
void oset_iter_free(const struct OSetIter* const iter);
37+
38+
/*
39+
* Access
40+
*/
41+
42+
// true if this set contains the specified element
43+
bool oset_contains(const struct OSet* const set, const void* const val);
44+
45+
// number of values
46+
size_t oset_size(const struct OSet* const set);
47+
48+
// create an iterator, caller must oset_iter_free or invoke oset_next until NULL
49+
const struct OSetIter *oset_iter(const struct OSet* const set);
50+
51+
// next iterator value, NULL at end of set
52+
const struct OSetIter *oset_next(const struct OSetIter* const iter);
53+
54+
/*
55+
* Mutate
56+
*/
57+
58+
// true if this set did not already contain the specified element
59+
bool oset_add(const struct OSet* const set, const void* const val);
60+
61+
// true if this set contained the element
62+
bool oset_remove(const struct OSet* const set, const void* const val);
63+
64+
#endif // OSET_H
65+

0 commit comments

Comments
 (0)