From f5a84b3c53ee37d83c33e9a6ad73b99866efcdc1 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Tue, 29 Sep 2020 16:43:33 +0200 Subject: erster checkin --- .clang-format | 45 +++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ compile_flags.txt | 6 ++++++ makefile | 18 ++++++++++++++++++ src/srcut.cpp | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 compile_flags.txt create mode 100644 makefile create mode 100644 src/srcut.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..ff96bb5 --- /dev/null +++ b/.clang-format @@ -0,0 +1,45 @@ +--- +AccessModifierOffset: -4 +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignEscapedNewlines: Left +AlignTrailingComments: 'true' +AlwaysBreakAfterReturnType: TopLevelDefinitions +BreakBeforeBraces: Stroustrup +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +ColumnLimit: '0' +CompactNamespaces: 'false' +Cpp11BracedListStyle: 'false' +FixNamespaceComments: 'true' +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^.*(precomp|pch|stdafx)' + Priority: -1 + - Regex: '^<.*>' + Priority: 1 + - Regex: '^".*"' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: 'false' +IndentPPDirectives: AfterHash +IndentWidth: '4' +IndentWrappedFunctionNames: 'false' +KeepEmptyLinesAtTheStartOfBlocks: 'false' +PointerAlignment: Left +SortIncludes: 'true' +SpaceAfterCStyleCast: 'true' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'false' +SpaceInEmptyParentheses: 'false' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInConditionalStatement: 'true' +SpacesInParentheses: 'false' +Standard: Auto +TabWidth: '4' +UseTab: ForIndentation +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f886c89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/* +obj/*.o diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 0000000..8efbfab --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,6 @@ +-Wall +-Werror +-std=c++20 +-pedantic +-I/usr/local/include +-Iinclude diff --git a/makefile b/makefile new file mode 100644 index 0000000..7723923 --- /dev/null +++ b/makefile @@ -0,0 +1,18 @@ +.PHONY: all clean + +BIN=bin/srcut +OBJS+=obj/srcut.o +HEADER=${wildcard include/*.hpp} + +CPPFLAGS=-Wall -Werror -std=c++20 -pedantic -Iinclude -O2 + +all: $(BIN) + +$(BIN): $(OBJS) + c++ -o $@ $(OBJS) + +obj/%.o: src/%.cpp $(HEADER) + c++ -o $@ $(CPPFLAGS) -c $< + +clean: + rm -f obj/* bin/* diff --git a/src/srcut.cpp b/src/srcut.cpp new file mode 100644 index 0000000..194cc65 --- /dev/null +++ b/src/srcut.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +using namespace std; + +static void +process(istream& in, ostream& os) +{ + auto match_begin = [](string_view s) -> bool { + return s.empty(); + }; + + auto match_end = [](string_view s) -> bool { + return s.empty(); + }; + + for ( string line; getline(in, line); ) { + if ( match_begin(line) ) { + } + else if ( match_end(line) ) { + } + else { + os << line << '\n'; + } + } + os << flush; +} + +int +main(void) +{ + process(cin); +} -- cgit v1.3