summaryrefslogtreecommitdiff
path: root/nuttx/examples/nx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/examples/nx')
-rw-r--r--nuttx/examples/nx/nx_events.c29
-rw-r--r--nuttx/examples/nx/nx_internal.h36
-rw-r--r--nuttx/examples/nx/nx_kbdin.c22
-rw-r--r--nuttx/examples/nx/nx_main.c12
-rw-r--r--nuttx/examples/nx/nx_server.c3
5 files changed, 54 insertions, 48 deletions
diff --git a/nuttx/examples/nx/nx_events.c b/nuttx/examples/nx/nx_events.c
index 7d5dc399c..b36af7975 100644
--- a/nuttx/examples/nx/nx_events.c
+++ b/nuttx/examples/nx/nx_events.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nx/nx_events.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,8 @@
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <semaphore.h>
#include <debug.h>
@@ -62,26 +63,26 @@
****************************************************************************/
static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- boolean morem, FAR void *arg);
+ bool morem, FAR void *arg);
static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
#ifdef CONFIG_NX_MOUSE
static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
- ubyte buttons, FAR void *arg);
+ uint8_t buttons, FAR void *arg);
#endif
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- boolean morem, FAR void *arg);
+ bool morem, FAR void *arg);
static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
#ifdef CONFIG_NX_MOUSE
static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
- ubyte buttons, FAR void *arg);
+ uint8_t buttons, FAR void *arg);
#endif
#endif
@@ -175,13 +176,13 @@ static inline void nxeg_filltoolbar(NXTKWINDOW htb,
****************************************************************************/
static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- boolean more, FAR void *arg)
+ bool more, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_redraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n",
st->wnum, hwnd,
rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y,
- more ? "TRUE" : "FALSE");
+ more ? "true" : "false");
nxeg_fillwindow(hwnd, rect, st);
}
@@ -212,7 +213,7 @@ static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
g_xres = bounds->pt2.x;
g_yres = bounds->pt2.y;
- b_haveresolution = TRUE;
+ b_haveresolution = true;
sem_post(&g_semevent);
message("nxeg_position2: Have xres=%d yres=%d\n", g_xres, g_yres);
}
@@ -224,7 +225,7 @@ static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
#ifdef CONFIG_NX_MOUSE
static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
- ubyte buttons, FAR void *arg)
+ uint8_t buttons, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_mousein%d: hwnd=%p pos=(%d,%d) button=%02x\n",
@@ -238,13 +239,13 @@ static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- boolean more, FAR void *arg)
+ bool more, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_tbredraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n",
st->wnum, hwnd,
rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y,
- more ? "TRUE" : "FALSE");
+ more ? "true" : "false");
nxeg_filltoolbar(hwnd, rect, g_tbcolor);
}
#endif
@@ -276,7 +277,7 @@ static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
#ifdef CONFIG_NX_MOUSE
static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
- ubyte buttons, FAR void *arg)
+ uint8_t buttons, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
@@ -326,7 +327,7 @@ FAR void *nx_listenerthread(FAR void *arg)
if (!g_connected)
{
- g_connected = TRUE;
+ g_connected = true;
sem_post(&g_semevent);
message("nx_listenerthread: Connected\n");
}
diff --git a/nuttx/examples/nx/nx_internal.h b/nuttx/examples/nx/nx_internal.h
index fa3e34769..cb94e8dd7 100644
--- a/nuttx/examples/nx/nx_internal.h
+++ b/nuttx/examples/nx/nx_internal.h
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nx/nx_internal.h
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
+#include <stdint.h>
+#include <stdbool.h>
#include <semaphore.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
@@ -207,11 +209,11 @@ enum exitcode_e
struct nxeg_glyph_s
{
- ubyte code; /* Character code */
- ubyte height; /* Height of this glyph (in rows) */
- ubyte width; /* Width of this glyph (in pixels) */
- ubyte stride; /* Width of the glyph row (in bytes) */
- FAR ubyte *bitmap; /* Allocated bitmap memory */
+ uint8_t code; /* Character code */
+ uint8_t height; /* Height of this glyph (in rows) */
+ uint8_t width; /* Width of this glyph (in pixels) */
+ uint8_t stride; /* Width of the glyph row (in bytes) */
+ FAR uint8_t *bitmap; /* Allocated bitmap memory */
};
/* Describes on character on the display */
@@ -226,16 +228,16 @@ struct nxeg_bitmap_s
struct nxeg_state_s
{
- ubyte wnum; /* Window number */
+ uint8_t wnum; /* Window number */
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Window color */
#ifdef CONFIG_NX_KBD
- ubyte height; /* Max height of a font in pixels */
- ubyte width; /* Max width of a font in pixels */
- ubyte spwidth; /* The width of a space */
+ uint8_t height; /* Max height of a font in pixels */
+ uint8_t width; /* Max width of a font in pixels */
+ uint8_t spwidth; /* The width of a space */
- ubyte nchars; /* Number of KBD chars received */
- ubyte nglyphs; /* Number of glyphs cached */
+ uint8_t nchars; /* Number of KBD chars received */
+ uint8_t nglyphs; /* Number of glyphs cached */
struct nxeg_bitmap_s bm[NXTK_MAXKBDCHARS];
struct nxeg_glyph_s glyph[NXTK_MAXKBDCHARS];
@@ -262,9 +264,9 @@ extern const struct nx_callback_s g_tbcb;
nxgl_coord_t g_xres;
nxgl_coord_t g_yres;
-extern boolean b_haveresolution;
+extern bool b_haveresolution;
#ifdef CONFIG_NX_MULTIUSER
-extern boolean g_connected;
+extern bool g_connected;
#endif
extern sem_t g_semevent;
@@ -286,9 +288,9 @@ extern FAR void *nx_listenerthread(FAR void *arg);
#endif
#ifdef CONFIG_NX_KBD
-extern void nxeg_kbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg);
+extern void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg);
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
-extern void nxeg_tbkbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg);
+extern void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg);
#endif
extern void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR struct nxeg_state_s *st);
diff --git a/nuttx/examples/nx/nx_kbdin.c b/nuttx/examples/nx/nx_kbdin.c
index 6ae04b56d..adfd686f7 100644
--- a/nuttx/examples/nx/nx_kbdin.c
+++ b/nuttx/examples/nx/nx_kbdin.c
@@ -39,7 +39,7 @@
#include <nuttx/config.h>
-#include <sys/types.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -138,7 +138,8 @@ static void nxeg_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
****************************************************************************/
static inline FAR const struct nxeg_glyph_s *
-nxeg_renderglyph(FAR struct nxeg_state_s *st, FAR const struct nx_fontbitmap_s *bm, ubyte ch)
+nxeg_renderglyph(FAR struct nxeg_state_s *st,
+ FAR const struct nx_fontbitmap_s *bm, uint8_t ch)
{
FAR struct nxeg_glyph_s *glyph = NULL;
FAR nxgl_mxpixel_t *ptr;
@@ -166,7 +167,7 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st, FAR const struct nx_fontbitmap_s *
glyph->stride = (glyph->width * CONFIG_EXAMPLES_NX_BPP + 7) / 8;
bmsize = glyph->stride * glyph->height;
- glyph->bitmap = (FAR ubyte *)malloc(bmsize);
+ glyph->bitmap = (FAR uint8_t *)malloc(bmsize);
if (glyph->bitmap)
{
@@ -215,7 +216,7 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st, FAR const struct nx_fontbitmap_s *
****************************************************************************/
static inline FAR const struct nxeg_glyph_s *
-nxeg_addspace(FAR struct nxeg_state_s *st, ubyte ch)
+nxeg_addspace(FAR struct nxeg_state_s *st, uint8_t ch)
{
FAR struct nxeg_glyph_s *glyph = NULL;
@@ -241,7 +242,7 @@ nxeg_addspace(FAR struct nxeg_state_s *st, ubyte ch)
****************************************************************************/
static FAR const struct nxeg_glyph_s *
-nxeg_findglyph(FAR struct nxeg_state_s *st, ubyte ch)
+nxeg_findglyph(FAR struct nxeg_state_s *st, uint8_t ch)
{
int i;
@@ -262,7 +263,7 @@ nxeg_findglyph(FAR struct nxeg_state_s *st, ubyte ch)
****************************************************************************/
static FAR const struct nxeg_glyph_s *
-nxeg_getglyph(FAR struct nxeg_state_s *st, ubyte ch)
+nxeg_getglyph(FAR struct nxeg_state_s *st, uint8_t ch)
{
FAR const struct nxeg_glyph_s *glyph;
FAR const struct nx_fontbitmap_s *bm;
@@ -300,7 +301,7 @@ nxeg_getglyph(FAR struct nxeg_state_s *st, ubyte ch)
****************************************************************************/
static FAR const struct nxeg_bitmap_s *
-nxeg_addchar(FAR struct nxeg_state_s *st, ubyte ch)
+nxeg_addchar(FAR struct nxeg_state_s *st, uint8_t ch)
{
FAR struct nxeg_bitmap_s *bm = NULL;
FAR struct nxeg_bitmap_s *bmleft;
@@ -353,7 +354,7 @@ nxeg_addchar(FAR struct nxeg_state_s *st, ubyte ch)
****************************************************************************/
static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st,
- ubyte nch, FAR const ubyte *ch)
+ uint8_t nch, FAR const uint8_t *ch)
{
FAR const struct nxeg_bitmap_s *bm;
@@ -375,7 +376,8 @@ static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st,
* Name: nxeg_kbdin
****************************************************************************/
-void nxeg_kbdin(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg)
+void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
+ FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_kbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch);
@@ -387,7 +389,7 @@ void nxeg_kbdin(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg)
****************************************************************************/
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
-void nxeg_tbkbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg)
+void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_tbkbdin: ERROR -- toolbar should not received keyboard input\n");
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c
index 8ea2fd4ac..a07bfd3c4 100644
--- a/nuttx/examples/nx/nx_main.c
+++ b/nuttx/examples/nx/nx_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nx/nx_main.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,8 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -78,8 +80,8 @@ static int g_exitcode = NXEXIT_SUCCESS;
static struct nxeg_state_s g_wstate[2];
#ifdef CONFIG_NX_KBD
-static const ubyte g_kbdmsg1[] = "NuttX is cool!";
-static const ubyte g_kbdmsg2[] = "NuttX is fun!";
+static const uint8_t g_kbdmsg1[] = "NuttX is cool!";
+static const uint8_t g_kbdmsg2[] = "NuttX is fun!";
#endif
/****************************************************************************
@@ -95,9 +97,9 @@ NXHANDLE g_hnx = NULL;
nxgl_coord_t g_xres;
nxgl_coord_t g_yres;
-boolean b_haveresolution = FALSE;
+bool b_haveresolution = false;
#ifdef CONFIG_NX_MULTIUSER
-boolean g_connected = FALSE;
+bool g_connected = false;
#endif
sem_t g_semevent = {0};
diff --git a/nuttx/examples/nx/nx_server.c b/nuttx/examples/nx/nx_server.c
index 1ac3258aa..1a931a87c 100644
--- a/nuttx/examples/nx/nx_server.c
+++ b/nuttx/examples/nx/nx_server.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nx/nx_server.c
*
- * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>