Skip to content

Commit

Permalink
Merge pull request #786 from davidgiven/refactor
Browse files Browse the repository at this point in the history
Even more refactoring.
  • Loading branch information
davidgiven authored Oct 19, 2024
2 parents 3c67a67 + 33d241c commit d6a11d7
Show file tree
Hide file tree
Showing 58 changed files with 141 additions and 148 deletions.
2 changes: 1 addition & 1 deletion arch/agat/agat.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message AgatDecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/amiga/amiga.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message AmigaDecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/apple2/apple2.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message Apple2DecoderProto {
optional uint32 side_one_track_offset = 1
Expand Down
4 changes: 2 additions & 2 deletions arch/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"./victor9k/victor9k.proto",
"./zilogmcz/zilogmcz.proto",
],
deps=["lib+common_proto"],
deps=["lib/config+common_proto"],
)

protocc(name="proto_lib", srcs=[".+proto"], deps=["lib+common_proto_lib"])
protocc(name="proto_lib", srcs=[".+proto"], deps=["lib/config+common_proto_lib"])

cxxlibrary(
name="arch",
Expand Down
2 changes: 1 addition & 1 deletion arch/c64/c64.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message Commodore64DecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/ibm/ibm.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message IbmDecoderProto {
// Next: 11
Expand Down
2 changes: 1 addition & 1 deletion arch/macintosh/macintosh.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message MacintoshDecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/micropolis/micropolis.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message MicropolisDecoderProto {
enum ChecksumType {
Expand Down
2 changes: 1 addition & 1 deletion arch/northstar/northstar.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message NorthstarDecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/tartu/tartu.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message TartuDecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/tids990/tids990.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message Tids990DecoderProto {}

Expand Down
2 changes: 1 addition & 1 deletion arch/victor9k/victor9k.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";

message Victor9kDecoderProto {}

Expand Down
30 changes: 0 additions & 30 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,6 @@

clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"})

cxxlibrary(
name="lib",
srcs=[
"./lib/readerwriter.cc",
],
hdrs={
"lib/readerwriter.h": "./lib/readerwriter.h",
},
deps=[
"+fmt_lib",
"+protocol",
"dep/adflib",
"dep/fatfs",
"dep/hfsutils",
"dep/libusbp",
"dep/stb",
"src/formats",
"lib/core",
"lib/config",
"lib/data",
"lib/external",
"lib/fluxsink",
"lib/fluxsource",
"lib/imagereader",
"lib/imagewriter",
"lib/decoders",
"lib/encoders",
],
)

corpustests = []
if not glob("../fluxengine-testdata/data"):
print("fluxengine-testdata not found; skipping corpus tests")
Expand Down
21 changes: 21 additions & 0 deletions lib/algorithms/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from build.c import cxxlibrary

cxxlibrary(
name="algorithms",
srcs=["./readerwriter.cc"],
hdrs={
"lib/algorithms/readerwriter.h": "./readerwriter.h",
},
deps=[
"lib/core",
"lib/config",
"lib/data",
"lib/usb",
"lib/encoders",
"lib/decoders",
"lib/fluxsource",
"lib/fluxsink",
"lib/imagereader",
"lib/imagewriter",
],
)
2 changes: 1 addition & 1 deletion lib/readerwriter.cc → lib/algorithms/readerwriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lib/config/config.h"
#include "lib/config/flags.h"
#include "lib/data/fluxmap.h"
#include "lib/readerwriter.h"
#include "lib/algorithms/readerwriter.h"
#include "protocol.h"
#include "lib/usb/usb.h"
#include "lib/encoders/encoders.h"
Expand Down
File renamed without changes.
33 changes: 0 additions & 33 deletions lib/build.py

This file was deleted.

62 changes: 47 additions & 15 deletions lib/config/build.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,71 @@
from build.c import cxxlibrary
from build.protobuf import proto, protocc

proto(name="common_proto", srcs=["./common.proto"])
protocc(
name="common_proto_lib", srcs=[".+common_proto"], deps=["+protobuf_lib"]
)

proto(
name="drive_proto",
srcs=["./drive.proto"],
deps=[".+common_proto", "lib/external+fl2_proto", ".+layout_proto"],
)
protocc(
name="drive_proto_lib",
srcs=[".+drive_proto"],
deps=[
".+layout_proto_lib",
".+common_proto_lib",
"lib/external+fl2_proto_lib",
],
)

proto(
name="layout_proto",
srcs=["./layout.proto"],
deps=[".+common_proto", "lib/external+fl2_proto"],
)
protocc(
name="layout_proto_lib",
srcs=[".+layout_proto"],
deps=[".+common_proto_lib", "lib/external+fl2_proto_lib"],
)

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

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

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

class ConfigProto;
class OptionProto;
Expand Down
6 changes: 3 additions & 3 deletions lib/config/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import "lib/fluxsource/fluxsource.proto";
import "lib/fluxsink/fluxsink.proto";
import "lib/usb/usb.proto";
import "lib/vfs/vfs.proto";
import "lib/drive.proto";
import "lib/common.proto";
import "lib/layout.proto";
import "lib/config/drive.proto";
import "lib/config/common.proto";
import "lib/config/layout.proto";

enum SupportStatus
{
Expand Down
2 changes: 1 addition & 1 deletion lib/drive.proto → lib/config/drive.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";
import "lib/external/fl2.proto";

// Next: 15
Expand Down
2 changes: 1 addition & 1 deletion lib/layout.proto → lib/config/layout.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

import "lib/common.proto";
import "lib/config/common.proto";
import "lib/external/fl2.proto";

message SectorListProto
Expand Down
2 changes: 1 addition & 1 deletion lib/config/proto.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "lib/core/globals.h"
#include "lib/config/proto.h"
#include "lib/common.pb.h"
#include "lib/config/common.pb.h"
#include <regex>

static ConfigProto config = []()
Expand Down
2 changes: 1 addition & 1 deletion lib/config/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PROTO_H

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

class ProtoPathNotFoundException : public ErrorException
Expand Down
4 changes: 2 additions & 2 deletions lib/decoders/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
proto(
name="proto",
srcs=["./decoders.proto"],
deps=["lib+common_proto", "arch+proto", "lib/fluxsink+proto"],
deps=["lib/config+common_proto", "arch+proto", "lib/fluxsink+proto"],
)

protocc(
name="proto_lib",
srcs=[".+proto"],
deps=["lib+common_proto_lib", "arch+proto_lib", "lib/fluxsink+proto_lib"],
deps=["lib/config+common_proto_lib", "arch+proto_lib", "lib/fluxsink+proto_lib"],
)

cxxlibrary(
Expand Down
2 changes: 1 addition & 1 deletion lib/decoders/decoders.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "arch/tids990/tids990.proto";
import "arch/victor9k/victor9k.proto";
import "arch/zilogmcz/zilogmcz.proto";
import "lib/fluxsink/fluxsink.proto";
import "lib/common.proto";
import "lib/config/common.proto";

//NEXT: 33
message DecoderProto {
Expand Down
4 changes: 2 additions & 2 deletions lib/encoders/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
proto(
name="proto",
srcs=["./encoders.proto"],
deps=["lib+common_proto", "arch+proto"],
deps=["lib/config+common_proto", "arch+proto"],
)
protocc(
name="proto_lib",
srcs=[".+proto"],
deps=["lib+common_proto_lib", "arch+proto_lib"],
deps=["lib/config+common_proto_lib", "arch+proto_lib"],
)

cxxlibrary(
Expand Down
4 changes: 2 additions & 2 deletions lib/fluxsink/build.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from build.protobuf import proto, protocc
from build.c import cxxlibrary

proto(name="proto", srcs=["./fluxsink.proto"], deps=["lib+common_proto"])
protocc(name="proto_lib", srcs=[".+proto"], deps=["lib+common_proto_lib"])
proto(name="proto", srcs=["./fluxsink.proto"], deps=["lib/config+common_proto"])
protocc(name="proto_lib", srcs=[".+proto"], deps=["lib/config+common_proto_lib"])

cxxlibrary(
name="fluxsink",
Expand Down
Loading

0 comments on commit d6a11d7

Please sign in to comment.