From: ewt Date: Tue, 25 Feb 1997 23:11:57 +0000 (+0000) Subject: C++ cleanups from sopwith X-Git-Tag: v0-9~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45c366b136b54ed9ffde885d7651fff50b41bb38;p=thirdparty%2Fnewt.git C++ cleanups from sopwith --- diff --git a/button.c b/button.c index 110ec42..c58b3dd 100644 --- a/button.c +++ b/button.c @@ -15,7 +15,7 @@ static void buttonDrawText(newtComponent co, int active, int pushed); static void buttonDraw(newtComponent c); static void buttonDestroy(newtComponent co); -static struct eventResult buttonEvent(struct newtComponent * c, +static struct eventResult buttonEvent(newtComponent c, struct event ev); static struct componentOps buttonOps = { @@ -93,7 +93,7 @@ static void buttonDrawText(newtComponent co, int active, int pushed) { SLsmg_write_char(' '); } -static struct eventResult buttonEvent(struct newtComponent * co, +static struct eventResult buttonEvent(newtComponent co, struct event ev) { struct eventResult er; diff --git a/checkbox.c b/checkbox.c index d554811..b787781 100644 --- a/checkbox.c +++ b/checkbox.c @@ -23,7 +23,7 @@ static void makeActive(newtComponent co); static void cbDraw(newtComponent c); static void cbDestroy(newtComponent co); -struct eventResult cbEvent(struct newtComponent * co, struct event ev); +struct eventResult cbEvent(newtComponent co, struct event ev); static struct componentOps cbOps = { cbDraw, @@ -187,7 +187,7 @@ static void cbDestroy(newtComponent co) { free(co); } -struct eventResult cbEvent(struct newtComponent * co, struct event ev) { +struct eventResult cbEvent(newtComponent co, struct event ev) { struct checkbox * cb = co->data; struct eventResult er; char * cur; diff --git a/entry.c b/entry.c index 7aa76d3..d696967 100644 --- a/entry.c +++ b/entry.c @@ -18,10 +18,10 @@ struct entry { static void entryDraw(newtComponent co); static void entryDestroy(newtComponent co); -static struct eventResult entryEvent(struct newtComponent * co, +static struct eventResult entryEvent(newtComponent co, struct event ev); -static struct eventResult entryHandleKey(struct newtComponent * co, int key); +static struct eventResult entryHandleKey(newtComponent co, int key); static struct componentOps entryOps = { entryDraw, @@ -171,7 +171,7 @@ static void entryDestroy(newtComponent co) { free(co); } -static struct eventResult entryEvent(struct newtComponent * co, +static struct eventResult entryEvent(newtComponent co, struct event ev) { struct entry * en = co->data; struct eventResult er; @@ -205,7 +205,7 @@ static struct eventResult entryEvent(struct newtComponent * co, return er; } -static struct eventResult entryHandleKey(struct newtComponent * co, int key) { +static struct eventResult entryHandleKey(newtComponent co, int key) { struct entry * en = co->data; struct eventResult er; char * chptr, * insPoint; diff --git a/newt.c b/newt.c index 043b8a7..86eeecd 100644 --- a/newt.c +++ b/newt.c @@ -454,7 +454,7 @@ void newtDelay(int usecs) { select(0, &set, &set, &set, &tv); } -struct eventResult newtDefaultEventHandler(struct newtComponent * c, +struct eventResult newtDefaultEventHandler(newtComponent c, struct event ev) { struct eventResult er; diff --git a/newt.h b/newt.h index 927323a..2b5c0bf 100644 --- a/newt.h +++ b/newt.h @@ -1,6 +1,10 @@ #ifndef H_NEWT #define H_NEWT +#ifdef __cplusplus +extern "C" { +#endif + #define NEWT_COLORSET_ROOT 2 #define NEWT_COLORSET_BORDER 3 #define NEWT_COLORSET_WINDOW 4 @@ -46,7 +50,7 @@ struct newtColors { char * disabledEntryFg, * disabledEntryBg; }; -typedef struct newtComponent * newtComponent; +typedef struct newtComponent_struct * newtComponent; extern struct newtColors newtDefaultColorPalette; @@ -186,4 +190,8 @@ void newtFormDestroy(newtComponent form); #define NEWT_KEY_F11 NEWT_KEY_EXTRA_BASE + 111 #define NEWT_KEY_F12 NEWT_KEY_EXTRA_BASE + 112 +#ifdef __cplusplus +} /* End of extern "C" { */ +#endif + #endif /* H_NEWT */ diff --git a/newt_pr.h b/newt_pr.h index e6eb0a1..7efa55b 100644 --- a/newt_pr.h +++ b/newt_pr.h @@ -26,7 +26,7 @@ void newtClearBox(int left, int top, int width, int height); int newtGetKey(void); -struct newtComponent { +struct newtComponent_struct { /* common data */ int height, width; int top, left; @@ -61,12 +61,12 @@ struct event { } ; struct componentOps { - void (* draw)(struct newtComponent * c); - struct eventResult (* event)(struct newtComponent * c, struct event ev); - void (* destroy)(struct newtComponent * c); + void (* draw)(newtComponent c); + struct eventResult (* event)(newtComponent c, struct event ev); + void (* destroy)(newtComponent c); } ; -struct eventResult newtDefaultEventHandler(struct newtComponent * c, +struct eventResult newtDefaultEventHandler(newtComponent c, struct event ev); #endif /* H_NEWT_PR */ diff --git a/textbox.c b/textbox.c index 5f9a6ba..1dcacfb 100644 --- a/textbox.c +++ b/textbox.c @@ -18,7 +18,7 @@ struct textbox { static void addLine(newtComponent co, const char * s, int len); static void textboxDraw(newtComponent co); static void addShortLine(newtComponent co, const char * s, int len); -static struct eventResult textboxEvent(struct newtComponent * c, +static struct eventResult textboxEvent(newtComponent c, struct event ev); static void textboxDestroy(newtComponent co); @@ -151,7 +151,7 @@ static void textboxDraw(newtComponent c) { } } -static struct eventResult textboxEvent(struct newtComponent * co, +static struct eventResult textboxEvent(newtComponent co, struct event ev) { struct textbox * tb = co->data; struct eventResult er;