Skip to content

Commit

Permalink
Create a config module containing all the configuration, proto and flags
Browse files Browse the repository at this point in the history
stuff.
  • Loading branch information
davidgiven committed Oct 13, 2024
1 parent 9ddfa5a commit e1f2494
Show file tree
Hide file tree
Showing 128 changed files with 301 additions and 288 deletions.
2 changes: 1 addition & 1 deletion arch/ibm/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "lib/decoders/fluxpattern.h"
#include "lib/sector.h"
#include "arch/ibm/ibm.pb.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/layout.h"
#include <string.h>

Expand Down
4 changes: 2 additions & 2 deletions arch/ibm/encoder.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "ibm.h"
Expand All @@ -9,7 +9,7 @@
#include "arch/ibm/ibm.pb.h"
#include "lib/encoders/encoders.pb.h"
#include "fmt/format.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/layout.h"
#include <ctype.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/tartu/decoder.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/decoders/decoders.h"
#include "arch/tartu/tartu.h"
#include "lib/core/crc.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/tartu/encoder.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "arch/tartu/tartu.h"
Expand Down
8 changes: 1 addition & 7 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
cxxlibrary(
name="lib",
srcs=[
"./lib/config.cc",
"./lib/decoders/decoders.cc",
"./lib/decoders/fluxdecoder.cc",
"./lib/decoders/fluxmapreader.cc",
"./lib/decoders/fluxpattern.cc",
"./lib/decoders/fmmfm.cc",
"./lib/encoders/encoders.cc",
"./lib/fl2.cc",
"./lib/flags.cc",
"./lib/fluxmap.cc",
"./lib/fluxsink/a2rfluxsink.cc",
"./lib/fluxsink/aufluxsink.cc",
Expand Down Expand Up @@ -83,7 +81,6 @@
"./lib/layout.cc",
"./lib/ldbs.cc",
"./lib/logrenderer.cc",
"./lib/proto.cc",
"./lib/readerwriter.cc",
"./lib/sector.cc",
"./lib/usb/applesauceusb.cc",
Expand Down Expand Up @@ -156,7 +153,6 @@
"arch/c64/c64.h": "./arch/c64/c64.h",
"arch/tartu/tartu.h": "./arch/tartu/tartu.h",
"lib/a2r.h": "./lib/a2r.h",
"lib/config.h": "./lib/config.h",
"lib/decoders/decoders.h": "./lib/decoders/decoders.h",
"lib/decoders/fluxdecoder.h": "./lib/decoders/fluxdecoder.h",
"lib/decoders/fluxmapreader.h": "./lib/decoders/fluxmapreader.h",
Expand All @@ -165,7 +161,6 @@
"lib/encoders/encoders.h": "./lib/encoders/encoders.h",
"lib/scp.h": "./lib/scp.h",
"lib/fl2.h": "./lib/fl2.h",
"lib/flags.h": "./lib/flags.h",
"lib/flux.h": "./lib/flux.h",
"lib/fluxmap.h": "./lib/fluxmap.h",
"lib/fluxsink/fluxsink.h": "./lib/fluxsink/fluxsink.h",
Expand All @@ -179,7 +174,6 @@
"lib/imagewriter/imagewriter.h": "./lib/imagewriter/imagewriter.h",
"lib/layout.h": "./lib/layout.h",
"lib/ldbs.h": "./lib/ldbs.h",
"lib/proto.h": "./lib/proto.h",
"lib/readerwriter.h": "./lib/readerwriter.h",
"lib/sector.h": "./lib/sector.h",
"lib/usb/applesauce.h": "./lib/usb/applesauce.h",
Expand All @@ -196,8 +190,8 @@
"dep/hfsutils",
"dep/libusbp",
"dep/stb",
"lib+config_proto_lib",
"lib/core",
"lib/config",
"lib/fluxsource+proto_lib",
],
)
Expand Down
35 changes: 0 additions & 35 deletions lib/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,3 @@
srcs=[".+drive_proto"],
deps=[".+common_proto_lib", "+fl2_proto_lib", ".+layout_proto_lib"],
)

proto(
name="config_proto",
srcs=["./config.proto"],
deps=[
".+common_proto",
".+layout_proto",
".+drive_proto",
"+fl2_proto",
"lib/fluxsource+proto",
"lib/fluxsink+proto",
"lib/vfs+proto",
"lib/usb+proto",
"lib/encoders+proto",
"lib/decoders+proto",
"lib/imagereader+proto",
"lib/imagewriter+proto",
],
)

protocc(
name="config_proto_lib",
srcs=[".+common_proto", ".+config_proto", "arch+proto", "+fl2_proto"],
deps=[
"lib/fluxsource+proto_lib",
"lib/fluxsink+proto_lib",
"lib/vfs+proto_lib",
"lib/usb+proto_lib",
"lib/encoders+proto_lib",
"lib/decoders+proto_lib",
"lib/imagereader+proto_lib",
"lib/imagewriter+proto_lib",
"lib+drive_proto_lib",
],
)
56 changes: 56 additions & 0 deletions lib/config/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from build.c import cxxlibrary
from build.protobuf import proto, protocc

proto(
name="proto",
srcs=["./config.proto"],
deps=[
"lib+common_proto",
"lib+layout_proto",
"lib+drive_proto",
"+fl2_proto",
"lib/fluxsource+proto",
"lib/fluxsink+proto",
"lib/vfs+proto",
"lib/usb+proto",
"lib/encoders+proto",
"lib/decoders+proto",
"lib/imagereader+proto",
"lib/imagewriter+proto",
],
)

protocc(
name="proto_lib",
srcs=[".+proto", "arch+proto", "+fl2_proto"],
deps=[
"lib/fluxsource+proto_lib",
"lib/fluxsink+proto_lib",
"lib/vfs+proto_lib",
"lib/usb+proto_lib",
"lib/encoders+proto_lib",
"lib/decoders+proto_lib",
"lib/imagereader+proto_lib",
"lib/imagewriter+proto_lib",
"lib+drive_proto_lib",
],
)

cxxlibrary(
name="config",
srcs=[
"./config.cc",
"./proto.cc",
"./flags.cc",
],
hdrs={
"lib/config/config.h": "./config.h",
"lib/config/proto.h": "./proto.h",
"lib/config/flags.h": "./flags.h",
},
deps=[
"lib/core",
".+proto_lib",
"+fmt_lib",
],
)
4 changes: 2 additions & 2 deletions lib/config.cc → lib/config/config.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/proto.h"
#include "lib/config/config.h"
#include "lib/config/proto.h"
#include "lib/core/logger.h"
#include "lib/core/utils.h"
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion lib/config.h → lib/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifdef __cplusplus

#include <google/protobuf/message.h>
#include "lib/config.pb.h"
#include "lib/config/config.pb.h"
#include "lib/common.pb.h"

class ConfigProto;
Expand Down
File renamed without changes.
8 changes: 3 additions & 5 deletions lib/flags.cc → lib/config/flags.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/flags.h"
#include "lib/proto.h"
#include "lib/config/config.h"
#include "lib/config/flags.h"
#include "lib/config/proto.h"
#include "lib/core/utils.h"
#include "lib/core/logger.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/imagereader/imagereader.h"
#include <google/protobuf/text_format.h>
#include <regex>
#include <fstream>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/proto.cc → lib/config/proto.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/common.pb.h"
#include <regex>

Expand Down
2 changes: 1 addition & 1 deletion lib/proto.h → lib/config/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <google/protobuf/message.h>
#include "lib/common.pb.h"
#include "lib/config.pb.h"
#include "lib/config/config.pb.h"

class ProtoPathNotFoundException : public ErrorException
{
Expand Down
4 changes: 2 additions & 2 deletions lib/decoders/decoders.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "lib/core/globals.h"
#include "lib/flags.h"
#include "lib/config/flags.h"
#include "lib/fluxmap.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "arch/agat/agat.h"
Expand Down
4 changes: 2 additions & 2 deletions lib/decoders/fluxmapreader.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/fluxpattern.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "protocol.h"
#include <numeric>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/decoders/fluxmapreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define FLUXMAPREADER_H

#include "lib/fluxmap.h"
#include "lib/flags.h"
#include "lib/config/flags.h"
#include "protocol.h"

class DecoderProto;
Expand Down
4 changes: 2 additions & 2 deletions lib/decoders/fluxpattern.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxpattern.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "protocol.h"
#include <numeric>
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/decoders/fluxpattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "lib/core/utils.h"
#include "lib/fluxmap.h"
#include "lib/flags.h"
#include "lib/config/flags.h"
#include "protocol.h"

class FluxMatcher;
Expand Down
4 changes: 2 additions & 2 deletions lib/encoders/encoders.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/config/config.h"
#include "lib/fluxmap.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
Expand All @@ -16,7 +16,7 @@
#include "arch/tids990/tids990.h"
#include "arch/victor9k/victor9k.h"
#include "lib/encoders/encoders.pb.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/layout.h"
#include "lib/image.h"
#include "protocol.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/fl2.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "lib/core/globals.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/fluxmap.h"
#include "lib/fl2.pb.h"
#include <fstream>
Expand Down
4 changes: 2 additions & 2 deletions lib/fluxsink/a2rfluxsink.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "lib/core/globals.h"
#include "lib/flags.h"
#include "lib/config/flags.h"
#include "lib/fluxmap.h"
#include "lib/core/bytes.h"
#include "protocol.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "lib/core/logger.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/fluxmap.h"
#include "lib/layout.h"
#include "lib/a2r.h"
Expand Down
4 changes: 2 additions & 2 deletions lib/fluxsink/aufluxsink.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "lib/core/globals.h"
#include "lib/flags.h"
#include "lib/config/flags.h"
#include "lib/fluxmap.h"
#include "lib/core/bytes.h"
#include "protocol.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>
Expand Down
6 changes: 3 additions & 3 deletions lib/fluxsink/fl2fluxsink.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/flags.h"
#include "lib/config/config.h"
#include "lib/config/flags.h"
#include "lib/fluxmap.h"
#include "lib/core/bytes.h"
#include "protocol.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/fl2.pb.h"
#include "lib/fl2.h"
#include <fstream>
Expand Down
8 changes: 4 additions & 4 deletions lib/fluxsink/fluxsink.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "lib/core/globals.h"
#include "lib/flags.h"
#include "lib/config.h"
#include "lib/config/flags.h"
#include "lib/config/config.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/config.pb.h"
#include "lib/proto.h"
#include "lib/config/config.pb.h"
#include "lib/config/proto.h"
#include "lib/core/utils.h"
#include <regex>

Expand Down
2 changes: 1 addition & 1 deletion lib/fluxsink/fluxsink.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef FLUXSINK_H
#define FLUXSINK_H

#include "lib/flags.h"
#include "lib/config/flags.h"
#include <ostream>

class Fluxmap;
Expand Down
6 changes: 3 additions & 3 deletions lib/fluxsink/hardwarefluxsink.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "lib/core/globals.h"
#include "lib/config.h"
#include "lib/flags.h"
#include "lib/config/config.h"
#include "lib/config/flags.h"
#include "lib/fluxmap.h"
#include "lib/core/logger.h"
#include "lib/proto.h"
#include "lib/config/proto.h"
#include "lib/usb/usb.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/fluxsink/fluxsink.pb.h"
Expand Down
Loading

0 comments on commit e1f2494

Please sign in to comment.