Clean up enqueueInit
FossilOrigin-Name: d4f57c85c46e6b41cafd3531e032fc55cbedf2596170a2929c0a264c6e99649a
This commit is contained in:
parent
866e81fcde
commit
ce5944a7b1
3 changed files with 13 additions and 13 deletions
10
src/cube.h
10
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); \
|
||||
}); \
|
||||
|
|
14
src/init.mm
14
src/init.mm
|
@ -3,22 +3,22 @@
|
|||
#import "cube.h"
|
||||
#import "protos.h"
|
||||
|
||||
static std::vector<void (^)(void)> *queue;
|
||||
static OFMutableArray<void (^)(void)> *queue;
|
||||
|
||||
void
|
||||
enqueueInit(const char *name, void (^init)(void))
|
||||
enqueueInit(void (^init)(void))
|
||||
{
|
||||
if (queue == NULL)
|
||||
queue = new std::vector<void (^)(void)>();
|
||||
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];
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue