Index: src/cube.h ================================================================== --- src/cube.h +++ src/cube.h @@ -395,39 +395,39 @@ // nasty macros for registering script functions, abuses globals to avoid // excessive infrastructure #define COMMANDN(name, fun, nargs) \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ 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, ^{ \ + enqueueInit(^{ \ name = \ variable(#name, min, cur, max, &name, NULL, true); \ }); \ } #define VAR(name, min, cur, max) \ int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ 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, ^{ \ + enqueueInit(^{ \ name = variable( \ #name, min, cur, max, &name, var_##name, false); \ }); \ } \ void var_##name() { body; } @@ -434,11 +434,11 @@ #define VARFP(name, min, cur, max, body) \ void var_##name(); \ static int name; \ OF_CONSTRUCTOR() \ { \ - enqueueInit(#name, ^{ \ + enqueueInit(^{ \ name = variable( \ #name, min, cur, max, &name, var_##name, true); \ }); \ } \ void var_##name() { body; } Index: src/init.mm ================================================================== --- src/init.mm +++ src/init.mm @@ -1,24 +1,24 @@ #include #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]; } Index: src/protos.h ================================================================== --- src/protos.h +++ src/protos.h @@ -22,11 +22,11 @@ extern void conoutf(OFString *s, ...); 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 extern bool rendermenu(); extern void menuset(int menu);