diff --git a/src/cube.h b/src/cube.h index ce82bb9..d2c0234 100644 --- a/src/cube.h +++ b/src/cube.h @@ -397,7 +397,7 @@ enum // function signatures for script functions, see command.cpp #define COMMANDN(name, fun, nargs) \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ addcommand(#name, (void (*)())fun, nargs); \ }); \ } @@ -406,7 +406,7 @@ enum // function signatures for script functions, see command.cpp int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ name = \ variable(#name, min, cur, max, &name, NULL, true); \ }); \ @@ -415,7 +415,7 @@ enum // function signatures for script functions, see command.cpp int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ name = variable( \ #name, min, cur, max, &name, NULL, false); \ }); \ @@ -425,7 +425,7 @@ enum // function signatures for script functions, see command.cpp static int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ name = variable( \ #name, min, cur, max, &name, var_##name, false); \ }); \ @@ -436,7 +436,7 @@ enum // function signatures for script functions, see command.cpp static int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ name = variable( \ #name, min, cur, max, &name, var_##name, true); \ }); \ diff --git a/src/init.mm b/src/init.mm index e599ca8..ead364f 100644 --- a/src/init.mm +++ b/src/init.mm @@ -3,22 +3,22 @@ #import "cube.h" #import "protos.h" -static std::vector *queue; +static OFMutableArray *queue; void -enqueueInit(const char *name, void (^init)(void)) +enqueueInit(void (^init)(void)) { - if (queue == NULL) - queue = new std::vector(); + if (queue == nil) + queue = [[OFMutableArray alloc] init]; - queue->push_back(init); + [queue addObject:init]; } void processInitQueue(void) { - for (auto &init : *queue) + for (void (^init)(void) in queue) init(); - queue->clear(); + [queue removeAllObjects]; } diff --git a/src/protos.h b/src/protos.h index 1d80a0b..b4c510f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -24,7 +24,7 @@ extern char *getcurcommand(); extern void writebinds(FILE *f); // init -extern void enqueueInit(const char *name, void (^init)(void)); +extern void enqueueInit(void (^init)(void)); extern void processInitQueue(void); // menus