summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-09-29 16:43:33 +0200
committerThomas Schmucker <ts@its1.de>2020-09-29 16:43:33 +0200
commitf5a84b3c53ee37d83c33e9a6ad73b99866efcdc1 (patch)
tree94581241ed6a8dc804c0b846ce65b45b25edac83
downloadscissor-f5a84b3c53ee37d83c33e9a6ad73b99866efcdc1.tar.gz
scissor-f5a84b3c53ee37d83c33e9a6ad73b99866efcdc1.tar.bz2
scissor-f5a84b3c53ee37d83c33e9a6ad73b99866efcdc1.zip
erster checkin
-rw-r--r--.clang-format45
-rw-r--r--.gitignore2
-rw-r--r--compile_flags.txt6
-rw-r--r--makefile18
-rw-r--r--src/srcut.cpp34
5 files changed, 105 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..ff96bb5
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,45 @@
1---
2AccessModifierOffset: -4
3AlignConsecutiveAssignments: 'true'
4AlignConsecutiveDeclarations: 'true'
5AlignEscapedNewlines: Left
6AlignTrailingComments: 'true'
7AlwaysBreakAfterReturnType: TopLevelDefinitions
8BreakBeforeBraces: Stroustrup
9BreakConstructorInitializers: BeforeComma
10BreakInheritanceList: BeforeComma
11ColumnLimit: '0'
12CompactNamespaces: 'false'
13Cpp11BracedListStyle: 'false'
14FixNamespaceComments: 'true'
15IncludeBlocks: Regroup
16IncludeCategories:
17 - Regex: '^.*(precomp|pch|stdafx)'
18 Priority: -1
19 - Regex: '^<.*>'
20 Priority: 1
21 - Regex: '^".*"'
22 Priority: 2
23 - Regex: '.*'
24 Priority: 3
25IndentCaseLabels: 'false'
26IndentPPDirectives: AfterHash
27IndentWidth: '4'
28IndentWrappedFunctionNames: 'false'
29KeepEmptyLinesAtTheStartOfBlocks: 'false'
30PointerAlignment: Left
31SortIncludes: 'true'
32SpaceAfterCStyleCast: 'true'
33SpaceAfterTemplateKeyword: 'false'
34SpaceBeforeAssignmentOperators: 'true'
35SpaceBeforeParens: ControlStatements
36SpaceBeforeRangeBasedForLoopColon: 'false'
37SpaceInEmptyParentheses: 'false'
38SpacesInAngles: 'false'
39SpacesInCStyleCastParentheses: 'false'
40SpacesInConditionalStatement: 'true'
41SpacesInParentheses: 'false'
42Standard: Auto
43TabWidth: '4'
44UseTab: ForIndentation
45...
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f886c89
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
1bin/*
2obj/*.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 @@
1-Wall
2-Werror
3-std=c++20
4-pedantic
5-I/usr/local/include
6-Iinclude
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..7723923
--- /dev/null
+++ b/makefile
@@ -0,0 +1,18 @@
1.PHONY: all clean
2
3BIN=bin/srcut
4OBJS+=obj/srcut.o
5HEADER=${wildcard include/*.hpp}
6
7CPPFLAGS=-Wall -Werror -std=c++20 -pedantic -Iinclude -O2
8
9all: $(BIN)
10
11$(BIN): $(OBJS)
12 c++ -o $@ $(OBJS)
13
14obj/%.o: src/%.cpp $(HEADER)
15 c++ -o $@ $(CPPFLAGS) -c $<
16
17clean:
18 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 @@
1#include <fstream>
2#include <iostream>
3#include <string>
4
5using namespace std;
6
7static void
8process(istream& in, ostream& os)
9{
10 auto match_begin = [](string_view s) -> bool {
11 return s.empty();
12 };
13
14 auto match_end = [](string_view s) -> bool {
15 return s.empty();
16 };
17
18 for ( string line; getline(in, line); ) {
19 if ( match_begin(line) ) {
20 }
21 else if ( match_end(line) ) {
22 }
23 else {
24 os << line << '\n';
25 }
26 }
27 os << flush;
28}
29
30int
31main(void)
32{
33 process(cin);
34}