formats according to clang-format style

This commit is contained in:
2025-09-15 09:21:26 +02:00
parent 199333d03d
commit 8bce629453
3 changed files with 458 additions and 212 deletions
+246
View File
@@ -0,0 +1,246 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: ".*"
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
---
+211 -211
View File
@@ -24,16 +24,17 @@ INT n_reg_devices;
/*------------------------------------------------------------------*/
/* Store any parameters the device driver needs in following
/* Store any parameters the device driver needs in following
structure. */
/* REMEMBER also to modify slowcont/mon/mon_do.c ! */
typedef struct {
char device_list[4*NAME_LENGTH];
char active_list[4*NAME_LENGTH];
char device_list[4 * NAME_LENGTH];
char active_list[4 * NAME_LENGTH];
} BULK_MONITOR_SETTINGS;
#define BULK_MONITOR_SETTINGS_STR "\
#define BULK_MONITOR_SETTINGS_STR \
"\
Device_list = STRING : [128] NONE\n\
Active_list = STRING : [128] NONE\n\
"
@@ -45,11 +46,12 @@ Active_list = STRING : [128] NONE\n\
write the other device's variables. */
typedef struct {
BULK_MONITOR_SETTINGS bulk_monitor_settings;
INT channels;
BULK_MONITOR_SETTINGS bulk_monitor_settings;
INT channels;
} BULK_MONITOR_INFO;
/* device driver support routines ------------------------------------------------- */
/* device driver support routines
* ------------------------------------------------- */
/*---- device driver routines --------------------------------------*/
@@ -60,245 +62,243 @@ INT bulk_monitor_exit(BULK_MONITOR_INFO *);
/* the init function creates a ODB record which contains the
settings and initialized it variables as well as the bus driver */
INT bulk_monitor_init(HNDLE hkey, void **pinfo, INT channels, INT(*bd) (INT cmd, ...))
{
int status, size, len, i;
HNDLE hDB, hkeydd;
BULK_MONITOR_INFO *info;
INT bulk_monitor_init(HNDLE hkey, void **pinfo, INT channels,
INT (*bd)(INT cmd, ...)) {
int status, size, len, i;
HNDLE hDB, hkeydd;
BULK_MONITOR_INFO *info;
#ifdef MIDEBUG
cm_msg(MLOG,"","++bulk_monitor_init()");
cm_msg(MLOG, "", "++bulk_monitor_init()");
#endif
/* allocate info structure */
info = calloc(1, sizeof(BULK_MONITOR_INFO));
info->channels = channels;
*pinfo = info;
/* allocate info structure */
info = calloc(1, sizeof(BULK_MONITOR_INFO));
info->channels = channels;
*pinfo = info;
cm_get_experiment_database(&hDB, NULL);
cm_get_experiment_database(&hDB, NULL);
/* create settings record */
status = db_create_record(hDB, hkey, "DD", BULK_MONITOR_SETTINGS_STR);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init", "Error creating DD Settings record in ODB.");
return FE_ERR_ODB;
}
status = db_find_key(hDB, hkey, "DD", &hkeydd);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init", "Error %d Finding DD key in ODB.",status);
return FE_ERR_ODB;
}
size = sizeof(info->bulk_monitor_settings);
status = db_get_record(hDB, hkeydd, &info->bulk_monitor_settings, &size, 0);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init", "Error %d getting record of DD key in ODB.",
status);
return FE_ERR_ODB;
}
/* initialize driver */
#ifdef MIDEBUG
cm_msg(MLOG,"","--bulk_monitor_init()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_exit(BULK_MONITOR_INFO * info)
{
#ifdef MIDEBUG
cm_msg(MLOG,"","++bulk_monitor_exit()");
#endif
free(info);
#ifdef MIDEBUG
cm_msg(MLOG,"","--bulk_monitor_exit()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_set(BULK_MONITOR_INFO * info, INT channel, float value)
{
INT status;
#ifdef MIDEBUG
cm_msg(MLOG,"","--bulk_monitor_set()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get(BULK_MONITOR_INFO * info, INT channel, float *pvalue)
{
#ifdef MIDEBUG
cm_msg(MLOG,"","++bulk_monitor_get()");
#endif
if ((channel == 0) && pvalue)
*pvalue = n_mon_devices;
else if ((channel == 1) && pvalue)
*pvalue = n_reg_devices;
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_demand(BULK_MONITOR_INFO *info, INT channel, float *pvalue)
{
#ifdef MIDEBUG
cm_msg(MLOG,"","++bulk_monitor_get_demand()");
#endif
if (pvalue) *pvalue = 0.f;
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_all(BULK_MONITOR_INFO * info, INT channels, float *pvalue)
{
if (channels > 0) {
int i;
for (i = 0; i < MIN(channels, info->channels); i++)
bulk_monitor_get(info, i, pvalue + i);
}
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_default_threshold(BULK_MONITOR_INFO * info, INT channel,
float *pvalue) {
if (pvalue != NULL) {
switch (channel) {
default:
*pvalue = 0.5;
/* create settings record */
status = db_create_record(hDB, hkey, "DD", BULK_MONITOR_SETTINGS_STR);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init",
"Error creating DD Settings record in ODB.");
return FE_ERR_ODB;
}
}
return FE_SUCCESS;
status = db_find_key(hDB, hkey, "DD", &hkeydd);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init", "Error %d Finding DD key in ODB.",
status);
return FE_ERR_ODB;
}
size = sizeof(info->bulk_monitor_settings);
status = db_get_record(hDB, hkeydd, &info->bulk_monitor_settings, &size, 0);
if (status != DB_SUCCESS) {
cm_msg(MERROR, "bulk_monitor_init",
"Error %d getting record of DD key in ODB.", status);
return FE_ERR_ODB;
}
/* initialize driver */
#ifdef MIDEBUG
cm_msg(MLOG, "", "--bulk_monitor_init()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_name(BULK_MONITOR_INFO * info, INT channel, char *name)
{
if (name != NULL) {
// return channel name if channel available else NONE
if ((channel >= 0) && (channel < info->channels)) {
char tname[64];
INT bulk_monitor_exit(BULK_MONITOR_INFO *info) {
#ifdef MIDEBUG
cm_msg(MLOG, "", "++bulk_monitor_exit()");
#endif
tname[0] = '\0';
free(info);
#ifdef MIDEBUG
cm_msg(MLOG, "", "--bulk_monitor_exit()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_set(BULK_MONITOR_INFO *info, INT channel, float value) {
INT status;
#ifdef MIDEBUG
cm_msg(MLOG, "", "--bulk_monitor_set()");
#endif
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get(BULK_MONITOR_INFO *info, INT channel, float *pvalue) {
#ifdef MIDEBUG
cm_msg(MLOG, "", "++bulk_monitor_get()");
#endif
if ((channel == 0) && pvalue)
*pvalue = n_mon_devices;
else if ((channel == 1) && pvalue)
*pvalue = n_reg_devices;
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_demand(BULK_MONITOR_INFO *info, INT channel,
float *pvalue) {
#ifdef MIDEBUG
cm_msg(MLOG, "", "++bulk_monitor_get_demand()");
#endif
if (pvalue)
*pvalue = 0.f;
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_all(BULK_MONITOR_INFO *info, INT channels, float *pvalue) {
if (channels > 0) {
int i;
for (i = 0; i < MIN(channels, info->channels); i++)
bulk_monitor_get(info, i, pvalue + i);
}
return FE_SUCCESS;
}
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_default_threshold(BULK_MONITOR_INFO *info, INT channel,
float *pvalue) {
if (pvalue != NULL) {
switch (channel) {
case 0: strcpy(tname,"Num Monitored Devices");
break;
case 1: strcpy(tname,"Num Registered Devices");
break;
case -1:
strcat(tname,"_Error");
break;
default:
sprintf(tname,"Channel_%d",channel);
default:
*pvalue = 0.5;
}
strncpy(name,tname,NAME_LENGTH);
*(name+NAME_LENGTH-1) = '\0';
} else
strcpy(name, "NONE");
}
return FE_SUCCESS;
}
}
return FE_SUCCESS;
/*----------------------------------------------------------------------------*/
INT bulk_monitor_get_name(BULK_MONITOR_INFO *info, INT channel, char *name) {
if (name != NULL) {
// return channel name if channel available else NONE
if ((channel >= 0) && (channel < info->channels)) {
char tname[64];
tname[0] = '\0';
switch (channel) {
case 0:
strcpy(tname, "Num Monitored Devices");
break;
case 1:
strcpy(tname, "Num Registered Devices");
break;
case -1:
strcat(tname, "_Error");
break;
default:
sprintf(tname, "Channel_%d", channel);
}
strncpy(name, tname, NAME_LENGTH);
*(name + NAME_LENGTH - 1) = '\0';
} else
strcpy(name, "NONE");
}
return FE_SUCCESS;
}
/*---- device driver entry point -----------------------------------*/
INT bulk_monitor(INT cmd, ...)
{
va_list argptr;
HNDLE hKey;
INT channel, status;
DWORD flags;
float value, *pvalue;
void *info, *bd;
char *name;
INT bulk_monitor(INT cmd, ...) {
va_list argptr;
HNDLE hKey;
INT channel, status;
DWORD flags;
float value, *pvalue;
void *info, *bd;
char *name;
va_start(argptr, cmd);
status = FE_SUCCESS;
va_start(argptr, cmd);
status = FE_SUCCESS;
switch (cmd) {
case CMD_INIT:
hKey = va_arg(argptr, HNDLE);
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
flags = va_arg(argptr, DWORD);
bd = va_arg(argptr, void *);
status = bulk_monitor_init(hKey, info, channel, bd);
break;
switch (cmd) {
case CMD_INIT:
hKey = va_arg(argptr, HNDLE);
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
flags = va_arg(argptr, DWORD);
bd = va_arg(argptr, void *);
status = bulk_monitor_init(hKey, info, channel, bd);
break;
case CMD_EXIT:
info = va_arg(argptr, void *);
status = bulk_monitor_exit(info);
break;
case CMD_EXIT:
info = va_arg(argptr, void *);
status = bulk_monitor_exit(info);
break;
case CMD_GET:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get(info, channel, pvalue);
break;
case CMD_GET:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get(info, channel, pvalue);
break;
case CMD_GET_DEMAND:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_demand(info, channel, pvalue);
break;
case CMD_GET_DEMAND:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_demand(info, channel, pvalue);
break;
case CMD_SET:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
value = (float) va_arg(argptr, double);
status = bulk_monitor_set(info, channel, value);
break;
case CMD_SET:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
value = (float)va_arg(argptr, double);
status = bulk_monitor_set(info, channel, value);
break;
#ifdef OBSOLETE_2_1
case CMD_GET_ALL:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_all(info, channel, pvalue);
break;
case CMD_GET_ALL:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_all(info, channel, pvalue);
break;
#endif
case CMD_GET_THRESHOLD:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_default_threshold(info, channel, pvalue);
break;
case CMD_GET_THRESHOLD:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
pvalue = va_arg(argptr, float *);
status = bulk_monitor_get_default_threshold(info, channel, pvalue);
break;
case CMD_GET_LABEL:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
name = va_arg(argptr, char *);
status = bulk_monitor_get_name(info, channel, name);
break;
case CMD_GET_LABEL:
info = va_arg(argptr, void *);
channel = va_arg(argptr, INT);
name = va_arg(argptr, char *);
status = bulk_monitor_get_name(info, channel, name);
break;
case CMD_SET_LABEL:
case CMD_SET_LABEL:
#ifdef OBSOLETE_2_1
case CMD_SET_ALL:
case CMD_SET_ALL:
#endif
/* NOT USED not necessary to implement */ ;
break;
/* NOT USED not necessary to implement */;
break;
default:
break;
}
default:
break;
}
va_end(argptr);
va_end(argptr);
return status;
return status;
}
/*------------------------------------------------------------------*/
+1 -1
View File
@@ -3,7 +3,7 @@
Name: bulk_monitor.h
Created by: RA36
Contents: Device driver function declarations for
Contents: Device driver function declarations for
Bulk muSR front-end creating mon files
\********************************************************************/