Add .clang-format

Co-authored-by: Maschell <Maschell@gmx.de>
This commit is contained in:
GaryOderNichts 2024-10-02 21:12:23 +02:00 committed by Dave Murphy
parent fa650f92c4
commit 2b66122422
12 changed files with 144 additions and 42 deletions

90
.clang-format Normal file
View File

@ -0,0 +1,90 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: AcrossEmptyLinesAndComments
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: All
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- asm
- WUT_FORMAT_PRINTF
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterExternBlock: false
AfterStruct: true
AfterFunction: true
AfterNamespace: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
FixNamespaceComments: true
IncludeBlocks: Preserve
IncludeCategories:
# Include wut headers first
- Regex: '^[<|"]wut'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '^"'
Priority: 3
IndentAccessModifiers: false
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 3
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PointerAlignment: Right
ReflowComments: false
SeparateDefinitionBlocks: Leave
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
TypenameMacros:
- BOOL
- RPLWRAP
UseTab: Never

View File

@ -11,8 +11,10 @@
extern "C" {
#endif
// clang-format off
void
RPLWRAP(exit)(int code);
// clang-format on
void
_Exit(int code);

View File

@ -1,6 +1,5 @@
#pragma once
#include "wut.h"
#include <wut.h>
#include "filesystem.h"
#ifdef __cplusplus

View File

@ -249,9 +249,11 @@ ACPGetTitleIdOfMainApplication(ACPTitleId* titleId);
* @param metaXml must be aligned to 0x40
* @return ACP_RESULT_SUCCESS on success
*/
// clang-format off
ACPResult
RPLWRAP(ACPGetTitleMetaXml)(ACPTitleId titleId,
ACPMetaXml *metaXml);
// clang-format on
/**
* Gets the MetaXML for a given title id
@ -269,10 +271,12 @@ ACPGetTitleMetaXml(ACPTitleId titleId,
return RPLWRAP(ACPGetTitleMetaXml)(titleId, metaXml);
}
// clang-format off
ACPResult
RPLWRAP(ACPGetTitleSaveMetaXml)(uint64_t titleId,
ACPMetaXml* metaXml,
ACPDeviceType deviceType);
// clang-format on
/**
* Gets the save dir MetaXML for a given title id

View File

@ -176,10 +176,12 @@ HPADShutdown(void);
* \return
* The amount of buffers read or a negative value on error.
*/
// clang-format off
int32_t
RPLWRAP(HPADRead)(HPADChan chan,
HPADStatus *buffers,
int32_t count);
// clang-format on
/**
* Reads status buffers from a specified HPAD channel.

View File

@ -57,11 +57,13 @@ somemopt(SOMemOptRequest request,
uint32_t size,
SOMemOptFlags flags);
// clang-format off
int
RPLWRAP(somemopt)(SOMemOptRequest request,
void *buffer,
uint32_t size,
SOMemOptFlags flags);
// clang-format on
#ifdef __cplusplus
}

View File

@ -11,6 +11,8 @@
extern "C" {
#endif
// clang-format off
struct hostent *
RPLWRAP(gethostbyaddr)(const void *addr,
size_t len,
@ -50,6 +52,8 @@ RPLWRAP(get_h_errno)(void);
const char *
RPLWRAP(gai_strerror)(int ecode);
// clang-format on
#ifdef __cplusplus
}
#endif

View File

@ -47,6 +47,8 @@ socket_lib_init();
void
socket_lib_finish();
// clang-format off
int
RPLWRAP(accept)(int sockfd,
struct sockaddr *addr,
@ -151,6 +153,8 @@ RPLWRAP(inet_pton)(int af,
int
RPLWRAP(socketlasterr)();
// clang-format on
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,6 @@
#pragma once
#include <wut.h>
#include <wut_rplwrap.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>

View File

@ -1,35 +1,33 @@
#include "devoptab_fsa.h"
#include <cstdio>
static devoptab_t
__wut_fsa_devoptab =
{
.name = "fs",
.structSize = sizeof(__wut_fsa_file_t),
.open_r = __wut_fsa_open,
.close_r = __wut_fsa_close,
.write_r = __wut_fsa_write,
.read_r = __wut_fsa_read,
.seek_r = __wut_fsa_seek,
.fstat_r = __wut_fsa_fstat,
.stat_r = __wut_fsa_stat,
.unlink_r = __wut_fsa_unlink,
.chdir_r = __wut_fsa_chdir,
.rename_r = __wut_fsa_rename,
.mkdir_r = __wut_fsa_mkdir,
.dirStateSize = sizeof(__wut_fsa_dir_t),
.diropen_r = __wut_fsa_diropen,
.dirreset_r = __wut_fsa_dirreset,
.dirnext_r = __wut_fsa_dirnext,
.dirclose_r = __wut_fsa_dirclose,
.statvfs_r = __wut_fsa_statvfs,
.ftruncate_r = __wut_fsa_ftruncate,
.fsync_r = __wut_fsa_fsync,
.deviceData = nullptr,
.chmod_r = __wut_fsa_chmod,
.rmdir_r = __wut_fsa_rmdir,
.lstat_r = __wut_fsa_stat,
};
static devoptab_t __wut_fsa_devoptab = {
.name = "fs",
.structSize = sizeof(__wut_fsa_file_t),
.open_r = __wut_fsa_open,
.close_r = __wut_fsa_close,
.write_r = __wut_fsa_write,
.read_r = __wut_fsa_read,
.seek_r = __wut_fsa_seek,
.fstat_r = __wut_fsa_fstat,
.stat_r = __wut_fsa_stat,
.unlink_r = __wut_fsa_unlink,
.chdir_r = __wut_fsa_chdir,
.rename_r = __wut_fsa_rename,
.mkdir_r = __wut_fsa_mkdir,
.dirStateSize = sizeof(__wut_fsa_dir_t),
.diropen_r = __wut_fsa_diropen,
.dirreset_r = __wut_fsa_dirreset,
.dirnext_r = __wut_fsa_dirnext,
.dirclose_r = __wut_fsa_dirclose,
.statvfs_r = __wut_fsa_statvfs,
.ftruncate_r = __wut_fsa_ftruncate,
.fsync_r = __wut_fsa_fsync,
.deviceData = nullptr,
.chmod_r = __wut_fsa_chmod,
.rmdir_r = __wut_fsa_rmdir,
.lstat_r = __wut_fsa_stat,
};
__wut_fsa_device_t __wut_fsa_device_data = {};

View File

@ -5,9 +5,7 @@
int h_errno;
static devoptab_t
__wut_socket_devoptab =
{
static devoptab_t __wut_socket_devoptab = {
.name = "soc",
.structSize = sizeof(int),
.open_r = __wut_socket_open,
@ -16,9 +14,7 @@ __wut_socket_devoptab =
.read_r = __wut_socket_read,
};
static unsigned char
__wut_nsysnet_error_code_map[] =
{
static unsigned char __wut_nsysnet_error_code_map[] = {
0, // 0
ENOBUFS,
ETIMEDOUT,

View File

@ -18,18 +18,20 @@
#include <coreinit/thread.h>
#include <coreinit/time.h>
static const float sPositionData[] =
{
static const float sPositionData[] = {
// clang-format off
1.0f, -1.0f, 0.0f, 1.0f,
0.0f, 1.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 1.0f, 1.0f,
// clang-format on
};
static const float sColourData[] =
{
static const float sColourData[] = {
// clang-format off
1.0f, 0.0f, 0.0f, 1.0f,
0.0f, 1.0f, 0.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
// clang-format on
};
int main(int argc, char **argv)