Improve clang-format file
FossilOrigin-Name: 2bc02cf4700f34b37d510b7b9bedf34ff005dd333cb898dbf964a24f6eefa8cb
This commit is contained in:
parent
7f42da935a
commit
28b0624e98
3 changed files with 40 additions and 26 deletions
|
@ -4,3 +4,14 @@ UseTab: ForIndentation
|
||||||
BreakBeforeBraces: Linux
|
BreakBeforeBraces: Linux
|
||||||
AlwaysBreakAfterReturnType: AllDefinitions
|
AlwaysBreakAfterReturnType: AllDefinitions
|
||||||
AlignAfterOpenBracket: DontAlign
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
ObjCBlockIndentWidth: 8
|
||||||
|
ObjCSpaceAfterProperty: true
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
ObjCPropertyAttributeOrder: [
|
||||||
|
class, direct,
|
||||||
|
readonly, readwrite,
|
||||||
|
nullable, nonnull, null_resettable, null_unspecified,
|
||||||
|
assign, retain, strong, copy, weak, unsafe_unretained,
|
||||||
|
atomic, nonatomic,
|
||||||
|
getter, setter
|
||||||
|
]
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
enum { ID_VAR, ID_COMMAND, ID_ALIAS };
|
enum { ID_VAR, ID_COMMAND, ID_ALIAS };
|
||||||
|
|
||||||
@interface Ident : OFObject
|
@interface Ident : OFObject
|
||||||
@property(nonatomic) int type; // one of ID_* above
|
@property (nonatomic) int type; // one of ID_* above
|
||||||
@property(nonatomic) char *name;
|
@property (nonatomic) char *name;
|
||||||
@property(nonatomic) int min, max; // ID_VAR
|
@property (nonatomic) int min, max; // ID_VAR
|
||||||
@property(nonatomic) int *storage; // ID_VAR
|
@property (nonatomic) int *storage; // ID_VAR
|
||||||
@property(nonatomic) void (*fun)(); // ID_VAR, ID_COMMAND
|
@property (nonatomic) void (*fun)(); // ID_VAR, ID_COMMAND
|
||||||
@property(nonatomic) int narg; // ID_VAR, ID_COMMAND
|
@property (nonatomic) int narg; // ID_VAR, ID_COMMAND
|
||||||
@property(nonatomic) char *action; // ID_ALIAS
|
@property (nonatomic) char *action; // ID_ALIAS
|
||||||
@property(nonatomic) bool persist;
|
@property (nonatomic) bool persist;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation Ident
|
@implementation Ident
|
||||||
|
@ -519,11 +519,11 @@ complete(char *s)
|
||||||
__block int idx = 0;
|
__block int idx = 0;
|
||||||
[idents enumerateKeysAndObjectsUsingBlock:^(
|
[idents enumerateKeysAndObjectsUsingBlock:^(
|
||||||
OFString *name, Ident *ident, bool *stop) {
|
OFString *name, Ident *ident, bool *stop) {
|
||||||
if (strncmp(ident.name, s + 1, completesize) == 0 &&
|
if (strncmp(ident.name, s + 1, completesize) == 0 &&
|
||||||
idx++ == completeidx) {
|
idx++ == completeidx) {
|
||||||
strcpy_s(s, "/");
|
strcpy_s(s, "/");
|
||||||
strcat_s(s, ident.name);
|
strcat_s(s, ident.name);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
completeidx++;
|
completeidx++;
|
||||||
if (completeidx >= idx)
|
if (completeidx >= idx)
|
||||||
|
@ -564,18 +564,19 @@ writecfg()
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
[idents enumerateKeysAndObjectsUsingBlock:^(
|
[idents enumerateKeysAndObjectsUsingBlock:^(
|
||||||
OFString *name, Ident *ident, bool *stop) {
|
OFString *name, Ident *ident, bool *stop) {
|
||||||
if (ident.type == ID_VAR && ident.persist) {
|
if (ident.type == ID_VAR && ident.persist) {
|
||||||
fprintf(f, "%s %d\n", ident.name, *ident.storage);
|
fprintf(f, "%s %d\n", ident.name, *ident.storage);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
writebinds(f);
|
writebinds(f);
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
[idents enumerateKeysAndObjectsUsingBlock:^(
|
[idents enumerateKeysAndObjectsUsingBlock:^(
|
||||||
OFString *name, Ident *ident, bool *stop) {
|
OFString *name, Ident *ident, bool *stop) {
|
||||||
if (ident.type == ID_ALIAS && !strstr(ident.name, "nextmap_")) {
|
if (ident.type == ID_ALIAS && !strstr(ident.name, "nextmap_")) {
|
||||||
fprintf(f, "alias \"%s\" [%s]\n", ident.name, ident.action);
|
fprintf(
|
||||||
}
|
f, "alias \"%s\" [%s]\n", ident.name, ident.action);
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
16
src/cube.h
16
src/cube.h
|
@ -395,7 +395,7 @@ enum // function signatures for script functions, see command.cpp
|
||||||
OF_CONSTRUCTOR() \
|
OF_CONSTRUCTOR() \
|
||||||
{ \
|
{ \
|
||||||
enqueueInit(#name, ^{ \
|
enqueueInit(#name, ^{ \
|
||||||
addcommand(#name, (void (*)())fun, nargs); \
|
addcommand(#name, (void (*)())fun, nargs); \
|
||||||
}); \
|
}); \
|
||||||
}
|
}
|
||||||
#define COMMAND(name, nargs) COMMANDN(name, name, nargs)
|
#define COMMAND(name, nargs) COMMANDN(name, name, nargs)
|
||||||
|
@ -404,7 +404,8 @@ enum // function signatures for script functions, see command.cpp
|
||||||
OF_CONSTRUCTOR() \
|
OF_CONSTRUCTOR() \
|
||||||
{ \
|
{ \
|
||||||
enqueueInit(#name, ^{ \
|
enqueueInit(#name, ^{ \
|
||||||
name = variable(#name, min, cur, max, &name, NULL, true); \
|
name = \
|
||||||
|
variable(#name, min, cur, max, &name, NULL, true); \
|
||||||
}); \
|
}); \
|
||||||
}
|
}
|
||||||
#define VAR(name, min, cur, max) \
|
#define VAR(name, min, cur, max) \
|
||||||
|
@ -412,7 +413,8 @@ enum // function signatures for script functions, see command.cpp
|
||||||
OF_CONSTRUCTOR() \
|
OF_CONSTRUCTOR() \
|
||||||
{ \
|
{ \
|
||||||
enqueueInit(#name, ^{ \
|
enqueueInit(#name, ^{ \
|
||||||
name = variable(#name, min, cur, max, &name, NULL, false); \
|
name = variable( \
|
||||||
|
#name, min, cur, max, &name, NULL, false); \
|
||||||
}); \
|
}); \
|
||||||
}
|
}
|
||||||
#define VARF(name, min, cur, max, body) \
|
#define VARF(name, min, cur, max, body) \
|
||||||
|
@ -421,8 +423,8 @@ enum // function signatures for script functions, see command.cpp
|
||||||
OF_CONSTRUCTOR() \
|
OF_CONSTRUCTOR() \
|
||||||
{ \
|
{ \
|
||||||
enqueueInit(#name, ^{ \
|
enqueueInit(#name, ^{ \
|
||||||
name = variable( \
|
name = variable( \
|
||||||
#name, min, cur, max, &name, var_##name, false); \
|
#name, min, cur, max, &name, var_##name, false); \
|
||||||
}); \
|
}); \
|
||||||
} \
|
} \
|
||||||
void var_##name() { body; }
|
void var_##name() { body; }
|
||||||
|
@ -432,8 +434,8 @@ enum // function signatures for script functions, see command.cpp
|
||||||
OF_CONSTRUCTOR() \
|
OF_CONSTRUCTOR() \
|
||||||
{ \
|
{ \
|
||||||
enqueueInit(#name, ^{ \
|
enqueueInit(#name, ^{ \
|
||||||
name = \
|
name = variable( \
|
||||||
variable(#name, min, cur, max, &name, var_##name, true); \
|
#name, min, cur, max, &name, var_##name, true); \
|
||||||
}); \
|
}); \
|
||||||
} \
|
} \
|
||||||
void var_##name() { body; }
|
void var_##name() { body; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue