Created better hierarchy of source files

This commit is contained in:
Robert Bendun 2022-09-23 18:55:25 +02:00
parent 6a71614cab
commit ceeb25ea82
39 changed files with 69 additions and 84 deletions

View File

@ -864,7 +864,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = src doc/index.md include INPUT = musique doc/index.md
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -1,23 +1,7 @@
include config.mk include config.mk
Obj= \ Sources := $(shell find musique/ -name '*.cc')
builtin_functions.o \ Obj := $(subst musique/,,$(Sources:%.cc=%.o))
builtin_operators.o \
context.o \
env.o \
errors.o \
format.o \
interpreter.o \
lexer.o \
lines.o \
location.o \
number.o \
parser.o \
pretty.o \
unicode.o \
unicode_tables.o \
value.o
all: bin/musique all: bin/musique
@ -29,7 +13,7 @@ bin/bestline.o: lib/bestline/bestline.c lib/bestline/bestline.h
@echo "CC $@" @echo "CC $@"
@$(CC) $< -c -O3 -o $@ @$(CC) $< -c -O3 -o $@
doc: Doxyfile musique/*.cc include/*.hh doc: Doxyfile musique/*.cc musique/*.hh
doxygen doxygen
doc-open: doc doc-open: doc
@ -46,4 +30,5 @@ install: bin/musique
.PHONY: clean doc doc-open all test unit-tests release install .PHONY: clean doc doc-open all test unit-tests release install
$(shell mkdir -p bin/debug/tests) $(shell mkdir -p $(subst musique/,bin/,$(shell find musique/* -type d)))
$(shell mkdir -p $(subst musique/,bin/debug/,$(shell find musique/* -type d)))

View File

@ -3,7 +3,7 @@
#include <musique/result.hh> #include <musique/result.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/value.hh> #include <musique/value/value.hh>
#include <ranges> #include <ranges>
/// Generic algorithms support /// Generic algorithms support

View File

@ -1,8 +1,8 @@
#include <musique/errors.hh> #include <musique/errors.hh>
#include <musique/lines.hh> #include <musique/lexer/lines.hh>
#include <musique/pretty.hh> #include <musique/pretty.hh>
#include <musique/unicode.hh> #include <musique/unicode.hh>
#include <musique/number.hh> #include <musique/value/number.hh>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>

View File

@ -1,7 +1,7 @@
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <musique/format.hh> #include <musique/format.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/value.hh> #include <musique/value/value.hh>
#include <sstream> #include <sstream>
Result<std::string> format(Interpreter &i, Value const& value) Result<std::string> format(Interpreter &i, Value const& value)

View File

@ -1,7 +1,7 @@
#ifndef MUSIQUE_FORMAT_HH #ifndef MUSIQUE_FORMAT_HH
#define MUSIQUE_FORMAT_HH #define MUSIQUE_FORMAT_HH
#include "result.hh" #include <musique/result.hh>
struct Interpreter; struct Interpreter;
struct Value; struct Value;

View File

@ -5,7 +5,7 @@
#include <array> #include <array>
#include <musique/common.hh> #include <musique/common.hh>
#include <musique/errors.hh> #include <musique/errors.hh>
#include <musique/value.hh> #include <musique/value/value.hh>
/// Allows creation of guards that ensure proper type /// Allows creation of guards that ensure proper type
template<usize N> template<usize N>

View File

@ -1,10 +1,10 @@
#include <musique/algo.hh> #include <musique/algo.hh>
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <musique/guard.hh> #include <musique/guard.hh>
#include <musique/incoming_midi.hh> #include <musique/interpreter/incoming_midi.hh>
#include <musique/interpreter.hh> #include <musique/interpreter/interpreter.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/typecheck.hh> #include <musique/value/typecheck.hh>
#include <random> #include <random>
#include <memory> #include <memory>

View File

@ -1,9 +1,9 @@
#include <functional> #include <functional>
#include <musique/algo.hh> #include <musique/algo.hh>
#include <musique/guard.hh> #include <musique/guard.hh>
#include <musique/interpreter.hh> #include <musique/interpreter/interpreter.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/typecheck.hh> #include <musique/value/typecheck.hh>
/// Intrinsic implementation primitive to ease operation vectorization /// Intrinsic implementation primitive to ease operation vectorization
static Result<Value> vectorize(auto &&operation, Interpreter &interpreter, Value lhs, Value rhs) static Result<Value> vectorize(auto &&operation, Interpreter &interpreter, Value lhs, Value rhs)

View File

@ -1,4 +1,4 @@
#include <musique/context.hh> #include <musique/interpreter/context.hh>
Note Context::fill(Note note) const Note Context::fill(Note note) const
{ {

View File

@ -1,9 +1,9 @@
#ifndef MUSIQUE_CONTEXT_HH #ifndef MUSIQUE_CONTEXT_HH
#define MUSIQUE_CONTEXT_HH #define MUSIQUE_CONTEXT_HH
#include "common.hh" #include <musique/common.hh>
#include "note.hh" #include <musique/value/note.hh>
#include "number.hh" #include <musique/value/number.hh>
#include <chrono> #include <chrono>
/// Context holds default values for music related actions /// Context holds default values for music related actions

View File

@ -1,4 +1,4 @@
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <iostream> #include <iostream>

View File

@ -3,7 +3,7 @@
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include "value.hh" #include <musique/value/value.hh>
/// Collection holding all variables in given scope. /// Collection holding all variables in given scope.
struct Env : std::enable_shared_from_this<Env> struct Env : std::enable_shared_from_this<Env>

View File

@ -1,7 +1,7 @@
#ifndef MUSIQUE_INCOMING_MIDI #ifndef MUSIQUE_INCOMING_MIDI
#define MUSIQUE_INCOMING_MIDI #define MUSIQUE_INCOMING_MIDI
#include "interpreter.hh" #include <musique/interpreter/interpreter.hh>
struct Interpreter::Incoming_Midi_Callbacks struct Interpreter::Incoming_Midi_Callbacks
{ {

View File

@ -1,6 +1,6 @@
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <musique/incoming_midi.hh> #include <musique/interpreter/incoming_midi.hh>
#include <musique/interpreter.hh> #include <musique/interpreter/interpreter.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <chrono> #include <chrono>

View File

@ -2,8 +2,8 @@
#define MUSIQUE_INTERPRETER_HH #define MUSIQUE_INTERPRETER_HH
#include <midi.hh> #include <midi.hh>
#include <musique/context.hh> #include <musique/interpreter/context.hh>
#include <musique/value.hh> #include <musique/value/value.hh>
/// Given program tree evaluates it into Value /// Given program tree evaluates it into Value
struct Interpreter struct Interpreter

View File

@ -1,4 +1,4 @@
#include <musique/lexer.hh> #include <musique/lexer/lexer.hh>
#include <musique/unicode.hh> #include <musique/unicode.hh>
#include <iomanip> #include <iomanip>

View File

@ -3,7 +3,7 @@
#include <musique/location.hh> #include <musique/location.hh>
#include <musique/result.hh> #include <musique/result.hh>
#include <musique/token.hh> #include <musique/lexer/token.hh>
#include <variant> #include <variant>
/// Explicit marker of the end of file /// Explicit marker of the end of file

View File

@ -1,6 +1,6 @@
#include <iomanip> #include <iomanip>
#include <musique/errors.hh> #include <musique/errors.hh>
#include <musique/lines.hh> #include <musique/lexer/lines.hh>
Lines Lines::the; Lines Lines::the;

View File

@ -1,8 +1,8 @@
#ifndef MUSIQUE_TOKEN_HH #ifndef MUSIQUE_TOKEN_HH
#define MUSIQUE_TOKEN_HH #define MUSIQUE_TOKEN_HH
#include "common.hh" #include <musique/common.hh>
#include "location.hh" #include <musique/location.hh>
/// Lexical token representation for Musique language /// Lexical token representation for Musique language
struct Token struct Token

View File

@ -7,11 +7,11 @@
#include <thread> #include <thread>
#include <midi.hh> #include <midi.hh>
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <musique/format.hh> #include <musique/format.hh>
#include <musique/interpreter.hh> #include <musique/interpreter/interpreter.hh>
#include <musique/lines.hh> #include <musique/lexer/lines.hh>
#include <musique/parser.hh> #include <musique/parser/parser.hh>
#include <musique/pretty.hh> #include <musique/pretty.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/unicode.hh> #include <musique/unicode.hh>

View File

@ -1,7 +1,7 @@
#ifndef MUSIQUE_AST_HH #ifndef MUSIQUE_AST_HH
#define MUSIQUE_AST_HH #define MUSIQUE_AST_HH
#include "token.hh" #include <musique/lexer/token.hh>
#include <vector> #include <vector>
#include <optional> #include <optional>

View File

@ -1,5 +1,5 @@
#include <musique/parser.hh> #include <musique/parser/parser.hh>
#include <musique/lexer.hh> #include <musique/lexer/lexer.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <iostream> #include <iostream>

View File

@ -1,8 +1,8 @@
#ifndef MUSIQUE_PARSER_HH #ifndef MUSIQUE_PARSER_HH
#define MUSIQUE_PARSER_HH #define MUSIQUE_PARSER_HH
#include "ast.hh" #include <musique/parser/ast.hh>
#include "result.hh" #include <musique/result.hh>
/// Source code to program tree converter /// Source code to program tree converter
/// ///

View File

@ -3,7 +3,7 @@
#include <tl/expected.hpp> #include <tl/expected.hpp>
#include "errors.hh" #include <musique/errors.hh>
/// Holds either T or Error /// Holds either T or Error
template<typename T> template<typename T>

View File

@ -1,7 +1,7 @@
#ifndef MUSIQUE_TRY_HH #ifndef MUSIQUE_TRY_HH
#define MUSIQUE_TRY_HH #define MUSIQUE_TRY_HH
#include "result.hh" #include <musique/result.hh>
/// Shorthand for forwarding error values with Result type family. /// Shorthand for forwarding error values with Result type family.
/// ///

View File

@ -2,7 +2,7 @@
#define MUSIQUE_ARRAY_HH #define MUSIQUE_ARRAY_HH
#include <vector> #include <vector>
#include "result.hh" #include <musique/result.hh>
struct Interpreter; struct Interpreter;
struct Value; struct Value;

View File

@ -1,8 +1,8 @@
#ifndef MUSIQUE_BLOCK_HH #ifndef MUSIQUE_BLOCK_HH
#define MUSIQUE_BLOCK_HH #define MUSIQUE_BLOCK_HH
#include "result.hh" #include <musique/result.hh>
#include "ast.hh" #include <musique/parser/ast.hh>
#include <memory> #include <memory>

View File

@ -1,6 +1,6 @@
#include <vector> #include <vector>
#include "note.hh" #include <musique/value/note.hh>
struct Interpreter; struct Interpreter;
struct Value; struct Value;

View File

@ -3,7 +3,7 @@
#include <optional> #include <optional>
#include "number.hh" #include <musique/value/number.hh>
/// Representation of musical note or musical pause /// Representation of musical note or musical pause
struct Note struct Note

View File

@ -1,4 +1,4 @@
#include <musique/number.hh> #include <musique/value/number.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <cmath> #include <cmath>

View File

@ -3,7 +3,7 @@
#include <musique/common.hh> #include <musique/common.hh>
#include <musique/result.hh> #include <musique/result.hh>
#include <musique/token.hh> #include <musique/lexer/token.hh>
#include <ostream> #include <ostream>
/// Number type supporting integer and fractional constants /// Number type supporting integer and fractional constants

View File

@ -1,7 +1,7 @@
#ifndef MUSIQUE_TYPECHECK_HH #ifndef MUSIQUE_TYPECHECK_HH
#define MUSIQUE_TYPECHECK_HH #define MUSIQUE_TYPECHECK_HH
#include <musique/value.hh> #include <musique/value/value.hh>
/// Intrinsic implementation primitive providing a short way to check if arguments match required type signature /// Intrinsic implementation primitive providing a short way to check if arguments match required type signature
static inline bool typecheck(std::vector<Value> const& args, auto const& ...expected_types) static inline bool typecheck(std::vector<Value> const& args, auto const& ...expected_types)

View File

@ -1,8 +1,8 @@
#include <musique/env.hh> #include <musique/interpreter/env.hh>
#include <musique/guard.hh> #include <musique/guard.hh>
#include <musique/interpreter.hh> #include <musique/interpreter/interpreter.hh>
#include <musique/try.hh> #include <musique/try.hh>
#include <musique/value.hh> #include <musique/value/value.hh>
#include <iostream> #include <iostream>
#include <numeric> #include <numeric>

View File

@ -1,13 +1,13 @@
#ifndef MUSIQUE_VALUE_HH #ifndef MUSIQUE_VALUE_HH
#define MUSIQUE_VALUE_HH #define MUSIQUE_VALUE_HH
#include "array.hh" #include <musique/value/array.hh>
#include "block.hh" #include <musique/value/block.hh>
#include "chord.hh" #include <musique/value/chord.hh>
#include "common.hh" #include <musique/common.hh>
#include "note.hh" #include <musique/value/note.hh>
#include "result.hh" #include <musique/result.hh>
#include "token.hh" #include <musique/lexer/token.hh>
/// Representation of any value in language /// Representation of any value in language
struct Value struct Value

View File

@ -2,10 +2,10 @@ Debug_Obj=$(addprefix bin/debug/,$(Obj))
debug: bin/debug/musique debug: bin/debug/musique
bin/debug/musique: $(Debug_Obj) bin/debug/main.o bin/bestline.o include/*.hh bin/debug/musique: $(Debug_Obj) bin/debug/main.o bin/bestline.o
@echo "CXX $@" @echo "CXX $@"
@$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $(Debug_Obj) bin/bestline.o bin/debug/main.o $(LDFLAGS) $(LDLIBS) @$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $(Debug_Obj) bin/bestline.o $(LDFLAGS) $(LDLIBS)
bin/debug/%.o: musique/%.cc include/*.hh bin/debug/%.o: musique/%.cc
@echo "CXX $@" @echo "CXX $@"
@$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c @$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c

View File

@ -6,4 +6,4 @@ bin/%.o: musique/%.cc
bin/musique: $(Release_Obj) bin/main.o bin/bestline.o lib/midi/libmidi-alsa.a bin/musique: $(Release_Obj) bin/main.o bin/bestline.o lib/midi/libmidi-alsa.a
@echo "CXX $@" @echo "CXX $@"
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/bestline.o bin/main.o $(LDFLAGS) $(LDLIBS) @$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/bestline.o $(LDFLAGS) $(LDLIBS)