Skip to content

Commit

Permalink
chore: update styles
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX committed Oct 15, 2024
1 parent 7113164 commit 069aa20
Show file tree
Hide file tree
Showing 235 changed files with 72,805 additions and 1,966 deletions.
111 changes: 111 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_size = 8
indent_style = tab
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
3 changes: 3 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set noparent
filter=-build/include_alpha,-build/include_subdir,-build/include_what_you_use,-legal/copyright,-readability/nolint
linelength=80
86 changes: 86 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Doxyfile for Byakuren

# Project related configuration options
PROJECT_NAME = "Byakuren"
PROJECT_NUMBER = 1.0.1
PROJECT_BRIEF = "A theme color extracting library implemented by C."
OUTPUT_DIRECTORY = docs
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English

# Build related configuration options
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES

# Input files
INPUT = README.md lib const byakuren.h bkr_common.h
FILE_PATTERNS = *.h *.md
RECURSIVE = YES

# Output options
GENERATE_HTML = YES
HTML_OUTPUT = html
GENERATE_LATEX = NO

# Preprocessing
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO

# Dot tool configuration
HAVE_DOT = NO

# Source browsing
SOURCE_BROWSER = YES
INLINE_SOURCES = YES

# Index
ALPHABETICAL_INDEX = YES

# Message options
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES

# C-specific options
OPTIMIZE_OUTPUT_FOR_C = YES
TYPEDEF_HIDES_STRUCT = NO

# Documentation options
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO

# Docstring options
USE_MDFILE_AS_MAINPAGE = README.md
MARKDOWN_SUPPORT = YES

SHOW_NAMESPACES = NO
SHOW_FILES = YES
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
SHOW_INCLUDE_FILES = YES

GENERATE_TREEVIEW = YES

CALL_GRAPH = YES
CALLER_GRAPH = YES

LAYOUT_FILE = DoxygenLayout.xml
23 changes: 23 additions & 0 deletions DoxygenLayout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<doxygenlayout version="1.0">
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="functions" visible="yes" title="Functions" intro=""/>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
</doxygenlayout>
35 changes: 28 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ TESTER_OBJ = bkr_test.o
PALETTE_OBJ = bkr_palette.o
STLIB = byakuren
OBJECTS = $(OCTREE_OBJ) $(COMMON_OBJ) $(XMEMPOOL_LIB) $(MINDIFF_OBJ) $(MIX_OBJ) $(PALETTE_OBJ)
CPPLINT ?= ./tools/cpplint/cpplint.py
CPPLINT_FILES = $(shell find . \( -type d \( -name 'third-party' -o -name 'tools' \) -prune \) -o \( -name '*.c' -o -name '*.h' \) -print)
CLANG_FORMAT ?= node_modules/.bin/clang-format

ifeq ($(shell which $(CLANG_FORMAT)),)
CLANG_FORMAT = clang-format
endif

TESTER = ./test/bkr_test

Expand All @@ -21,21 +28,21 @@ $(STLIB): $(OBJECTS)
ar rcs $(STLIB).a $(OBJECTS)

$(XMEMPOOL_LIB): third-party/xmempool/xmempool.c
cd ./third-party/xmempool/ && make
cd ./third-party/xmempool/ && make xmempool.o

$(COMMON_OBJ): ./common.c ./common.h
$(COMMON_OBJ): ./bkr_common.c ./bkr_common.h
$(CC) -c $(REAL_CFLAGS) $< -o $@

$(OCTREE_OBJ): ./lib/octree.c ./lib/octree.h ./common.h
$(OCTREE_OBJ): ./lib/octree.c ./lib/octree.h ./bkr_common.h
$(CC) -c $(REAL_CFLAGS) $< -o $@

$(MINDIFF_OBJ): ./lib/mindiff.c ./lib/mindiff.h ./common.h
$(MINDIFF_OBJ): ./lib/mindiff.c ./lib/mindiff.h ./bkr_common.h
$(CC) -c $(REAL_CFLAGS) $< -o $@

$(MIX_OBJ): ./lib/mix.c ./lib/mix.h ./common.h ./lib/octree.h ./lib/mindiff.h
$(MIX_OBJ): ./lib/mix.c ./lib/mix.h ./bkr_common.h ./lib/octree.h ./lib/mindiff.h
$(CC) -c $(REAL_CFLAGS) $< -o $@

$(PALETTE_OBJ): ./const/palette.c ./const/palette.h ./common.h
$(PALETTE_OBJ): ./const/palette.c ./const/palette.h ./bkr_common.h
$(CC) -c $(REAL_CFLAGS) $< -o $@

$(TESTER): $(TESTER_OBJ) $(STLIB)
Expand All @@ -56,9 +63,10 @@ clean:
@echo " }," >> $@

COMPDB_ENTRIES = $(addsuffix .compdb_entry, $(basename \
./common.c \
./bkr_common.c \
./lib/octree.c \
./lib/mindiff.c \
./lib/mix.c \
./const/palette.c \
./test/test.c \
./third-party/xmempool/xmempool.c))
Expand All @@ -71,3 +79,16 @@ compile_commands.json: $(COMPDB_ENTRIES)
@echo "]" >> $@
@rm $(COMPDB_ENTRIES)
@rm $@.tmp

.PHONY: lint
lint:
$(CPPLINT) $(CPPLINT_FILES)

.PHONY: clang-format
clang-format:
$(CLANG_FORMAT) -i $(CPPLINT_FILES)

docs:
doxygen Doxyfile

.PHONY: docs
Loading

0 comments on commit 069aa20

Please sign in to comment.