Index: src/.clang-format ================================================================== --- src/.clang-format +++ src/.clang-format @@ -2,5 +2,16 @@ TabWidth: 8 UseTab: ForIndentation BreakBeforeBraces: Linux AlwaysBreakAfterReturnType: AllDefinitions 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 +] Index: src/command.mm ================================================================== --- src/command.mm +++ src/command.mm @@ -4,18 +4,18 @@ #include "cube.h" enum { ID_VAR, ID_COMMAND, ID_ALIAS }; @interface Ident : OFObject -@property(nonatomic) int type; // one of ID_* above -@property(nonatomic) char *name; -@property(nonatomic) int min, max; // ID_VAR -@property(nonatomic) int *storage; // ID_VAR -@property(nonatomic) void (*fun)(); // ID_VAR, ID_COMMAND -@property(nonatomic) int narg; // ID_VAR, ID_COMMAND -@property(nonatomic) char *action; // ID_ALIAS -@property(nonatomic) bool persist; +@property (nonatomic) int type; // one of ID_* above +@property (nonatomic) char *name; +@property (nonatomic) int min, max; // ID_VAR +@property (nonatomic) int *storage; // ID_VAR +@property (nonatomic) void (*fun)(); // ID_VAR, ID_COMMAND +@property (nonatomic) int narg; // ID_VAR, ID_COMMAND +@property (nonatomic) char *action; // ID_ALIAS +@property (nonatomic) bool persist; @end @implementation Ident @end @@ -517,15 +517,15 @@ completeidx = 0; } __block int idx = 0; [idents enumerateKeysAndObjectsUsingBlock:^( OFString *name, Ident *ident, bool *stop) { - if (strncmp(ident.name, s + 1, completesize) == 0 && - idx++ == completeidx) { - strcpy_s(s, "/"); - strcat_s(s, ident.name); - } + if (strncmp(ident.name, s + 1, completesize) == 0 && + idx++ == completeidx) { + strcpy_s(s, "/"); + strcat_s(s, ident.name); + } }]; completeidx++; if (completeidx >= idx) completeidx = 0; } @@ -562,22 +562,23 @@ "autoexec.cfg to override anything\n\n"); writeclientinfo(f); fprintf(f, "\n"); [idents enumerateKeysAndObjectsUsingBlock:^( OFString *name, Ident *ident, bool *stop) { - if (ident.type == ID_VAR && ident.persist) { - fprintf(f, "%s %d\n", ident.name, *ident.storage); - } + if (ident.type == ID_VAR && ident.persist) { + fprintf(f, "%s %d\n", ident.name, *ident.storage); + } }]; fprintf(f, "\n"); writebinds(f); fprintf(f, "\n"); [idents enumerateKeysAndObjectsUsingBlock:^( OFString *name, Ident *ident, bool *stop) { - if (ident.type == ID_ALIAS && !strstr(ident.name, "nextmap_")) { - fprintf(f, "alias \"%s\" [%s]\n", ident.name, ident.action); - } + if (ident.type == ID_ALIAS && !strstr(ident.name, "nextmap_")) { + fprintf( + f, "alias \"%s\" [%s]\n", ident.name, ident.action); + } }]; fclose(f); } COMMAND(writecfg, ARG_NONE); Index: src/cube.h ================================================================== --- src/cube.h +++ src/cube.h @@ -393,49 +393,51 @@ // excessive infrastructure #define COMMANDN(name, fun, nargs) \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ - addcommand(#name, (void (*)())fun, nargs); \ + addcommand(#name, (void (*)())fun, nargs); \ }); \ } #define COMMAND(name, nargs) COMMANDN(name, name, nargs) #define VARP(name, min, cur, max) \ int name; \ OF_CONSTRUCTOR() \ { \ 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) \ int name; \ OF_CONSTRUCTOR() \ { \ 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) \ void var_##name(); \ static int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ - name = variable( \ - #name, min, cur, max, &name, var_##name, false); \ + name = variable( \ + #name, min, cur, max, &name, var_##name, false); \ }); \ } \ void var_##name() { body; } #define VARFP(name, min, cur, max, body) \ void var_##name(); \ static int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ - name = \ - variable(#name, min, cur, max, &name, var_##name, true); \ + name = variable( \ + #name, min, cur, max, &name, var_##name, true); \ }); \ } \ void var_##name() { body; } #define ATOI(s) strtol(s, NULL, 0) // supports hexadecimal numbers