First steps towards reworking the build system... again.

This commit is contained in:
David Given
2023-10-21 23:02:46 +02:00
parent bbdfa0d651
commit f5f223f622
175 changed files with 2159 additions and 1068 deletions

310
Makefile
View File

@@ -1,305 +1,9 @@
#Special Windows settings.
CC = gcc
CXX = g++
ifeq ($(OS), Windows_NT)
MINGWBIN = /mingw32/bin
CCPREFIX = $(MINGWBIN)/
LUA = $(MINGWBIN)/lua
PKG_CONFIG = $(MINGWBIN)/pkg-config
WX_CONFIG = /usr/bin/sh $(MINGWBIN)/wx-config --static=yes
PROTOC = $(MINGWBIN)/protoc
PLATFORM = WINDOWS
LDFLAGS += \
-static
CXXFLAGS += \
-std=c++17 \
-fext-numeric-literals \
-Wno-deprecated-enum-float-conversion \
-Wno-deprecated-enum-enum-conversion
OBJ = .obj
#Required to get the gcc run - time libraries on the path.
export PATH := $(PATH):$(MINGWBIN)
EXT ?= .exe
endif
#Special OSX settings.
ifeq ($(shell uname),Darwin)
PLATFORM = OSX
LDFLAGS += \
-framework IOKit \
-framework Foundation
endif
ifeq ($(shell uname),FreeBSD)
PLATFORM = FreeBSD
CFLAGS += -I/usr/local/include
endif
#Check the Make version.
ifeq ($(findstring 4.,$(MAKE_VERSION)),)
$(error You need GNU Make 4.x for this (if you're on OSX, use gmake).)
endif
#Normal settings.
OBJDIR ?= .obj
CCPREFIX ?=
LUA ?= lua
CC ?= $(CCPREFIX)gcc
CXX ?= $(CCPREFIX)g++
AR ?= $(CCPREFIX)ar
PKG_CONFIG ?= pkg-config
WX_CONFIG ?= wx-config
PROTOC ?= protoc
CFLAGS ?= -g -O3
CXXFLAGS += -std=c++17
LDFLAGS ?=
PLATFORM ?= UNIX
TESTS ?= yes
EXT ?=
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
CFLAGS += \
-Iarch \
-Ilib \
-I. \
-I$(OBJDIR)/arch \
-I$(OBJDIR)/lib \
-I$(OBJDIR) \
-Wno-deprecated-declarations \
LDFLAGS += \
-lz \
-lfmt
.SUFFIXES:
.DELETE_ON_ERROR:
define nl
endef
empty :=
space := $(empty) $(empty)
use-library = $(eval $(use-library-impl))
define use-library-impl
$1: $(call $3_LIB)
$1: private LDFLAGS += $(call $3_LDFLAGS)
$2: private CFLAGS += $(call $3_CFLAGS)
endef
use-pkgconfig = $(eval $(use-pkgconfig-impl))
define use-pkgconfig-impl
ifneq ($(strip $(shell $(PKG_CONFIG) $3; echo $$?)),0)
$$(error Missing required pkg-config dependency: $3)
endif
$(1): private LDFLAGS += $(shell $(PKG_CONFIG) --libs $(3))
$(2): private CFLAGS += $(shell $(PKG_CONFIG) --cflags $(3))
endef
.PHONY: all binaries tests clean install install-bin
all: binaries tests docs
PROTOS = \
arch/aeslanier/aeslanier.proto \
arch/agat/agat.proto \
arch/amiga/amiga.proto \
arch/apple2/apple2.proto \
arch/brother/brother.proto \
arch/c64/c64.proto \
arch/f85/f85.proto \
arch/fb100/fb100.proto \
arch/ibm/ibm.proto \
arch/macintosh/macintosh.proto \
arch/micropolis/micropolis.proto \
arch/mx/mx.proto \
arch/northstar/northstar.proto \
arch/rolandd20/rolandd20.proto \
arch/smaky6/smaky6.proto \
arch/tids990/tids990.proto \
arch/victor9k/victor9k.proto \
arch/zilogmcz/zilogmcz.proto \
lib/common.proto \
lib/config.proto \
lib/decoders/decoders.proto \
lib/drive.proto \
lib/encoders/encoders.proto \
lib/fl2.proto \
lib/fluxsink/fluxsink.proto \
lib/fluxsource/fluxsource.proto \
lib/imagereader/imagereader.proto \
lib/imagewriter/imagewriter.proto \
lib/layout.proto \
lib/usb/usb.proto \
lib/vfs/vfs.proto \
tests/testproto.proto \
PROTO_HDRS = $(patsubst %.proto, $(OBJDIR)/%.pb.h, $(PROTOS))
PROTO_SRCS = $(patsubst %.proto, $(OBJDIR)/%.pb.cc, $(PROTOS))
PROTO_OBJS = $(patsubst %.cc, %.o, $(PROTO_SRCS))
PROTO_CFLAGS := $(shell $(PKG_CONFIG) --cflags protobuf)
$(PROTO_SRCS): | $(PROTO_HDRS)
$(PROTO_OBJS): CFLAGS += $(PROTO_CFLAGS)
PROTO_LIB = $(OBJDIR)/libproto.a
$(PROTO_LIB): $(PROTO_OBJS)
PROTO_LDFLAGS := $(shell $(PKG_CONFIG) --libs protobuf) -pthread
.PRECIOUS: $(PROTO_HDRS) $(PROTO_SRCS)
include dep/agg/build.mk
include dep/libusbp/build.mk
include dep/stb/build.mk
include dep/emu/build.mk
include dep/fatfs/build.mk
include dep/adflib/build.mk
include dep/hfsutils/build.mk
include scripts/build.mk
include lib/build.mk
include arch/build.mk
include src/build.mk
include src/gui/build.mk
include tools/build.mk
include tests/build.mk
do-encodedecodetest = $(eval $(do-encodedecodetest-impl))
define do-encodedecodetest-impl
tests: $(OBJDIR)/$1$$(subst $$(space),_,$3).flux.encodedecode
$(OBJDIR)/$1$$(subst $$(space),_,$3).flux.encodedecode: scripts/encodedecodetest.sh $(FLUXENGINE_BIN) $2
@mkdir -p $(dir $$@)
@echo ENCODEDECODETEST $1 flux $(FLUXENGINE_BIN) $2 $3
@scripts/encodedecodetest.sh $1 flux $(FLUXENGINE_BIN) $2 $3 > $$@
tests: $(OBJDIR)/$1$$(subst $$(space),_,$3).scp.encodedecode
$(OBJDIR)/$1$$(subst $$(space),_,$3).scp.encodedecode: scripts/encodedecodetest.sh $(FLUXENGINE_BIN) $2
@mkdir -p $(dir $$@)
@echo ENCODEDECODETEST $1 scp $(FLUXENGINE_BIN) $2 $3
@scripts/encodedecodetest.sh $1 scp $(FLUXENGINE_BIN) $2 $3 > $$@
endef
$(call do-encodedecodetest,agat,,--drive.tpi=96)
$(call do-encodedecodetest,amiga,,--drive.tpi=135)
$(call do-encodedecodetest,apple2,,--140 --drive.tpi=96)
$(call do-encodedecodetest,atarist,,--360 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--370 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--400 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--410 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--720 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--740 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--800 --drive.tpi=135)
$(call do-encodedecodetest,atarist,,--820 --drive.tpi=135)
$(call do-encodedecodetest,bk)
$(call do-encodedecodetest,brother,,--120 --drive.tpi=135)
$(call do-encodedecodetest,brother,,--240 --drive.tpi=135)
$(call do-encodedecodetest,commodore,scripts/commodore1541_test.textpb,--171 --drive.tpi=96)
$(call do-encodedecodetest,commodore,scripts/commodore1541_test.textpb,--192 --drive.tpi=96)
$(call do-encodedecodetest,commodore,,--800 --drive.tpi=135)
$(call do-encodedecodetest,commodore,,--1620 --drive.tpi=135)
$(call do-encodedecodetest,hplif,,--264 --drive.tpi=135)
$(call do-encodedecodetest,hplif,,--608 --drive.tpi=135)
$(call do-encodedecodetest,hplif,,--616 --drive.tpi=135)
$(call do-encodedecodetest,hplif,,--770 --drive.tpi=135)
$(call do-encodedecodetest,ibm,,--1200 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--1232 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--1440 --drive.tpi=135)
$(call do-encodedecodetest,ibm,,--1680 --drive.tpi=135)
$(call do-encodedecodetest,ibm,,--180 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--160 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--320 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--360 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--720_96 --drive.tpi=96)
$(call do-encodedecodetest,ibm,,--720_135 --drive.tpi=135)
$(call do-encodedecodetest,mac,scripts/mac400_test.textpb,--400 --drive.tpi=135)
$(call do-encodedecodetest,mac,scripts/mac800_test.textpb,--800 --drive.tpi=135)
$(call do-encodedecodetest,n88basic,,--drive.tpi=96)
$(call do-encodedecodetest,rx50,,--drive.tpi=96)
$(call do-encodedecodetest,tids990,,--drive.tpi=48)
$(call do-encodedecodetest,victor9k,,--612 --drive.tpi=96)
$(call do-encodedecodetest,victor9k,,--1224 --drive.tpi=96)
do-corpustest = $(eval $(do-corpustest-impl))
define do-corpustest-impl
tests: $(OBJDIR)/corpustest/$2
$(OBJDIR)/corpustest/$2: $(FLUXENGINE_BIN) \
../fluxengine-testdata/data/$1 ../fluxengine-testdata/data/$2
@mkdir -p $(OBJDIR)/corpustest
@echo CORPUSTEST $1 $2 $3
@$(FLUXENGINE_BIN) read $3 -s ../fluxengine-testdata/data/$1 -o $$@ > $$@.log
@cmp $$@ ../fluxengine-testdata/data/$2
endef
ifneq ($(wildcard ../fluxengine-testdata/data),)
$(call do-corpustest,amiga.flux,amiga.adf,amiga --drive.tpi=135)
$(call do-corpustest,atarist360.flux,atarist360.st,atarist --360 --drive.tpi=135)
$(call do-corpustest,atarist720.flux,atarist720.st,atarist --720 --drive.tpi=135)
$(call do-corpustest,brother120.flux,brother120.img,brother --120 --drive.tpi=135)
$(call do-corpustest,cmd-fd2000.flux,cmd-fd2000.img,commodore --1620 --drive.tpi=135)
$(call do-corpustest,ibm1232.flux,ibm1232.img,ibm --1232 --drive.tpi=96)
$(call do-corpustest,ibm1440.flux,ibm1440.img,ibm --1440 --drive.tpi=135)
$(call do-corpustest,mac800.flux,mac800.dsk,mac --800 --drive.tpi=135)
$(call do-corpustest,micropolis315.flux,micropolis315.img,micropolis --315 --drive.tpi=100)
$(call do-corpustest,northstar87-synthetic.flux,northstar87-synthetic.nsi,northstar --87 --drive.tpi=48)
$(call do-corpustest,northstar175-synthetic.flux,northstar175-synthetic.nsi,northstar --175 --drive.tpi=48)
$(call do-corpustest,northstar350-synthetic.flux,northstar350-synthetic.nsi,northstar --350 --drive.tpi=48)
$(call do-corpustest,victor9k_ss.flux,victor9k_ss.img,victor9k --612 --drive.tpi=96)
$(call do-corpustest,victor9k_ds.flux,victor9k_ds.img,victor9k --1224 --drive.tpi=96)
endif
$(OBJDIR)/%.a:
@mkdir -p $(dir $@)
@echo AR $@
@$(AR) rc $@ $^
%.exe:
@mkdir -p $(dir $@)
@echo LINK $@
@$(CXX) -o $@ $(filter %.o,$^) $(filter %.a,$^) $(LDFLAGS) $(filter %.a,$^) $(LDFLAGS)
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@echo CXX $<
@$(CXX) $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $(@:.o=.d) -c -o $@ $<
$(OBJDIR)/%.o: %.cc
@mkdir -p $(dir $@)
@echo CXX $<
@$(CXX) $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $(@:.o=.d) -c -o $@ $<
$(OBJDIR)/%.o: $(OBJDIR)/%.cc
@mkdir -p $(dir $@)
@echo CXX $<
@$(CXX) $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $(@:.o=.d) -c -o $@ $<
$(OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
@echo CC $<
@$(CC) $(CFLAGS) $(CFLAGS) -MMD -MP -MF $(@:.o=.d) -c -o $@ $<
$(OBJDIR)/%.pb.h: %.proto
@mkdir -p $(dir $@)
@echo PROTOC $@
@$(PROTOC) -I. --cpp_out=$(OBJDIR) $<
clean:
rm -rf $(OBJDIR)
install: install-bin # install-man install-docs ...
install-bin: fluxengine$(EXT) fluxengine-gui$(EXT) brother120tool$(EXT) brother240tool$(EXT) upgrade-flux-file$(EXT)
install -d "$(DESTDIR)$(BINDIR)"
for target in $^; do \
install $$target "$(DESTDIR)$(BINDIR)/$$target"; \
done
-include $(OBJS:%.o=%.d)
.PHONY: all
all: +all
include build/ab.mk

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "aeslanier.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "bytes.h"
#include "lib/crc.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/sector.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>

View File

@@ -1,7 +1,7 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "agat.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
uint8_t agatChecksum(const Bytes& bytes)

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "agat.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "bytes.h"
#include "lib/crc.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/sector.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>

View File

@@ -1,7 +1,7 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "amiga.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
uint32_t amigaChecksum(const Bytes& bytes)

View File

@@ -1,7 +1,7 @@
#ifndef AMIGA_H
#define AMIGA_H
#include "encoders/encoders.h"
#include "lib/encoders/encoders.h"
#define AMIGA_SECTOR_RECORD 0xaaaa44894489LL

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "amiga.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include "lib/decoders/decoders.pb.h"
#include <string.h>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "amiga.h"
#include "crc.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "arch/amiga/amiga.pb.h"
#include "lib/encoders/encoders.pb.h"

View File

@@ -2,8 +2,8 @@
#define APPLE2_H
#include <memory.h>
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#define APPLE2_SECTOR_RECORD 0xd5aa96
#define APPLE2_DATA_RECORD 0xd5aaad

View File

@@ -1,13 +1,13 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "apple2.h"
#include "arch/apple2/apple2.pb.h"
#include "lib/decoders/decoders.pb.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,14 +1,14 @@
#include "globals.h"
#include "lib/globals.h"
#include "arch/apple2/apple2.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "sector.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "lib/sector.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "fmt/format.h"
#include "lib/encoders/encoders.pb.h"
#include <ctype.h>
#include "bytes.h"
#include "lib/bytes.h"
static int encode_data_gcr(uint8_t data)
{

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "brother.h"
#include "sector.h"
#include "bytes.h"
#include "crc.h"
#include "lib/sector.h"
#include "lib/bytes.h"
#include "lib/crc.h"
#include <ctype.h>
const FluxPattern SECTOR_RECORD_PATTERN(32, BROTHER_SECTOR_RECORD);

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "brother.h"
#include "crc.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "arch/brother/brother.pb.h"
#include "lib/encoders/encoders.pb.h"

25
arch/build.py Normal file
View File

@@ -0,0 +1,25 @@
from build.protobuf import proto, protocc
proto(
name="arch_proto",
srcs=[
"./aeslanier/aeslanier.proto",
"./agat/agat.proto",
"./amiga/amiga.proto",
"./apple2/apple2.proto",
"./brother/brother.proto",
"./c64/c64.proto",
"./f85/f85.proto",
"./fb100/fb100.proto",
"./ibm/ibm.proto",
"./macintosh/macintosh.proto",
"./micropolis/micropolis.proto",
"./mx/mx.proto",
"./northstar/northstar.proto",
"./rolandd20/rolandd20.proto",
"./smaky6/smaky6.proto",
"./tids990/tids990.proto",
"./victor9k/victor9k.proto",
"./zilogmcz/zilogmcz.proto",
],
)

View File

@@ -1,4 +1,4 @@
#include "globals.h"
#include "lib/globals.h"
#include "c64.h"
/*

View File

@@ -1,8 +1,8 @@
#ifndef C64_H
#define C64_H
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#define C64_SECTOR_RECORD 0xffd49
#define C64_DATA_RECORD 0xffd57

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "c64.h"
#include "crc.h"
#include "bytes.h"
#include "lib/crc.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,17 +1,17 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "c64.h"
#include "crc.h"
#include "sector.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/sector.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "fmt/format.h"
#include "arch/c64/c64.pb.h"
#include "lib/encoders/encoders.pb.h"
#include "lib/layout.h"
#include <ctype.h>
#include "bytes.h"
#include "lib/bytes.h"
static bool lastBit;

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "f85.h"
#include "crc.h"
#include "bytes.h"
#include "lib/crc.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,13 +1,13 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "fb100.h"
#include "crc.h"
#include "bytes.h"
#include "decoders/rawbits.h"
#include "lib/crc.h"
#include "lib/bytes.h"
#include "lib/decoders/rawbits.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "ibm.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "lib/crc.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/sector.h"
#include "arch/ibm/ibm.pb.h"
#include "proto.h"
#include "lib/proto.h"
#include "lib/layout.h"
#include <string.h>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "ibm.h"
#include "crc.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "arch/ibm/ibm.pb.h"
#include "lib/encoders/encoders.pb.h"
#include "fmt/format.h"

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "macintosh.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "macintosh.h"
#include "crc.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "fmt/format.h"
#include "lib/encoders/encoders.pb.h"
#include "lib/layout.h"

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "micropolis.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include "lib/decoders/decoders.pb.h"

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "lib/globals.h"
#include "micropolis.h"
#include "sector.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "image.h"
#include "lib/sector.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "lib/image.h"
#include "lib/encoders/encoders.pb.h"
static void write_sector(std::vector<bool>& bits,

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "mx/mx.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "lib/crc.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/sector.h"
#include <string.h>
const int SECTOR_SIZE = 256;

View File

@@ -1,7 +1,7 @@
#ifndef MX_H
#define MX_H
#include "decoders/decoders.h"
#include "lib/decoders/decoders.h"
extern std::unique_ptr<Decoder> createMxDecoder(const DecoderProto& config);

View File

@@ -11,13 +11,13 @@
* sure that the hardSectorId is correct.
*/
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "northstar.h"
#include "bytes.h"
#include "lib/bytes.h"
#include "lib/decoders/decoders.pb.h"
#include "fmt/format.h"

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "lib/globals.h"
#include "northstar.h"
#include "sector.h"
#include "bytes.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "image.h"
#include "lib/sector.h"
#include "lib/bytes.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "lib/image.h"
#include "lib/encoders/encoders.pb.h"
#define GAP_FILL_SIZE_SD 30

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "smaky6.h"
#include "bytes.h"
#include "crc.h"
#include "lib/bytes.h"
#include "lib/crc.h"
#include "fmt/format.h"
#include "lib/decoders/decoders.pb.h"
#include <string.h>

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "tids990/tids990.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "lib/crc.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/sector.h"
#include <string.h>
#include <fmt/format.h>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "tids990.h"
#include "crc.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "arch/tids990/tids990.pb.h"
#include "lib/encoders/encoders.pb.h"
#include <fmt/format.h>

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "victor9k.h"
#include "crc.h"
#include "bytes.h"
#include "lib/crc.h"
#include "lib/bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

View File

@@ -1,17 +1,17 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "victor9k.h"
#include "crc.h"
#include "sector.h"
#include "readerwriter.h"
#include "image.h"
#include "lib/crc.h"
#include "lib/sector.h"
#include "lib/readerwriter.h"
#include "lib/image.h"
#include "fmt/format.h"
#include "arch/victor9k/victor9k.pb.h"
#include "lib/encoders/encoders.pb.h"
#include "lib/layout.h"
#include <ctype.h>
#include "bytes.h"
#include "lib/bytes.h"
static bool lastBit;

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "lib/decoders/decoders.h"
#include "lib/sector.h"
#include "zilogmcz.h"
#include "bytes.h"
#include "crc.h"
#include "lib/bytes.h"
#include "lib/crc.h"
#include "fmt/format.h"
#include <string.h>
#include <algorithm>

10
build.py Normal file
View File

@@ -0,0 +1,10 @@
from build.ab import export
from build.c import clibrary
from build.protobuf import proto, protocc
clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"})
proto(name="fl2_proto", srcs=["lib/fl2.proto"])
protocc(name="fl2_proto_lib", srcs=["+fl2_proto"])
export(name="all", items={"fluxengine": "src+fluxengine"}, deps=["+protocol"])

33
build/ab.mk Normal file
View File

@@ -0,0 +1,33 @@
OBJ ?= .obj
PYTHON ?= python3
CC ?= gcc
CXX ?= g++
AR ?= ar
CFLAGS ?= -g -Og
LDFLAGS ?= -g
hide = @
PKG_CONFIG ?= pkg-config
ECHO ?= echo
include $(OBJ)/build.mk
.PHONY: update-ab
update-ab:
@echo "Press RETURN to update ab from the repository, or CTRL+C to cancel." \
&& read a \
&& (curl -L https://github.com/davidgiven/ab/releases/download/dev/distribution.tar.xz | tar xvJf -) \
&& echo "Done."
.PHONY: clean
clean::
@echo [-/-] CLEAN
$(hide) rm -rf $(OBJ) bin
export PYTHONHASHSEED = 1
build-files = $(shell find . -name 'build.py') build/*.py config.py
$(OBJ)/build.mk: Makefile $(build-files)
@echo "AB"
@mkdir -p $(OBJ)
$(hide) $(PYTHON) -X pycache_prefix=$(OBJ) build/ab.py -t +all -o $@ \
build.py || rm -f $@

487
build/ab.py Normal file
View File

@@ -0,0 +1,487 @@
from collections.abc import Iterable, Sequence
from os.path import *
from types import SimpleNamespace
import argparse
import copy
import functools
import importlib
import importlib.abc
import importlib.util
import inspect
import re
import sys
import types
import pathlib
import builtins
import os
defaultGlobals = {}
targets = {}
unmaterialisedTargets = set()
materialisingStack = []
outputFp = None
cwdStack = [""]
sys.path += ["."]
old_import = builtins.__import__
def new_import(name, *args, **kwargs):
if name not in sys.modules:
path = name.replace(".", "/") + ".py"
if isfile(path):
sys.stderr.write(f"loading {path}\n")
loader = importlib.machinery.SourceFileLoader(name, path)
spec = importlib.util.spec_from_loader(
name, loader, origin="built-in"
)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
cwdStack.append(dirname(path))
spec.loader.exec_module(module)
cwdStack.pop()
return old_import(name, *args, **kwargs)
builtins.__import__ = new_import
class ABException(BaseException):
pass
class ParameterList(Sequence):
def __init__(self, parent=[]):
self.data = parent
def __getitem__(self, i):
return self.data[i]
def __len__(self):
return len(self.data)
def __str__(self):
return " ".join(self.data)
def __add__(self, other):
newdata = self.data.copy() + other
return ParameterList(newdata)
def __repr__(self):
return f"<PList: {self.data}>"
class Invocation:
name = None
callback = None
types = None
ins = None
outs = None
binding = None
def materialise(self, replacing=False):
if self in unmaterialisedTargets:
if not replacing and (self in materialisingStack):
print("Found dependency cycle:")
for i in materialisingStack:
print(f" {i.name}")
print(f" {self.name}")
sys.exit(1)
materialisingStack.append(self)
# Perform type conversion to the declared rule parameter types.
try:
self.args = {}
for k, v in self.binding.arguments.items():
if k != "kwargs":
t = self.types.get(k, None)
if t:
v = t(v).convert(self)
self.args[k] = v
else:
for kk, vv in v.items():
t = self.types.get(kk, None)
if t:
vv = t(vv).convert(self)
self.args[kk] = vv
# Actually call the callback.
cwdStack.append(self.cwd)
self.callback(**self.args)
cwdStack.pop()
except BaseException as e:
print(
f"Error materialising {self} ({id(self)}): {self.callback}"
)
print(f"Arguments: {self.args}")
raise e
if self.outs is None:
raise ABException(f"{self.name} didn't set self.outs")
if self in unmaterialisedTargets:
unmaterialisedTargets.remove(self)
materialisingStack.pop()
def __repr__(self):
return "<Invocation %s>" % self.name
def Rule(func):
sig = inspect.signature(func)
@functools.wraps(func)
def wrapper(*, name=None, replaces=None, **kwargs):
cwd = None
if name:
if ("+" in name) and not name.startswith("+"):
(cwd, _) = name.split("+", 1)
if not cwd:
cwd = cwdStack[-1]
if name:
i = Invocation()
if name.startswith("./"):
name = join(cwd, name)
elif "+" not in name:
name = cwd + "+" + name
i.name = name
i.localname = name.split("+")[-1]
if name in targets:
raise ABException(f"target {i.name} has already been defined")
targets[name] = i
elif replaces:
i = replaces
name = i.name
else:
raise ABException("you must supply either name or replaces")
i.cwd = cwd
i.types = func.__annotations__
i.callback = func
setattr(i, func.__name__, SimpleNamespace())
i.binding = sig.bind(name=name, self=i, **kwargs)
i.binding.apply_defaults()
unmaterialisedTargets.add(i)
if replaces:
i.materialise(replacing=True)
return i
defaultGlobals[func.__name__] = wrapper
return wrapper
class Type:
def __init__(self, value):
self.value = value
class Targets(Type):
def convert(self, invocation):
value = self.value
if type(value) is str:
value = [value]
if type(value) is list:
value = targetsof(value, cwd=invocation.cwd)
return value
class Target(Type):
def convert(self, invocation):
value = self.value
if not value:
return None
return targetof(value, cwd=invocation.cwd)
class TargetsMap(Type):
def convert(self, invocation):
value = self.value
if type(value) is dict:
return {
k: targetof(v, cwd=invocation.cwd) for k, v in value.items()
}
raise ABException(f"wanted a dict of targets, got a {type(value)}")
def flatten(*xs):
def recurse(xs):
for x in xs:
if isinstance(x, Iterable) and not isinstance(x, (str, bytes)):
yield from recurse(x)
else:
yield x
return list(recurse(xs))
def fileinvocation(s):
i = Invocation()
i.name = s
i.outs = [s]
targets[s] = i
return i
def targetof(s, cwd):
if isinstance(s, Invocation):
s.materialise()
return s
if s in targets:
t = targets[s]
t.materialise()
return t
if s.startswith("+"):
s = cwd + s
if s.startswith("./"):
s = normpath(join(cwd, s))
if s.startswith("$"):
return fileinvocation(s)
if "+" not in s:
if isdir(s):
s = s + "+" + basename(s)
else:
return fileinvocation(s)
(path, target) = s.split("+", 2)
loadbuildfile(join(path, "build.py"))
if not s in targets:
raise ABException(f"build file at {path} doesn't contain +{target}")
i = targets[s]
i.materialise()
return i
def targetsof(*xs, cwd):
return flatten([targetof(x, cwd) for x in flatten(xs)])
def filenamesof(*xs):
s = []
for t in flatten(xs):
if type(t) == str:
t = normpath(t)
if t not in s:
s += [t]
else:
for f in [normpath(f) for f in filenamesof(t.outs)]:
if f not in s:
s += [f]
return s
def targetnamesof(*xs):
s = []
for x in flatten(xs):
if type(x) == str:
x = normpath(x)
if x not in s:
s += [x]
else:
if x.name not in s:
s += [x.name]
return s
def filenameof(x):
xs = filenamesof(x)
if len(xs) != 1:
raise ABException("expected a single item")
return xs[0]
def stripext(path):
return splitext(path)[0]
def emit(*args):
outputFp.write(" ".join(flatten(args)))
outputFp.write("\n")
def templateexpand(s, invocation):
class Converter:
def __getitem__(self, key):
if key == "self":
return invocation
f = filenamesof(invocation.args[key])
if isinstance(f, Sequence):
f = ParameterList(f)
return f
return eval("f%r" % s, invocation.callback.__globals__, Converter())
def emitter_rule(name, ins, outs, deps=[]):
emit("")
emit(".PHONY:", name)
if outs:
emit(name, ":", filenamesof(outs), ";")
emit(filenamesof(outs), "&:", filenamesof(ins), filenamesof(deps))
else:
emit(name, "&:", filenamesof(ins), filenamesof(deps))
def emitter_endrule(name):
pass
def emitter_label(s):
emit("\t$(hide)", "$(ECHO)", s)
def emitter_exec(cs):
for c in cs:
emit("\t$(hide)", c)
def unmake(*ss):
return [
re.sub(r"\$\(([^)]*)\)", r"$\1", s) for s in flatten(filenamesof(ss))
]
@Rule
def simplerule(
self,
name,
ins: Targets = [],
outs=[],
deps: Targets = [],
commands=[],
label="RULE",
**kwargs,
):
self.ins = ins
self.outs = outs
self.deps = deps
emitter_rule(self.name, ins + deps, outs)
emitter_label(templateexpand("{label} {name}", self))
dirs = []
for out in filenamesof(outs):
dir = dirname(out)
if dir and dir not in dirs:
dirs += [dir]
cs = [("mkdir -p %s" % dir) for dir in dirs]
for c in commands:
cs += [templateexpand(c, self)]
emitter_exec(cs)
emitter_endrule(self.name)
@Rule
def normalrule(
self,
name=None,
ins: Targets = [],
deps: Targets = [],
outs=[],
label="RULE",
objdir=None,
commands=[],
**kwargs,
):
objdir = objdir or join("$(OBJ)", name)
self.normalrule.objdir = objdir
simplerule(
replaces=self,
ins=ins,
deps=deps,
outs=[join(objdir, f) for f in outs],
label=label,
commands=commands,
**kwargs,
)
@Rule
def export(self, name=None, items: TargetsMap = {}, deps: Targets = []):
cs = []
self.ins = items.values()
self.outs = []
for dest, src in items.items():
destf = filenameof(dest)
dir = dirname(destf)
if dir:
cs += ["mkdir -p " + dir]
srcs = filenamesof(src)
if len(srcs) != 1:
raise ABException(
"a dependency of an export must have exactly one output file"
)
cs += ["cp %s %s" % (srcs[0], destf)]
self.outs += [destf]
emitter_rule(self.name, items.values(), self.outs, deps)
emitter_label(f"EXPORT {self.name}")
emitter_exec(cs)
if self.outs:
emit("clean::")
emit("\t$(hide) rm -f " + (" ".join(filenamesof(self.outs))))
self.outs += deps
emitter_endrule(self.name)
def loadbuildfile(filename):
filename = filename.replace("/", ".").removesuffix(".py")
builtins.__import__(filename)
def load(filename):
loadbuildfile(filename)
callerglobals = inspect.stack()[1][0].f_globals
for k, v in defaultGlobals.items():
callerglobals[k] = v
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output")
parser.add_argument("files", nargs="+")
parser.add_argument("-t", "--targets", action="append")
args = parser.parse_args()
if not args.targets:
raise ABException("no targets supplied")
global outputFp
outputFp = open(args.output, "wt")
for k in ("Rule", "Targets", "load", "filenamesof", "stripext"):
defaultGlobals[k] = globals()[k]
global __name__
sys.modules["build.ab"] = sys.modules[__name__]
__name__ = "build.ab"
for f in args.files:
loadbuildfile(f)
for t in flatten([a.split(",") for a in args.targets]):
if t not in targets:
raise ABException("target %s is not defined" % t)
targets[t].materialise()
emit("AB_LOADED = 1\n")
main()

243
build/c.py Normal file
View File

@@ -0,0 +1,243 @@
from os.path import basename, join
from build.ab import (
ABException,
Rule,
Targets,
TargetsMap,
filenameof,
flatten,
filenamesof,
normalrule,
stripext,
)
from os.path import *
def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags):
outleaf = stripext(basename(filenameof(srcs[0]))) + suffix
normalrule(
replaces=self,
ins=srcs,
deps=deps,
outs=[outleaf],
label=label,
commands=commands,
cflags=cflags,
)
@Rule
def cfile(
self,
name,
srcs: Targets = [],
deps: Targets = [],
cflags=[],
suffix=".o",
commands=["$(CC) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"],
label="CC",
):
cfileimpl(self, name, srcs, deps, suffix, commands, label, "cfile", cflags)
@Rule
def cxxfile(
self,
name,
srcs: Targets = [],
deps: Targets = [],
cflags=[],
suffix=".o",
commands=["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"],
label="CXX",
):
cfileimpl(
self, name, srcs, deps, suffix, commands, label, "cxxfile", cflags
)
def findsources(name, srcs, deps, cflags, filerule):
objs = []
for s in flatten(srcs):
ff = [
f
for f in filenamesof(s)
if f.endswith(".c") or f.endswith(".cc") or f.endswith(".cpp")
]
if ff:
for f in ff:
objs += [
filerule(
name=join(name, f.removeprefix("$(OBJ)/")),
srcs=[f],
deps=deps,
cflags=cflags,
)
]
else:
if s not in objs:
objs += [s]
return objs
@Rule
def clibrary(
self,
name,
srcs: Targets = [],
deps: Targets = [],
hdrs: TargetsMap = {},
cflags=[],
commands=["$(AR) cqs {outs[0]} {ins}"],
label="LIB",
):
if not srcs and not hdrs:
raise ABException(
"clibrary contains no sources and no exported headers"
)
libraries = [d for d in deps if hasattr(d, "clibrary")]
for library in libraries:
if library.clibrary.cflags:
cflags += library.clibrary.cflags
if library.clibrary.ldflags:
ldflags += library.clibrary.ldflags
for f in filenamesof(srcs):
if f.endswith(".h"):
deps += [f]
hdrcs = []
hdrins = list(hdrs.values())
hdrouts = []
i = 0
for dest, src in hdrs.items():
s = filenamesof(src)
if len(s) != 1:
raise ABException(
"a dependency of an export must have exactly one output file"
)
hdrcs += ["cp {ins[" + str(i) + "]} {outs[" + str(i) + "]}"]
hdrouts += [dest]
i = i + 1
if srcs:
nr = None
if hdrcs:
hr = normalrule(
name=f"{name}_hdrs",
ins=hdrins,
outs=hdrouts,
label="HEADERS",
commands=hdrcs,
)
hr.materialise()
actualsrcs = findsources(
name,
srcs,
deps + ([f"{name}_hdrs"] if hr else []),
cflags + ([f"-I{hr.normalrule.objdir}"] if hr else []),
cfile,
)
normalrule(
replaces=self,
ins=actualsrcs,
outs=[basename(name) + ".a"],
label=label,
commands=commands if actualsrcs else [],
)
self.clibrary.ldflags = []
self.clibrary.cflags = ["-I" + hr.normalrule.objdir] if hr else []
else:
r = normalrule(
replaces=self,
ins=hdrins,
outs=hdrouts,
label="HEADERS",
commands=hdrcs,
)
r.materialise()
self.clibrary.ldflags = []
self.clibrary.cflags = ["-I" + r.normalrule.objdir]
def programimpl(
self, name, srcs, deps, cflags, ldflags, commands, label, filerule, kind
):
libraries = [d for d in deps if hasattr(d, "clibrary")]
for library in libraries:
if library.clibrary.cflags:
cflags += library.clibrary.cflags
if library.clibrary.ldflags:
ldflags += library.clibrary.ldflags
deps += [f for f in filenamesof(srcs) if f.endswith(".h")]
normalrule(
replaces=self,
ins=(
findsources(name, srcs, deps, cflags, filerule)
+ [f for f in filenamesof(libraries) if f.endswith(".a")]
),
outs=[basename(name)],
deps=deps,
label=label,
commands=commands,
ldflags=ldflags,
)
@Rule
def cprogram(
self,
name,
srcs: Targets = [],
deps: Targets = [],
cflags=[],
ldflags=[],
commands=["$(CC) -o {outs[0]} {ins} {ldflags}"],
label="CLINK",
):
programimpl(
self,
name,
srcs,
deps,
cflags,
ldflags,
commands,
label,
cfile,
"cprogram",
)
@Rule
def cxxprogram(
self,
name,
srcs: Targets = [],
deps: Targets = [],
cflags=[],
ldflags=[],
commands=["$(CXX) -o {outs[0]} {ins} {ldflags}"],
label="CXXLINK",
):
programimpl(
self,
name,
srcs,
deps,
cflags,
ldflags,
commands,
label,
cxxfile,
"cxxprogram",
)

38
build/pkg.py Normal file
View File

@@ -0,0 +1,38 @@
from build.ab import Rule, emit, Target
from types import SimpleNamespace
import os
import subprocess
emit(
"""
PKG_CONFIG ?= pkg-config
PACKAGES := $(shell $(PKG_CONFIG) --list-package-names)
"""
)
@Rule
def package(self, name, package=None, fallback: Target = None):
emit("ifeq ($(filter %s, $(PACKAGES)),)" % package)
if fallback:
emit(f"PACKAGE_CFLAGS_{package} :=", fallback.clibrary.cflags)
emit(f"PACKAGE_LDFLAGS_{package} := ", fallback.clibrary.ldflags)
emit(f"PACKAGE_DEP_{package} := ", fallback.name)
else:
emit(f"$(error Required package '{package}' not installed.)")
emit("else")
emit(
f"PACKAGE_CFLAGS_{package} := $(shell $(PKG_CONFIG) --cflags {package}"
)
emit(
f"PACKAGE_LDFLAGS_{package} := $(shell $(PKG_CONFIG) --ldflags {package}"
)
emit(f"PACKAGE_DEP_{package} := ")
emit("endif")
self.clibrary = SimpleNamespace()
self.clibrary.cflags = [f"$(PACKAGE_CFLAGS_{package})"]
self.clibrary.ldflags = [f"$(PACKAGE_LDFLAGS_{package})"]
self.ins = []
self.outs = [f"$(PACKAGE_DEP_{package})"]

65
build/protobuf.py Normal file
View File

@@ -0,0 +1,65 @@
from os.path import join
from build.ab import Rule, Targets, emit, normalrule, filenamesof, flatten
from build.c import clibrary
import build.pkg
from types import SimpleNamespace
emit(
"""
PROTOC ?= protoc
ifeq ($(filter protobuf, $(PACKAGES)),)
$(error Required package 'protobuf' not installed.)"
endif
"""
)
@Rule
def proto(self, name, srcs: Targets = [], deps: Targets = []):
normalrule(
replaces=self,
ins=srcs,
outs=[f"{name}.descriptor"],
deps=deps,
commands=[
"$(PROTOC) --include_source_info --descriptor_set_out={outs[0]} {ins}"
],
label="PROTO",
)
self.proto.srcs = filenamesof(srcs) + flatten(
[s.proto.srcs for s in flatten(deps)]
)
@Rule
def protocc(self, name, srcs: Targets = [], deps: Targets = []):
outs = []
protos = []
for f in flatten([s.proto.srcs for s in flatten(srcs + deps)]):
if f.endswith(".proto"):
cc = f.replace(".proto", ".pb.cc")
h = f.replace(".proto", ".pb.h")
protos += [f]
srcs += [f]
outs += [cc, h]
r = normalrule(
name=f"{name}_srcs",
ins=protos,
outs=outs,
deps=deps,
commands=["$(PROTOC) --cpp_out={self.normalrule.objdir} {ins}"],
label="PROTOCC",
)
r.materialise()
headers = {
f: join(r.normalrule.objdir, f) for f in outs if f.endswith(".pb.h")
}
clibrary(
replaces=self,
srcs=[f"{name}_srcs"],
hdrs=headers,
cflags=[f"-I{r.normalrule.objdir}"],
)

0
config.py Normal file
View File

View File

@@ -1,16 +1,16 @@
ADFLIB_SRCS = \
dep/adflib/src/adf_bitm.c \
dep/adflib/src/adf_cache.c \
dep/adflib/src/adf_dir.c \
dep/adflib/src/adf_disk.c \
dep/adflib/src/adf_dump.c \
dep/adflib/src/adf_env.c \
dep/adflib/src/adf_file.c \
dep/adflib/src/adf_hd.c \
dep/adflib/src/adf_link.c \
dep/adflib/src/adf_raw.c \
dep/adflib/src/adf_salv.c \
dep/adflib/src/adf_util.c \
DEP/ADFLIB/SRC/ADF_BITM.C \
DEP/ADFLIB/SRC/ADF_CACHE.C \
DEP/ADFLIB/SRC/ADF_DIR.C \
DEP/ADFLIB/SRC/ADF_DISK.C \
DEP/ADFLIB/SRC/ADF_DUMP.C \
DEP/ADFLIB/SRC/ADF_ENV.C \
DEP/ADFLIB/SRC/ADF_FILE.C \
DEP/ADFLIB/SRC/ADF_HD.C \
DEP/ADFLIB/SRC/ADF_LINK.C \
DEP/ADFLIB/SRC/ADF_RAW.C \
DEP/ADFLIB/SRC/ADF_SALV.C \
DEP/ADFLIB/SRC/ADF_UTIL.C \
ADFLIB_OBJS = $(patsubst %.c, $(OBJDIR)/%.o, $(ADFLIB_SRCS))
$(ADFLIB_OBJS): CFLAGS += -Idep/adflib/src -Idep/adflib

46
dep/adflib/build.py Normal file
View File

@@ -0,0 +1,46 @@
from build.c import clibrary
clibrary(
name="adflib",
srcs=[
"./src/adf_bitm.c",
"./src/adf_bitm.h",
"./src/adf_cache.c",
"./src/adf_cache.h",
"./src/adf_dir.c",
"./src/adf_dir.h",
"./src/adf_disk.c",
"./src/adf_disk.h",
"./src/adf_dump.c",
"./src/adf_dump.h",
"./src/adf_env.c",
"./src/adf_env.h",
"./src/adf_file.c",
"./src/adf_file.h",
"./src/adf_hd.c",
"./src/adf_hd.h",
"./src/adf_link.c",
"./src/adf_link.h",
"./src/adf_raw.c",
"./src/adf_raw.h",
"./src/adf_salv.c",
"./src/adf_salv.h",
"./src/adf_str.h",
"./src/adf_util.c",
"./src/adf_util.h",
"./src/defendian.h",
"./src/hd_blk.h",
"./src/prefix.h",
"./adf_nativ.h",
"./config.h",
"./src/adflib.h",
],
cflags=["-Idep/adflib", "-Idep/adflib/src"],
hdrs={
"adflib.h": "./src/adflib.h",
"adf_defs.h": "./src/adf_defs.h",
"adf_str.h": "./src/adf_str.h",
"adf_blk.h": "./src/adf_blk.h",
"adf_err.h": "./src/adf_err.h",
},
)

164
dep/agg/build.py Normal file
View File

@@ -0,0 +1,164 @@
from build.c import clibrary
clibrary(
name="agg",
srcs=[
"./src/agg_arrowhead.cpp",
"./src/agg_line_aa_basics.cpp",
"./src/agg_vcgen_bspline.cpp",
"./src/agg_vpgen_segmentator.cpp",
"./src/agg_color_rgba.cpp",
"./src/agg_sqrt_tables.cpp",
"./src/agg_bspline.cpp",
"./src/agg_curves.cpp",
"./src/agg_rounded_rect.cpp",
"./src/agg_vcgen_markers_term.cpp",
"./src/agg_vcgen_dash.cpp",
"./src/agg2d.cpp",
"./src/agg_trans_affine.cpp",
"./src/agg_gsv_text.cpp",
"./src/agg_vcgen_smooth_poly1.cpp",
"./src/agg_trans_single_path.cpp",
"./src/agg_vpgen_clip_polygon.cpp",
"./src/agg_embedded_raster_fonts.cpp",
"./src/agg_trans_double_path.cpp",
"./src/agg_vcgen_stroke.cpp",
"./src/agg_arc.cpp",
"./src/agg_image_filters.cpp",
"./src/agg_trans_warp_magnifier.cpp",
"./src/agg_vpgen_clip_polyline.cpp",
"./src/agg_bezier_arc.cpp",
"./src/agg_line_profile_aa.cpp",
"./src/agg_vcgen_contour.cpp",
],
hdrs={
"agg2d.h": "./include/agg2d.h",
"agg_alpha_mask_u8.h": "./include/agg_alpha_mask_u8.h",
"agg_arc.h": "./include/agg_arc.h",
"agg_array.h": "./include/agg_array.h",
"agg_arrowhead.h": "./include/agg_arrowhead.h",
"agg_basics.h": "./include/agg_basics.h",
"agg_bezier_arc.h": "./include/agg_bezier_arc.h",
"agg_bitset_iterator.h": "./include/agg_bitset_iterator.h",
"agg_blur.h": "./include/agg_blur.h",
"agg_bounding_rect.h": "./include/agg_bounding_rect.h",
"agg_bspline.h": "./include/agg_bspline.h",
"agg_clip_liang_barsky.h": "./include/agg_clip_liang_barsky.h",
"agg_color_gray.h": "./include/agg_color_gray.h",
"agg_color_rgba.h": "./include/agg_color_rgba.h",
"agg_config.h": "./include/agg_config.h",
"agg_conv_adaptor_vcgen.h": "./include/agg_conv_adaptor_vcgen.h",
"agg_conv_adaptor_vpgen.h": "./include/agg_conv_adaptor_vpgen.h",
"agg_conv_bspline.h": "./include/agg_conv_bspline.h",
"agg_conv_clip_polygon.h": "./include/agg_conv_clip_polygon.h",
"agg_conv_clip_polyline.h": "./include/agg_conv_clip_polyline.h",
"agg_conv_close_polygon.h": "./include/agg_conv_close_polygon.h",
"agg_conv_concat.h": "./include/agg_conv_concat.h",
"agg_conv_contour.h": "./include/agg_conv_contour.h",
"agg_conv_curve.h": "./include/agg_conv_curve.h",
"agg_conv_dash.h": "./include/agg_conv_dash.h",
"agg_conv_gpc.h": "./include/agg_conv_gpc.h",
"agg_conv_marker_adaptor.h": "./include/agg_conv_marker_adaptor.h",
"agg_conv_marker.h": "./include/agg_conv_marker.h",
"agg_conv_segmentator.h": "./include/agg_conv_segmentator.h",
"agg_conv_shorten_path.h": "./include/agg_conv_shorten_path.h",
"agg_conv_smooth_poly1.h": "./include/agg_conv_smooth_poly1.h",
"agg_conv_stroke.h": "./include/agg_conv_stroke.h",
"agg_conv_transform.h": "./include/agg_conv_transform.h",
"agg_conv_unclose_polygon.h": "./include/agg_conv_unclose_polygon.h",
"agg_curves.h": "./include/agg_curves.h",
"agg_dda_line.h": "./include/agg_dda_line.h",
"agg_ellipse_bresenham.h": "./include/agg_ellipse_bresenham.h",
"agg_ellipse.h": "./include/agg_ellipse.h",
"agg_embedded_raster_fonts.h": "./include/agg_embedded_raster_fonts.h",
"agg_font_cache_manager2.h": "./include/agg_font_cache_manager2.h",
"agg_font_cache_manager.h": "./include/agg_font_cache_manager.h",
"agg_gamma_functions.h": "./include/agg_gamma_functions.h",
"agg_gamma_lut.h": "./include/agg_gamma_lut.h",
"agg_glyph_raster_bin.h": "./include/agg_glyph_raster_bin.h",
"agg_gradient_lut.h": "./include/agg_gradient_lut.h",
"agg_gsv_text.h": "./include/agg_gsv_text.h",
"agg_image_accessors.h": "./include/agg_image_accessors.h",
"agg_image_filters.h": "./include/agg_image_filters.h",
"agg_line_aa_basics.h": "./include/agg_line_aa_basics.h",
"agg_math.h": "./include/agg_math.h",
"agg_math_stroke.h": "./include/agg_math_stroke.h",
"agg_path_length.h": "./include/agg_path_length.h",
"agg_path_storage.h": "./include/agg_path_storage.h",
"agg_path_storage_integer.h": "./include/agg_path_storage_integer.h",
"agg_pattern_filters_rgba.h": "./include/agg_pattern_filters_rgba.h",
"agg_pixfmt_amask_adaptor.h": "./include/agg_pixfmt_amask_adaptor.h",
"agg_pixfmt_base.h": "./include/agg_pixfmt_base.h",
"agg_pixfmt_gray.h": "./include/agg_pixfmt_gray.h",
"agg_pixfmt_rgba.h": "./include/agg_pixfmt_rgba.h",
"agg_pixfmt_rgb.h": "./include/agg_pixfmt_rgb.h",
"agg_pixfmt_rgb_packed.h": "./include/agg_pixfmt_rgb_packed.h",
"agg_pixfmt_transposer.h": "./include/agg_pixfmt_transposer.h",
"agg_rasterizer_cells_aa.h": "./include/agg_rasterizer_cells_aa.h",
"agg_rasterizer_compound_aa.h": "./include/agg_rasterizer_compound_aa.h",
"agg_rasterizer_outline_aa.h": "./include/agg_rasterizer_outline_aa.h",
"agg_rasterizer_outline.h": "./include/agg_rasterizer_outline.h",
"agg_rasterizer_scanline_aa.h": "./include/agg_rasterizer_scanline_aa.h",
"agg_rasterizer_scanline_aa_nogamma.h": "./include/agg_rasterizer_scanline_aa_nogamma.h",
"agg_rasterizer_sl_clip.h": "./include/agg_rasterizer_sl_clip.h",
"agg_renderer_base.h": "./include/agg_renderer_base.h",
"agg_renderer_markers.h": "./include/agg_renderer_markers.h",
"agg_renderer_mclip.h": "./include/agg_renderer_mclip.h",
"agg_renderer_outline_aa.h": "./include/agg_renderer_outline_aa.h",
"agg_renderer_outline_image.h": "./include/agg_renderer_outline_image.h",
"agg_renderer_primitives.h": "./include/agg_renderer_primitives.h",
"agg_renderer_raster_text.h": "./include/agg_renderer_raster_text.h",
"agg_renderer_scanline.h": "./include/agg_renderer_scanline.h",
"agg_rendering_buffer_dynarow.h": "./include/agg_rendering_buffer_dynarow.h",
"agg_rendering_buffer.h": "./include/agg_rendering_buffer.h",
"agg_rounded_rect.h": "./include/agg_rounded_rect.h",
"agg_scanline_bin.h": "./include/agg_scanline_bin.h",
"agg_scanline_boolean_algebra.h": "./include/agg_scanline_boolean_algebra.h",
"agg_scanline_p.h": "./include/agg_scanline_p.h",
"agg_scanline_storage_aa.h": "./include/agg_scanline_storage_aa.h",
"agg_scanline_storage_bin.h": "./include/agg_scanline_storage_bin.h",
"agg_scanline_u.h": "./include/agg_scanline_u.h",
"agg_shorten_path.h": "./include/agg_shorten_path.h",
"agg_simul_eq.h": "./include/agg_simul_eq.h",
"agg_span_allocator.h": "./include/agg_span_allocator.h",
"agg_span_converter.h": "./include/agg_span_converter.h",
"agg_span_gouraud_gray.h": "./include/agg_span_gouraud_gray.h",
"agg_span_gouraud.h": "./include/agg_span_gouraud.h",
"agg_span_gouraud_rgba.h": "./include/agg_span_gouraud_rgba.h",
"agg_span_gradient_alpha.h": "./include/agg_span_gradient_alpha.h",
"agg_span_gradient_contour.h": "./include/agg_span_gradient_contour.h",
"agg_span_gradient.h": "./include/agg_span_gradient.h",
"agg_span_gradient_image.h": "./include/agg_span_gradient_image.h",
"agg_span_image_filter_gray.h": "./include/agg_span_image_filter_gray.h",
"agg_span_image_filter.h": "./include/agg_span_image_filter.h",
"agg_span_image_filter_rgba.h": "./include/agg_span_image_filter_rgba.h",
"agg_span_image_filter_rgb.h": "./include/agg_span_image_filter_rgb.h",
"agg_span_interpolator_adaptor.h": "./include/agg_span_interpolator_adaptor.h",
"agg_span_interpolator_linear.h": "./include/agg_span_interpolator_linear.h",
"agg_span_interpolator_persp.h": "./include/agg_span_interpolator_persp.h",
"agg_span_interpolator_trans.h": "./include/agg_span_interpolator_trans.h",
"agg_span_pattern_gray.h": "./include/agg_span_pattern_gray.h",
"agg_span_pattern_rgba.h": "./include/agg_span_pattern_rgba.h",
"agg_span_pattern_rgb.h": "./include/agg_span_pattern_rgb.h",
"agg_span_solid.h": "./include/agg_span_solid.h",
"agg_span_subdiv_adaptor.h": "./include/agg_span_subdiv_adaptor.h",
"agg_trans_affine.h": "./include/agg_trans_affine.h",
"agg_trans_bilinear.h": "./include/agg_trans_bilinear.h",
"agg_trans_double_path.h": "./include/agg_trans_double_path.h",
"agg_trans_perspective.h": "./include/agg_trans_perspective.h",
"agg_trans_single_path.h": "./include/agg_trans_single_path.h",
"agg_trans_viewport.h": "./include/agg_trans_viewport.h",
"agg_trans_warp_magnifier.h": "./include/agg_trans_warp_magnifier.h",
"agg_vcgen_bspline.h": "./include/agg_vcgen_bspline.h",
"agg_vcgen_contour.h": "./include/agg_vcgen_contour.h",
"agg_vcgen_dash.h": "./include/agg_vcgen_dash.h",
"agg_vcgen_markers_term.h": "./include/agg_vcgen_markers_term.h",
"agg_vcgen_smooth_poly1.h": "./include/agg_vcgen_smooth_poly1.h",
"agg_vcgen_stroke.h": "./include/agg_vcgen_stroke.h",
"agg_vcgen_vertex_sequence.h": "./include/agg_vcgen_vertex_sequence.h",
"agg_vertex_sequence.h": "./include/agg_vertex_sequence.h",
"agg_vpgen_clip_polygon.h": "./include/agg_vpgen_clip_polygon.h",
"agg_vpgen_clip_polyline.h": "./include/agg_vpgen_clip_polyline.h",
"agg_vpgen_segmentator.h": "./include/agg_vpgen_segmentator.h",
},
)

18
dep/fatfs/build.py Normal file
View File

@@ -0,0 +1,18 @@
from build.c import clibrary
clibrary(
name="fatfs",
srcs=[
"./source/ff.c",
"./source/ffsystem.c",
"./source/ffunicode.c",
"./source/ff.h",
"./source/ffconf.h",
"./source/diskio.h",
],
hdrs={
"ff.h": "./source/ff.h",
"ffconf.h": "./source/ffconf.h",
"diskio.h": "./source/diskio.h",
},
)

25
dep/hfsutils/build.py Normal file
View File

@@ -0,0 +1,25 @@
from build.c import clibrary
clibrary(
name="hfsutils",
srcs=[
"./libhfs/block.c",
"./libhfs/btree.c",
"./libhfs/data.c",
"./libhfs/file.c",
"./libhfs/hfs.c",
"./libhfs/low.c",
"./libhfs/medium.c",
"./libhfs/memcmp.c",
"./libhfs/node.c",
"./libhfs/record.c",
"./libhfs/version.c",
"./libhfs/volume.c",
],
hdrs={
"apple.h": "./libhfs/apple.h",
"hfs.h": "./libhfs/hfs.h",
"libhfs.h": "./libhfs/libhfs.h",
"os.h": "./libhfs/os.h",
},
)

24
dep/libusbp/build.py Normal file
View File

@@ -0,0 +1,24 @@
from build.c import clibrary
clibrary(
name="libusbp",
srcs=[
"./src/async_in_pipe.c",
"./src/error.c",
"./src/error_hresult.c",
"./src/find_device.c",
"./src/list.c",
"./src/pipe_id.c",
"./src/string.c",
"./src/libusbp_internal.h",
"./include/libusbp_config.h",
"./include/libusbp.h",
],
cflags=["-Idep/libusbp/include", "-Idep/libusbp/src"],
hdrs={
"libusbp_internal.h": "./src/libusbp_internal.h",
"libusbp_config.h": "./include/libusbp_config.h",
"libusbp.hpp": "./include/libusbp.hpp",
"libusbp.h": "./include/libusbp.h",
},
)

7
dep/stb/build.py Normal file
View File

@@ -0,0 +1,7 @@
from build.c import clibrary
clibrary(
name="stb",
srcs=["./stb_image_write.c"],
hdrs={"stb_image_write.h": "./stb_image_write.h"},
)

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "flags.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "dep/agg/include/agg2d.h"
#include "dep/stb/stb_image_write.h"
#include "utils.h"
#include "bitmap.h"
#include "lib/utils.h"
#include "lib/bitmap.h"
#include <regex>
#include <sstream>

156
lib/build.py Normal file
View File

@@ -0,0 +1,156 @@
from build.c import clibrary
from build.protobuf import proto, protocc
clibrary(
name="lib",
cflags=["-I."],
srcs=[
"./bitmap.cc",
"./bytes.cc",
"./config.cc",
"./crc.cc",
"./csvreader.cc",
"./decoders/decoders.cc",
"./decoders/fluxdecoder.cc",
"./decoders/fluxmapreader.cc",
"./decoders/fmmfm.cc",
"./encoders/encoders.cc",
"./fl2.cc",
"./flags.cc",
"./fluxmap.cc",
"./fluxsink/a2rfluxsink.cc",
"./fluxsink/aufluxsink.cc",
"./fluxsink/fl2fluxsink.cc",
"./fluxsink/fluxsink.cc",
"./fluxsink/hardwarefluxsink.cc",
"./fluxsink/scpfluxsink.cc",
"./fluxsink/vcdfluxsink.cc",
"./fluxsource/a2rfluxsource.cc",
"./fluxsource/cwffluxsource.cc",
"./fluxsource/erasefluxsource.cc",
"./fluxsource/fl2fluxsource.cc",
"./fluxsource/fluxsource.cc",
"./fluxsource/flx.cc",
"./fluxsource/flxfluxsource.cc",
"./fluxsource/hardwarefluxsource.cc",
"./fluxsource/kryoflux.cc",
"./fluxsource/kryofluxfluxsource.cc",
"./fluxsource/memoryfluxsource.cc",
"./fluxsource/scpfluxsource.cc",
"./fluxsource/testpatternfluxsource.cc",
"./globals.cc",
"./hexdump.cc",
"./image.cc",
"./imagereader/d64imagereader.cc",
"./imagereader/d88imagereader.cc",
"./imagereader/dimimagereader.cc",
"./imagereader/diskcopyimagereader.cc",
"./imagereader/fdiimagereader.cc",
"./imagereader/imagereader.cc",
"./imagereader/imdimagereader.cc",
"./imagereader/imgimagereader.cc",
"./imagereader/jv3imagereader.cc",
"./imagereader/nfdimagereader.cc",
"./imagereader/nsiimagereader.cc",
"./imagereader/td0imagereader.cc",
"./imagewriter/d64imagewriter.cc",
"./imagewriter/d88imagewriter.cc",
"./imagewriter/diskcopyimagewriter.cc",
"./imagewriter/imagewriter.cc",
"./imagewriter/imdimagewriter.cc",
"./imagewriter/imgimagewriter.cc",
"./imagewriter/ldbsimagewriter.cc",
"./imagewriter/nsiimagewriter.cc",
"./imagewriter/rawimagewriter.cc",
"./layout.cc",
"./ldbs.cc",
"./logger.cc",
"./proto.cc",
"./readerwriter.cc",
"./sector.cc",
"./usb/fluxengineusb.cc",
"./usb/greaseweazle.cc",
"./usb/greaseweazleusb.cc",
"./usb/serial.cc",
"./usb/usb.cc",
"./usb/usbfinder.cc",
"./utils.cc",
"./vfs/acorndfs.cc",
"./vfs/amigaffs.cc",
"./vfs/appledos.cc",
"./vfs/applesingle.cc",
"./vfs/brother120fs.cc",
"./vfs/cbmfs.cc",
"./vfs/cpmfs.cc",
"./vfs/fatfs.cc",
"./vfs/fluxsectorinterface.cc",
"./vfs/imagesectorinterface.cc",
"./vfs/lif.cc",
"./vfs/machfs.cc",
"./vfs/microdos.cc",
"./vfs/philefs.cc",
"./vfs/prodos.cc",
"./vfs/roland.cc",
"./vfs/smaky6fs.cc",
"./vfs/vfs.cc",
"./vfs/zdos.cc",
],
hdrs={
"lib/bitmap.h": "./bitmap.h",
"lib/bytes.h": "./bytes.h",
"lib/config.h": "./config.h",
"lib/csvreader.h": "./csvreader.h",
"lib/decoders/decoders.h": "./decoders/decoders.h",
"lib/decoders/fluxdecoder.h": "./decoders/fluxdecoder.h",
"lib/decoders/fluxmapreader.h": "./decoders/fluxmapreader.h",
"lib/decoders/rawbits.h": "./decoders/rawbits.h",
"lib/encoders/encoders.h": "./encoders/encoders.h",
"lib/fl2.h": "./fl2.h",
"lib/flags.h": "./flags.h",
"lib/flux.h": "./flux.h",
"lib/fluxmap.h": "./fluxmap.h",
"lib/fluxsink/fluxsink.h": "./fluxsink/fluxsink.h",
"lib/fluxsource/fluxsource.h": "lib/fluxsource/fluxsource.h",
"lib/globals.h": "./globals.h",
"lib/image.h": "./image.h",
"lib/imagereader/imagereader.h": "./imagereader/imagereader.h",
"lib/imagewriter/imagewriter.h": "./imagewriter/imagewriter.h",
"lib/proto.h": "./proto.h",
"lib/readerwriter.h": "./readerwriter.h",
"lib/sector.h": "./sector.h",
"lib/usb/usb.h": "./usb/usb.h",
"lib/utils.h": "./utils.h",
"lib/vfs/sectorinterface.h": "./vfs/sectorinterface.h",
"lib/vfs/vfs.h": "./vfs/vfs.h",
},
deps=[
"+fl2_proto_lib",
"+config_proto_lib",
"dep/libusbp",
"dep/adflib",
"dep/fatfs",
"dep/hfsutils",
],
)
proto(name="common_proto", srcs=["./common.proto"])
proto(
name="config_proto",
srcs=[
"./config.proto",
"./layout.proto",
"./drive.proto",
"./decoders/decoders.proto",
"./encoders/encoders.proto",
"./fluxsink/fluxsink.proto",
"./fluxsource/fluxsource.proto",
"./imagereader/imagereader.proto",
"./imagewriter/imagewriter.proto",
"./usb/usb.proto",
"./vfs/vfs.proto",
],
deps=["+common_proto"],
)
protocc(name="config_proto_lib", srcs=["+config_proto", "arch+arch_proto"])

View File

@@ -1,5 +1,5 @@
#include "globals.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/bytes.h"
#include <fstream>
#include <zlib.h>

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include "bytes.h"
#include "crc.h"
#include "lib/globals.h"
#include "lib/bytes.h"
#include "lib/crc.h"
template <class T>
T reflect(T bin, unsigned width = sizeof(T) * 8)

View File

@@ -1,6 +1,6 @@
#include <string>
#include <vector>
#include "csvreader.h"
#include "lib/csvreader.h"
std::vector<std::string> CsvReader::readLine()
{

View File

@@ -1,8 +1,8 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "arch/agat/agat.h"
#include "arch/aeslanier/aeslanier.h"
#include "arch/amiga/amiga.h"
@@ -21,12 +21,12 @@
#include "arch/tids990/tids990.h"
#include "arch/victor9k/victor9k.h"
#include "arch/zilogmcz/zilogmcz.h"
#include "decoders/fluxmapreader.h"
#include "flux.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/flux.h"
#include "protocol.h"
#include "decoders/rawbits.h"
#include "sector.h"
#include "image.h"
#include "lib/decoders/rawbits.h"
#include "lib/sector.h"
#include "lib/image.h"
#include "lib/decoders/decoders.pb.h"
#include "lib/layout.h"
#include <numeric>

View File

@@ -1,10 +1,10 @@
#ifndef DECODERS_H
#define DECODERS_H
#include "bytes.h"
#include "sector.h"
#include "decoders/fluxmapreader.h"
#include "decoders/fluxdecoder.h"
#include "lib/bytes.h"
#include "lib/sector.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/fluxdecoder.h"
class Sector;
class Fluxmap;
@@ -12,7 +12,7 @@ class FluxmapReader;
class RawBits;
class DecoderProto;
#include "flux.h"
#include "lib/flux.h"
extern void setDecoderManualClockRate(double clockrate_us);

View File

@@ -1,7 +1,7 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "decoders/fluxdecoder.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/decoders/fluxdecoder.h"
#include "lib/decoders/decoders.pb.h"
/* This is a port of the samdisk code:

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "flags.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/flags.h"
#include "lib/proto.h"
#include "protocol.h"
#include "proto.h"
#include <numeric>
#include <math.h>
#include <strings.h>

View File

@@ -1,9 +1,9 @@
#ifndef FLUXMAPREADER_H
#define FLUXMAPREADER_H
#include "fluxmap.h"
#include "lib/fluxmap.h"
#include "lib/flags.h"
#include "protocol.h"
#include "flags.h"
class FluxMatcher;
class DecoderProto;

View File

@@ -1,5 +1,5 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "lib/globals.h"
#include "lib/decoders/decoders.h"
Bytes decodeFmMfm(
std::vector<bool>::const_iterator ii, std::vector<bool>::const_iterator end)

View File

@@ -1,7 +1,7 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/decoders.h"
#include "encoders/encoders.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/decoders.h"
#include "lib/encoders/encoders.h"
#include "arch/agat/agat.h"
#include "arch/amiga/amiga.h"
#include "arch/apple2/apple2.h"

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include "proto.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/proto.h"
#include "lib/fluxmap.h"
#include "lib/fl2.pb.h"
#include <fstream>

View File

@@ -1,7 +1,7 @@
#ifndef FLUX_H
#define FLUX_H
#include "bytes.h"
#include "lib/bytes.h"
class Fluxmap;
class Sector;

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/decoders/fluxmapreader.h"
#include "protocol.h"
Fluxmap& Fluxmap::appendBytes(const Bytes& bytes)

View File

@@ -1,7 +1,7 @@
#ifndef FLUXMAP_H
#define FLUXMAP_H
#include "bytes.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fmt/format.h"

View File

@@ -1,15 +1,15 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fluxsink/fluxsink.h"
#include "decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "lib/logger.h"
#include "proto.h"
#include "fluxmap.h"
#include "a2r.h"
#include "lib/proto.h"
#include "lib/fluxmap.h"
#include "lib/a2r.h"
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fluxsink/fluxsink.h"
#include "decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "proto.h"
#include "lib/proto.h"
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>

View File

@@ -1,14 +1,14 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fluxsink/fluxsink.h"
#include "decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "proto.h"
#include "lib/proto.h"
#include "lib/fl2.pb.h"
#include "fl2.h"
#include "lib/fl2.h"
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "flags.h"
#include "fluxsink/fluxsink.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/config.pb.h"
#include "proto.h"
#include "utils.h"
#include "lib/proto.h"
#include "lib/utils.h"
#include <regex>
std::unique_ptr<FluxSink> FluxSink::create(const FluxSinkProto& config)

View File

@@ -1,7 +1,7 @@
#ifndef FLUXSINK_H
#define FLUXSINK_H
#include "flags.h"
#include "lib/flags.h"
#include <ostream>
class Fluxmap;

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "logger.h"
#include "proto.h"
#include "usb/usb.h"
#include "fluxsink/fluxsink.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/logger.h"
#include "lib/proto.h"
#include "lib/usb/usb.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "lib/readerwriter.h"

View File

@@ -1,15 +1,15 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fluxsink/fluxsink.h"
#include "decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "proto.h"
#include "fluxmap.h"
#include "layout.h"
#include "scp.h"
#include "lib/proto.h"
#include "lib/fluxmap.h"
#include "lib/layout.h"
#include "lib/scp.h"
#include "lib/logger.h"
#include <fstream>
#include <sys/stat.h>

View File

@@ -1,12 +1,12 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/bytes.h"
#include "protocol.h"
#include "fluxsink/fluxsink.h"
#include "decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.h"
#include "lib/decoders/fluxmapreader.h"
#include "lib/fluxsink/fluxsink.pb.h"
#include "proto.h"
#include "lib/proto.h"
#include <fstream>
#include <sys/stat.h>
#include <sys/types.h>

View File

@@ -1,8 +1,8 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "fluxsource/fluxsource.h"
#include "proto.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/proto.h"
#include <fstream>
struct A2Rv2Flux

View File

@@ -1,8 +1,8 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "fluxsource/fluxsource.h"
#include "proto.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/proto.h"
#include <fstream>
struct CwfHeader

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include "fluxmap.h"
#include "fluxsource/fluxsource.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/fluxsource/fluxsource.pb.h"
class EraseFluxSource : public TrivialFluxSource

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "lib/fl2.pb.h"
#include "fluxsource/fluxsource.h"
#include "proto.h"
#include "fl2.h"
#include "fluxmap.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/proto.h"
#include "lib/fl2.h"
#include "lib/fluxmap.h"
#include <fstream>
class Fl2FluxSourceIterator : public FluxSourceIterator

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "fluxsource/fluxsource.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/fluxmap.h"
#include "lib/config.pb.h"
#include "proto.h"
#include "utils.h"
#include "lib/proto.h"
#include "lib/utils.h"
std::unique_ptr<FluxSource> FluxSource::create(const FluxSourceProto& config)
{

View File

@@ -1,7 +1,7 @@
#ifndef FLUXSOURCE_H
#define FLUXSOURCE_H
#include "flags.h"
#include "lib/flags.h"
#include "lib/config.pb.h"
class A2rFluxSourceProto;

View File

@@ -1,5 +1,5 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "kryoflux.h"
#include "protocol.h"
#include "lib/fluxsource/flx.h"

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "fluxmap.h"
#include "logger.h"
#include "proto.h"
#include "usb/usb.h"
#include "fluxsource/fluxsource.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/fluxmap.h"
#include "lib/logger.h"
#include "lib/proto.h"
#include "lib/usb/usb.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "lib/readerwriter.h"

View File

@@ -1,5 +1,5 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "kryoflux.h"
#include "protocol.h"
#include <fstream>

View File

@@ -1,8 +1,8 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "kryoflux.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "fluxsource/fluxsource.h"
#include "lib/fluxsource/fluxsource.h"
class KryofluxFluxSource : public TrivialFluxSource
{

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "fluxmap.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "kryoflux.h"
#include "lib/fluxsource/fluxsource.pb.h"
#include "lib/utils.h"
#include "fluxsource/fluxsource.h"
#include "scp.h"
#include "proto.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/scp.h"
#include "lib/proto.h"
#include "lib/logger.h"
#include <fstream>

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include "fluxmap.h"
#include "fluxsource/fluxsource.h"
#include "lib/globals.h"
#include "lib/fluxmap.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/fluxsource/fluxsource.pb.h"
class TestPatternFluxSource : public TrivialFluxSource

View File

@@ -1,5 +1,5 @@
#include "globals.h"
#include "bytes.h"
#include "lib/globals.h"
#include "lib/bytes.h"
void hexdump(std::ostream& stream, const Bytes& buffer)
{

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "proto.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/proto.h"
#include <algorithm>
#include <iostream>
#include <fstream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "proto.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/proto.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "proto.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/proto.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "proto.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/proto.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "utils.h"
#include "proto.h"
#include "image.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/utils.h"
#include "lib/proto.h"
#include "lib/image.h"
#include "lib/layout.h"
#include "lib/config.pb.h"
#include "lib/logger.h"

View File

@@ -1,7 +1,7 @@
#ifndef IMAGEREADER_H
#define IMAGEREADER_H
#include "image.h"
#include "lib/image.h"
#include "lib/config.pb.h"
class ImageSpec;

View File

@@ -1,11 +1,11 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "proto.h"
#include "logger.h"
#include "layout.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/proto.h"
#include "lib/logger.h"
#include "lib/layout.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include "lib/layout.pb.h"
#include "lib/proto.h"

View File

@@ -1,9 +1,9 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "proto.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/proto.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,11 +1,11 @@
/* Image reader for Northstar floppy disk images */
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/logger.h"
#include "lib/imagereader/imagereader.pb.h"
#include <algorithm>
#include <iostream>

View File

@@ -1,10 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "sector.h"
#include "imagereader/imagereader.h"
#include "image.h"
#include "crc.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/sector.h"
#include "lib/imagereader/imagereader.h"
#include "lib/image.h"
#include "lib/crc.h"
#include "lib/logger.h"
#include "lib/config.pb.h"
#include <algorithm>
#include <iostream>

Some files were not shown because too many files have changed in this diff Show More