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.
*
* $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);
}
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
@ -1171,7 +1180,7 @@ textentry_input(ctk_arch_key_t c, CC_REGISTER_ARG struct ctk_textentry *t)
register char *cptr, *cptr2;
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;
}

View File

@ -43,7 +43,7 @@
*
* 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) \
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) \
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_widget *next;
struct ctk_window *window;
@ -288,6 +288,9 @@ struct ctk_textentry {
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
#define CTK_ICON_BITMAP(bitmap) bitmap

View File

@ -1,19 +1,19 @@
/*
* Copyright (c) 2002-2003, Adam Dunkels.
* All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -25,11 +25,11 @@
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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

@ -1,19 +1,19 @@
/*
* Copyright (c) 2003, Adam Dunkels.
* All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -25,16 +25,18 @@
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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__
#define __CTK_TEXTENTRY_CMDLINE_H__
#include "ctk/ctk.h"
unsigned char ctk_textentry_cmdline_input(ctk_arch_key_t c,
struct ctk_textentry *t);