Skip to content

Commit

Permalink
Made pumpEvents hook type a formal enumeration.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 23, 2007
1 parent 0a9d2d3 commit d240fd7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/toby_app.c
Expand Up @@ -868,7 +868,7 @@ static int luahook_stackwalk(lua_State *L)

static void luaDebugHook(lua_State *L, lua_Debug *ar)
{
if (!TOBY_pumpEvents(ar->event, ar->currentline))
if (!TOBY_pumpEvents((TobyHookType) ar->event, ar->currentline))
haltProgram(L);
} /* luaDebugHook */

Expand Down Expand Up @@ -946,10 +946,10 @@ void TOBY_runProgram(const char *source_code, int run_for_printing)
{
lua_State *L;

assert(TOBY_HOOKCALL == LUA_HOOKCALL);
assert(TOBY_HOOKRET == LUA_HOOKRET);
assert(TOBY_HOOKLINE == LUA_HOOKLINE);
assert(TOBY_HOOKCOUNT == LUA_HOOKCOUNT);
assert(((int) TOBY_HOOKCALL) == LUA_HOOKCALL);
assert(((int) TOBY_HOOKRET) == LUA_HOOKRET);
assert(((int) TOBY_HOOKLINE) == LUA_HOOKLINE);
assert(((int) TOBY_HOOKCOUNT) == LUA_HOOKCOUNT);

resetProgramState();

Expand Down
16 changes: 9 additions & 7 deletions src/toby_app.h
Expand Up @@ -71,12 +71,14 @@ typedef struct TobyCallstack
int linenum;
} TobyCallstack;


#define TOBY_HOOKDELAY -1
#define TOBY_HOOKCALL 0
#define TOBY_HOOKRET 1
#define TOBY_HOOKLINE 2
#define TOBY_HOOKCOUNT 3
typedef enum TobyHookType
{
TOBY_HOOKDELAY=-1,
TOBY_HOOKCALL,
TOBY_HOOKRET,
TOBY_HOOKLINE,
TOBY_HOOKCOUNT,
} TobyHookType;


/* !!! FIXME: comment this */
Expand Down Expand Up @@ -126,7 +128,7 @@ void TOBY_stopRun(void);
* Let UI pump its event queue. Return non-zero to keep going, zero to
* stop program execution, making TOBY_runProgram() return.
*/
int TOBY_pumpEvents(int hook, int currentline);
int TOBY_pumpEvents(TobyHookType hook, int currentline);


/*
Expand Down
2 changes: 1 addition & 1 deletion src/toby_sdl.c
Expand Up @@ -69,7 +69,7 @@ void TOBY_stopRun()
} /* TOBY_stopRun */


int TOBY_pumpEvents(int hook, int currentline)
int TOBY_pumpEvents(TobyHookType hook, int currentline)
{
SDL_Event e;
const Uint32 now = SDL_GetTicks();
Expand Down
6 changes: 3 additions & 3 deletions src/toby_wxwidgets.cpp
Expand Up @@ -145,7 +145,7 @@ class TobyFrame : public wxFrame
void openFile(const wxString &path);
void startRun();
void stopRun();
bool pumpEvents(int hook=TOBY_HOOKDELAY, int currentline=-1);
bool pumpEvents(TobyHookType hook=TOBY_HOOKDELAY, int currentline=-1);
inline long delayTicksPerLine() { return this->delayPerLine; }
inline void requestQuit();
inline void runProgram(bool printing);
Expand Down Expand Up @@ -342,7 +342,7 @@ void TOBY_stopRun()
} // TOBY_stopRun


int TOBY_pumpEvents(int hook, int currentline)
int TOBY_pumpEvents(TobyHookType hook, int currentline)
{
return wxGetApp().getTobyFrame()->pumpEvents(hook, currentline) ? 1 : 0;
} // TOBY_pumpEvents
Expand Down Expand Up @@ -844,7 +844,7 @@ const wxSize TobyFrame::getPreviousSize()
} // TobyFrame::getPreviousSize


bool TobyFrame::pumpEvents(int hook, int currentline)
bool TobyFrame::pumpEvents(TobyHookType hook, int currentline)
{
// should only break inside this function, and should block here until
// breakpoint ends and program continues.
Expand Down

0 comments on commit d240fd7

Please sign in to comment.