Skip to content
Snippets Groups Projects
Commit 1aa72c5c authored by ghuter's avatar ghuter
Browse files

rename counter_ex to sensor_ex

parent 10d6b8c4
No related branches found
No related tags found
4 merge requests!9fix sensor example (doc),!4Amd, Tests, Doc, CI/CD,!2build system (v0), add long options,!1build system (v0), add long options, corrections
......@@ -5,7 +5,7 @@
# normally, this part is done with `configure.sh`, but here we need to
# do this manually
cat <<EOF > src/sensors.h
#include "counter_ex.h"
#include "sensor_ex.h"
#define NB_SENSOR 1
#define NB_SENSOR_OPT 1
......@@ -13,22 +13,22 @@ cat <<EOF > src/sensors.h
void init_sensors(Optparse *opts, Sensor *sensors, size_t len, size_t offset, int *nb_defined)
{
int opt_idx = offset;
for (int i = 0; i < counter_ex.nb_opt; i++) {
opts[opt_idx++] = counter_ex_opt[i];
for (int i = 0; i < sensor_ex.nb_opt; i++) {
opts[opt_idx++] = sensor_ex_opt[i];
}
sensors[(*nb_defined)++] = counter_ex;
sensors[(*nb_defined)++] = sensor_ex;
assert((offset + *nb_defined) <= len);
}
EOF
# idem
echo 'CAPTOR_OBJ = doc/counters_ex.o' > sensors.mk
echo 'CAPTOR_OBJ = doc/sensor_ex.o' > sensors.mk
# actual compilation here
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og -c doc/counter_ex.c -o obj/counter_ex.o
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og -c doc/sensor_ex.c -o obj/sensor_ex.o
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og -c doc/util.c -o obj/util.o
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og -c doc/mojitos.c -o obj/mojitos.o
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og obj/util.o obj/mojitos.o obj/counter_ex.o -o bin/mojitos
gcc -std=gnu99 -Wall -Wpedantic -I./lib -I./doc -I./src -g -Og obj/util.o obj/mojitos.o obj/sensor_ex.o -o bin/mojitos
*
**/
......
/*
* Example of a basic counter: an accumulator
* Example of a basic sensor: an accumulator
**/
unsigned int init_acc(char *, void **);
......@@ -7,7 +7,7 @@ unsigned int get_acc(uint64_t *results, void *);
void clean_acc(void *);
void label_acc(char **labels, void *);
Sensor counter_ex = {
Sensor sensor_ex = {
.init = init_acc,
.get = get_acc,
.clean = clean_acc,
......@@ -15,7 +15,7 @@ Sensor counter_ex = {
.nb_opt = 1,
};
Optparse counter_ex_opt[1] = {
Optparse sensor_ex_opt[1] = {
{
.longname = "accumulator",
.shortname = 'a',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment