Added a dummy function instead of a NULL callback in the textentry widget because sdcc does not like NULL function pointers

This commit is contained in:
adamdunkels 2009-02-24 21:30:02 +00:00
parent 8d1615459a
commit 0ded8897e6
4 changed files with 39 additions and 25 deletions

View file

@ -44,7 +44,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ctk.c,v 1.18 2007/12/20 20:45:06 oliverschmidt Exp $ * $Id: ctk.c,v 1.19 2009/02/24 21:30:02 adamdunkels Exp $
* *
*/ */
@ -1163,6 +1163,15 @@ activate(CC_REGISTER_ARG struct ctk_widget *w)
process_post(w->window->owner, ctk_signal_widget_activate, w); process_post(w->window->owner, ctk_signal_widget_activate, w);
} }
return REDRAW_NONE; return REDRAW_NONE;
}
/*---------------------------------------------------------------------------*/
/* Dummy function that we define to keep sdcc happy - with sdcc,
function pointers cannot be NULL. ctk_textentry_input is typedef'd
in ctk/ctk.h, hence the strange-looking function signature. */
ctk_textentry_input
ctk_textentry_input_null
{
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void CC_FASTCALL static void CC_FASTCALL
@ -1171,7 +1180,7 @@ textentry_input(ctk_arch_key_t c, CC_REGISTER_ARG struct ctk_textentry *t)
register char *cptr, *cptr2; register char *cptr, *cptr2;
static unsigned char len, txpos, typos, tlen; static unsigned char len, txpos, typos, tlen;
if(t->input != NULL && t->input(c, t)) { if(t->input != ctk_textentry_input_null && t->input(c, t)) {
return; return;
} }

View file

@ -43,7 +43,7 @@
* *
* This file is part of the Contiki desktop OS. * This file is part of the Contiki desktop OS.
* *
* $Id: ctk.h,v 1.6 2008/11/27 23:40:24 adamdunkels Exp $ * $Id: ctk.h,v 1.7 2009/02/24 21:30:02 adamdunkels Exp $
* *
*/ */
@ -268,10 +268,10 @@ typedef unsigned char (* ctk_textentry_input)(ctk_arch_key_t c,
*/ */
#define CTK_TEXTENTRY(x, y, w, h, text, len) \ #define CTK_TEXTENTRY(x, y, w, h, text, len) \
NULL, NULL, x, y, CTK_WIDGET_TEXTENTRY, w, 1, CTK_WIDGET_FLAG_INITIALIZER(0) text, len, \ NULL, NULL, x, y, CTK_WIDGET_TEXTENTRY, w, 1, CTK_WIDGET_FLAG_INITIALIZER(0) text, len, \
CTK_TEXTENTRY_NORMAL, 0, 0, NULL CTK_TEXTENTRY_NORMAL, 0, 0, ctk_textentry_input_null
#define CTK_TEXTENTRY_INPUT(x, y, w, h, text, len, input) \ #define CTK_TEXTENTRY_INPUT(x, y, w, h, text, len, input) \
NULL, NULL, x, y, CTK_WIDGET_TEXTENTRY, w, h, CTK_WIDGET_FLAG_INITIALIZER(0) text, len, \ NULL, NULL, x, y, CTK_WIDGET_TEXTENTRY, w, h, CTK_WIDGET_FLAG_INITIALIZER(0) text, len, \
CTK_TEXTENTRY_NORMAL, 0, 0, (ctk_textentry_input)input CTK_TEXTENTRY_NORMAL, 0, 0, input
struct ctk_textentry { struct ctk_textentry {
struct ctk_widget *next; struct ctk_widget *next;
struct ctk_window *window; struct ctk_window *window;
@ -288,6 +288,9 @@ struct ctk_textentry {
ctk_textentry_input input; ctk_textentry_input input;
}; };
/* Dummy function that we define to keep sdcc happy - with sdcc,
function pointers cannot be NULL.*/
ctk_textentry_input ctk_textentry_input_null;
#if CTK_CONF_ICON_BITMAPS #if CTK_CONF_ICON_BITMAPS
#define CTK_ICON_BITMAP(bitmap) bitmap #define CTK_ICON_BITMAP(bitmap) bitmap

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: ctk-textentry-cmdline.c,v 1.2 2007/05/26 21:41:01 oliverschmidt Exp $ * $Id: ctk-textentry-cmdline.c,v 1.3 2009/02/24 21:30:02 adamdunkels Exp $
* *
*/ */

View file

@ -29,12 +29,14 @@
* *
* This file is part of the Contiki desktop environment * This file is part of the Contiki desktop environment
* *
* $Id: ctk-textentry-cmdline.h,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $ * $Id: ctk-textentry-cmdline.h,v 1.2 2009/02/24 21:30:02 adamdunkels Exp $
* *
*/ */
#ifndef __CTK_TEXTENTRY_CMDLINE_H__ #ifndef __CTK_TEXTENTRY_CMDLINE_H__
#define __CTK_TEXTENTRY_CMDLINE_H__ #define __CTK_TEXTENTRY_CMDLINE_H__
#include "ctk/ctk.h"
unsigned char ctk_textentry_cmdline_input(ctk_arch_key_t c, unsigned char ctk_textentry_cmdline_input(ctk_arch_key_t c,
struct ctk_textentry *t); struct ctk_textentry *t);