summaryrefslogtreecommitdiff
path: root/apps/examples/nxtext/nxtext_main.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-30 20:13:50 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-30 20:13:50 +0000
commit79c7065433ae27932ad8b781d38b8f7832b01581 (patch)
treef770414832eeecb35adb70404b31d147afad7235 /apps/examples/nxtext/nxtext_main.c
parentf9d19788072090be80b71ab0d0de14507a6e739b (diff)
downloadpx4-nuttx-79c7065433ae27932ad8b781d38b8f7832b01581.tar.gz
px4-nuttx-79c7065433ae27932ad8b781d38b8f7832b01581.tar.bz2
px4-nuttx-79c7065433ae27932ad8b781d38b8f7832b01581.zip
Add configurable application entry point
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5070 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/nxtext/nxtext_main.c')
-rw-r--r--apps/examples/nxtext/nxtext_main.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c
index 437b03e5a..9a4b8eea4 100644
--- a/apps/examples/nxtext/nxtext_main.c
+++ b/apps/examples/nxtext/nxtext_main.c
@@ -345,18 +345,10 @@ static int nxtext_initialize(void)
****************************************************************************/
/****************************************************************************
- * Name: user_start/nxtext_main
+ * Name: nxtext_main
****************************************************************************/
-#ifdef CONFIG_EXAMPLES_NXTEXT_BUILTIN
-# define MAIN_NAME nxtext_main
-# define MAIN_NAME_STRING "nxtext_main"
-#else
-# define MAIN_NAME user_start
-# define MAIN_NAME_STRING "user_start"
-#endif
-
-int MAIN_NAME(int argc, char **argv)
+int nxtext_main(int argc, char **argv)
{
FAR struct nxtext_state_s *bgstate;
NXWINDOW hwnd = NULL;
@@ -368,10 +360,10 @@ int MAIN_NAME(int argc, char **argv)
/* Initialize NX */
ret = nxtext_initialize();
- message(MAIN_NAME_STRING ": NX handle=%p\n", g_hnx);
+ message("nxtext_main: NX handle=%p\n", g_hnx);
if (!g_hnx || ret < 0)
{
- message(MAIN_NAME_STRING ": Failed to get NX handle: %d\n", errno);
+ message("nxtext_main: Failed to get NX handle: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN;
goto errout;
}
@@ -381,7 +373,7 @@ int MAIN_NAME(int argc, char **argv)
g_bghfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_BGFONTID);
if (!g_bghfont)
{
- message(MAIN_NAME_STRING ": Failed to get background font handle: %d\n", errno);
+ message("nxtext_main: Failed to get background font handle: %d\n", errno);
g_exitcode = NXEXIT_FONTOPEN;
goto errout;
}
@@ -389,19 +381,19 @@ int MAIN_NAME(int argc, char **argv)
g_puhfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_PUFONTID);
if (!g_puhfont)
{
- message(MAIN_NAME_STRING ": Failed to get pop-up font handle: %d\n", errno);
+ message("nxtext_main: Failed to get pop-up font handle: %d\n", errno);
g_exitcode = NXEXIT_FONTOPEN;
goto errout;
}
/* Set the background to the configured background color */
- message(MAIN_NAME_STRING ": Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR);
+ message("nxtext_main: Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR);
color = CONFIG_EXAMPLES_NXTEXT_BGCOLOR;
ret = nx_setbgcolor(g_hnx, &color);
if (ret < 0)
{
- message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno);
+ message("nxtext_main: nx_setbgcolor failed: %d\n", errno);
g_exitcode = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx;
}
@@ -412,7 +404,7 @@ int MAIN_NAME(int argc, char **argv)
ret = nx_requestbkgd(g_hnx, &g_nxtextcb, bgstate);
if (ret < 0)
{
- message(MAIN_NAME_STRING ": nx_setbgcolor failed: %d\n", errno);
+ message("nxtext_main: nx_setbgcolor failed: %d\n", errno);
g_exitcode = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx;
}
@@ -425,7 +417,7 @@ int MAIN_NAME(int argc, char **argv)
{
(void)sem_wait(&g_semevent);
}
- message(MAIN_NAME_STRING ": Screen resolution (%d,%d)\n", g_xres, g_yres);
+ message("nxtext_main: Screen resolution (%d,%d)\n", g_xres, g_yres);
/* Now loop, adding text to the background and periodically presenting
* a pop-up window.
@@ -453,11 +445,11 @@ int MAIN_NAME(int argc, char **argv)
/* Give keyboard input to the top window (which should be the pop-up) */
#ifdef CONFIG_NX_KBD
- message(MAIN_NAME_STRING ": Send keyboard input: %s\n", g_pumsg);
+ message("nxtext_main: Send keyboard input: %s\n", g_pumsg);
ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_pumsg), g_pumsg);
if (ret < 0)
{
- message(MAIN_NAME_STRING ": nx_kbdin failed: %d\n", errno);
+ message("nxtext_main: nx_kbdin failed: %d\n", errno);
goto errout_with_hwnd;
}
#endif
@@ -466,7 +458,7 @@ int MAIN_NAME(int argc, char **argv)
{
/* Destroy the pop-up window and restart the sequence */
- message(MAIN_NAME_STRING ": Close pop-up\n");
+ message("nxtext_main: Close pop-up\n");
(void)nxpu_close(hwnd);
popcnt = 0;
}
@@ -488,7 +480,7 @@ int MAIN_NAME(int argc, char **argv)
errout_with_hwnd:
if (popcnt >= 3)
{
- message(MAIN_NAME_STRING ": Close pop-up\n");
+ message("nxtext_main: Close pop-up\n");
(void)nxpu_close(hwnd);
}
@@ -499,12 +491,12 @@ errout_with_nx:
#ifdef CONFIG_NX_MULTIUSER
/* Disconnect from the server */
- message(MAIN_NAME_STRING ": Disconnect from the server\n");
+ message("nxtext_main: Disconnect from the server\n");
nx_disconnect(g_hnx);
#else
/* Close the server */
- message(MAIN_NAME_STRING ": Close NX\n");
+ message("nxtext_main: Close NX\n");
nx_close(g_hnx);
#endif
errout: