- Switched from from a CTK draw service to a statically linked CTK draw implementation.

- Workarounded the following CTK glitch:

ctk.c calls ctk_arch_keyavail() and ctk_arch_getkey() and needs therefore appropriate declarations (or macros) but it doesn't include a ctk_arch.h or alike to bring those in. So it's necessary to bring those declarations in via contiki-conf.h.

But ctk_arch_getkey() is supposed to return a ctk_arch_key_t - and this typedef'ed in ctk.h which means that ctk.h would need to be included in contiki-conf.h before declaring ctk_arch_getkey().

This IS rather undesirable so the current workaround is to declare ctk_arch_getkey() as returning a char - this is btw done similiar in platform/gtk as well. See ctk/ctk-gtksim.h:

guint ctk_arch_getkey(void);
This commit is contained in:
oliverschmidt 2007-04-15 13:30:16 +00:00
parent 13cdcbe393
commit 33eeb8ccbb
7 changed files with 26 additions and 28 deletions

View file

@ -29,7 +29,7 @@
# #
# Author: Oliver Schmidt <ol.sc@web.de> # Author: Oliver Schmidt <ol.sc@web.de>
# #
# $Id: Makefile.win32,v 1.4 2007/04/14 23:23:15 oliverschmidt Exp $ # $Id: Makefile.win32,v 1.5 2007/04/15 13:30:16 oliverschmidt Exp $
# #
ifndef CONTIKI ifndef CONTIKI
@ -41,10 +41,10 @@ TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
CONTIKI_TARGET_DIRS = . cfs ctk loader CONTIKI_TARGET_DIRS = . cfs ctk loader
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32.c ctk-console.c \ CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32.c \
dll-loader.c ctk-console.c dll-loader.c
CONTIKI_SOURCEFILES += $(CTK) ctk-conio-service.c ctk-draw.c wpcap.c wpcap-service.c \ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c wpcap.c wpcap-service.c \
$(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_TARGET_SOURCEFILES)
.SUFFIXES: .SUFFIXES:

View file

@ -1,2 +0,0 @@
#include "ctk/ctk.h"
#include "ctk/ctk-console.h"

View file

@ -35,6 +35,8 @@ typedef unsigned long clock_time_t;
#include <ctype.h> #include <ctype.h>
#define ctk_arch_isprint isprint #define ctk_arch_isprint isprint
#include "ctk/ctk-console.h"
#define CH_ULCORNER 0xDA #define CH_ULCORNER 0xDA
#define CH_URCORNER 0xBF #define CH_URCORNER 0xBF
#define CH_LLCORNER 0xC0 #define CH_LLCORNER 0xC0

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: contiki-main.c,v 1.8 2007/04/14 23:23:15 oliverschmidt Exp $ * $Id: contiki-main.c,v 1.9 2007/04/15 13:30:16 oliverschmidt Exp $
*/ */
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -50,14 +50,12 @@
#include "sys/etimer.h" #include "sys/etimer.h"
#include "cfs/cfs-win32.h" #include "cfs/cfs-win32.h"
#include "ctk/ctk-conio-service.h"
#include "net/wpcap-service.h" #include "net/wpcap-service.h"
#include "program-handler.h" #include "program-handler.h"
PROCINIT(&etimer_process, PROCINIT(&etimer_process,
&wpcap_process, &wpcap_process,
&cfs_win32_process, &cfs_win32_process,
&ctk_conio_service_process,
&ctk_process, &ctk_process,
&tcpip_process, &tcpip_process,
&resolv_process, &resolv_process,

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: ctk-console.c,v 1.8 2007/04/14 14:57:53 oliverschmidt Exp $ * $Id: ctk-console.c,v 1.9 2007/04/15 13:30:16 oliverschmidt Exp $
*/ */
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -401,7 +401,7 @@ console_read(void)
} }
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
ctk_arch_key_t char
ctk_arch_getkey(void) ctk_arch_getkey(void)
{ {
console_read(); console_read();
@ -424,14 +424,26 @@ unsigned short
ctk_mouse_x(void) ctk_mouse_x(void)
{ {
console_read(); console_read();
return xpos * 8; return xpos;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
unsigned short unsigned short
ctk_mouse_y(void) ctk_mouse_y(void)
{ {
console_read(); console_read();
return ypos * 8; return ypos;
}
/*-----------------------------------------------------------------------------------*/
unsigned short
ctk_mouse_xtoc(unsigned short x)
{
return x;
}
/*-----------------------------------------------------------------------------------*/
unsigned short
ctk_mouse_ytoc(unsigned short y)
{
return y;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
unsigned char unsigned char

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* $Id: ctk-console.h,v 1.4 2006/10/03 11:27:51 oliverschmidt Exp $ * $Id: ctk-console.h,v 1.5 2007/04/15 13:30:17 oliverschmidt Exp $
*/ */
#ifndef __CTK_CONSOLE_H__ #ifndef __CTK_CONSOLE_H__
#define __CTK_CONSOLE_H__ #define __CTK_CONSOLE_H__
@ -62,7 +62,7 @@ void cputsxy(unsigned char x, unsigned char y, char *str);
void cputcxy(unsigned char x, unsigned char y, char c); void cputcxy(unsigned char x, unsigned char y, char c);
void textcolor(unsigned char c); void textcolor(unsigned char c);
ctk_arch_key_t ctk_arch_getkey(void); char ctk_arch_getkey(void);
unsigned char ctk_arch_keyavail(void); unsigned char ctk_arch_keyavail(void);
#endif /* __CTK_CONSOLE_H__ */ #endif /* __CTK_CONSOLE_H__ */

View file

@ -249,19 +249,7 @@
Name="ctk" Name="ctk"
> >
<File <File
RelativePath="..\..\..\core\ctk\ctk-conio-service.c" RelativePath="..\..\..\core\ctk\ctk-conio.c"
>
</File>
<File
RelativePath="..\..\..\core\ctk\ctk-conio-service.h"
>
</File>
<File
RelativePath="..\..\..\core\ctk\ctk-draw-service.h"
>
</File>
<File
RelativePath="..\..\..\core\ctk\ctk-draw.c"
> >
</File> </File>
<File <File