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
# 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
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -1,23 +1,7 @@
include config.mk
Obj= \
builtin_functions.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
Sources := $(shell find musique/ -name '*.cc')
Obj := $(subst musique/,,$(Sources:%.cc=%.o))
all: bin/musique
@ -29,7 +13,7 @@ bin/bestline.o: lib/bestline/bestline.c lib/bestline/bestline.h
@echo "CC $@"
@$(CC) $< -c -O3 -o $@
doc: Doxyfile musique/*.cc include/*.hh
doc: Doxyfile musique/*.cc musique/*.hh
doxygen
doc-open: doc
@ -46,4 +30,5 @@ install: bin/musique
.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/try.hh>
#include <musique/value.hh>
#include <musique/value/value.hh>
#include <ranges>
/// Generic algorithms support

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
#include <functional>
#include <musique/algo.hh>
#include <musique/guard.hh>
#include <musique/interpreter.hh>
#include <musique/interpreter/interpreter.hh>
#include <musique/try.hh>
#include <musique/typecheck.hh>
#include <musique/value/typecheck.hh>
/// Intrinsic implementation primitive to ease operation vectorization
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
{

View File

@ -1,9 +1,9 @@
#ifndef MUSIQUE_CONTEXT_HH
#define MUSIQUE_CONTEXT_HH
#include "common.hh"
#include "note.hh"
#include "number.hh"
#include <musique/common.hh>
#include <musique/value/note.hh>
#include <musique/value/number.hh>
#include <chrono>
/// 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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
#ifndef 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
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/interpreter.hh>
#include <musique/interpreter/interpreter.hh>
#include <musique/try.hh>
#include <musique/value.hh>
#include <musique/value/value.hh>
#include <iostream>
#include <numeric>

View File

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

View File

@ -2,10 +2,10 @@ Debug_Obj=$(addprefix bin/debug/,$(Obj))
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 $@"
@$(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 $@"
@$(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
@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)