apps/graphics/pdcurses: Add dummy files with placeholders for the logic that needs to be implemented to integrated pdcurses with NuttX.

This commit is contained in:
Gregory Nutt 2017-11-17 14:50:10 -06:00
parent 69bea27b20
commit 25e4f6b57b
10 changed files with 1022 additions and 31 deletions

View File

@ -222,12 +222,12 @@ action for the platform.
void PDC_restore_screen_mode(int i);
Called from _restore_mode() in kernel.c, this function does the actual
Called from _restore_mode() in pdc_kernel.c, this function does the actual
mode changing, if applicable. Currently used only in DOS and OS/2.
void PDC_save_screen_mode(int i);
Called from _save_mode() in kernel.c, this function saves the actual
Called from _save_mode() in pdc_kernel.c, this function saves the actual
screen mode, if applicable. Currently used only in DOS and OS/2.
void PDC_scr_close(void);

View File

@ -33,7 +33,8 @@
#
############################################################################
# CSRCS +=
CSRCS += pdcclip.c pdcdisp.c pdcgetsc.c pdckbd.c pdcscrn.c pdcsetsc.c
CRCCS += pdcutil.c
DEPPATH += --dep-path nuttx
VPATH += :nuttx

View File

@ -0,0 +1,137 @@
/****************************************************************************
* apps/graphics/nuttx/pdclip.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_getclipboard
*
* Description:
* PDC_getclipboard() gets the textual contents of the system's clipboard.
* This function returns the contents of the clipboard in the contents
* argument. It is the responsibilitiy of the caller to free the memory
* returned, via PDC_freeclipboard(). The length of the clipboard
* contents is returned in the length argument.
*
* Returned Value:
* PDC_CLIP_SUCCESS The call was successful
* PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
* the clipboard contents
* PDC_CLIP_EMPTY The clipboard contains no text
* PDC_CLIP_ACCESS_ERROR No clipboard support
*
****************************************************************************/
int PDC_getclipboard(char **contents, long *length)
{
PDC_LOG(("PDC_getclipboard() - called\n"));
#warning Missing logic
return PDC_CLIP_ACCESS_ERROR;
}
/****************************************************************************
* Name: PDC_setclipboard
*
* Description:
* PDC_setclipboard copies the supplied text into the system's clipboard,
* emptying the clipboard prior to the copy.
*
* Returned Value:
* PDC_CLIP_SUCCESS The call was successful
* PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
* the clipboard contents
* PDC_CLIP_EMPTY The clipboard contains no text
* PDC_CLIP_ACCESS_ERROR No clipboard support
*
****************************************************************************/
int PDC_setclipboard(const char *contents, long length)
{
PDC_LOG(("PDC_setclipboard() - called\n"));
#warning Missing logic
return PDC_CLIP_ACCESS_ERROR;
}
/****************************************************************************
* Name: PDC_freeclipboard
*
* Description:
* Free memory obtained with PDC_getclipboard().
*
* Returned Value:
* PDC_CLIP_SUCCESS The call was successful
* PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
* the clipboard contents
* PDC_CLIP_EMPTY The clipboard contains no text
* PDC_CLIP_ACCESS_ERROR No clipboard support
*
****************************************************************************/
int PDC_freeclipboard(char *contents)
{
PDC_LOG(("PDC_freeclipboard() - called\n"));
#warning Missing logic
return PDC_CLIP_ACCESS_ERROR;
}
/****************************************************************************
* Name: PDC_clearclipboard
*
* Description:
* PDC_clearclipboard() clears the internal clipboard.
*
* Returned Value:
* PDC_CLIP_SUCCESS The call was successful
* PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
* the clipboard contents
* PDC_CLIP_EMPTY The clipboard contains no text
* PDC_CLIP_ACCESS_ERROR No clipboard support
*
****************************************************************************/
int PDC_clearclipboard(void)
{
PDC_LOG(("PDC_clearclipboard() - called\n"));
#warning Missing logic
return PDC_CLIP_ACCESS_ERROR;
}

View File

@ -0,0 +1,83 @@
/****************************************************************************
* apps/graphics/nuttx/pdcdisp.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <string.h>
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_gotoyx
*
* Description:
* Move the physical cursor (as opposed to the logical cursor affected by
* wmove()) to the given location. This is called mainly from doupdate().
* In general, this function need not compare the old location with the new
* one, and should just move the cursor unconditionally.
*
****************************************************************************/
/* Position hardware cursor at (y, x) */
void PDC_gotoyx(int row, int col)
{
PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_transform_line
*
* Description:
* The core output routine. It takes len chtype entities from srcp (a
* pointer into curscr) and renders them to the physical screen at line
* lineno, column x. It must also translate characters 0-127 via acs_map[],
* if they're flagged with A_ALTCHARSET in the attribute portion of the
* chtype.
*
****************************************************************************/
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
#warning Missing logic
}

View File

@ -0,0 +1,96 @@
/****************************************************************************
* apps/graphics/nuttx/pdcgetsc.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_get_columns
*
* Description:
* Returns the size of the screen in columns. It's used in resize_term()
* to set the new value of COLS. (Some existing implementations also call
* it internally from PDC_scr_open(), but this is not required.)
*
****************************************************************************/
int PDC_get_columns(void)
{
PDC_LOG(("PDC_get_columns() - called\n"));
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_get_cursor_mode
*
* Description:
* Returns the size/shape of the cursor. The format of the result is
* unspecified, except that it must be returned as an int. This function
* is called from initscr(), and the result is stored in SP->orig_cursor,
* which is used by PDC_curs_set() to determine the size/shape of the
* cursor in normal visibility mode (curs_set(1)).
*
****************************************************************************/
int PDC_get_cursor_mode(void)
{
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_get_rows
*
* Description:
* Returns the size of the screen in rows. It's used in resize_term() to
* set the new value of LINES. (Some existing implementations also call it
* internally from PDC_scr_open(), but this is not required.)
*
****************************************************************************/
int PDC_get_rows(void)
{
PDC_LOG(("PDC_get_rows() - called\n"));
#warning Missing logic
return ERR;
}

View File

@ -0,0 +1,171 @@
/****************************************************************************
* apps/graphics/nuttx/pdckbd.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_check_key
*
* Description:
* Keyboard/mouse event check, called from wgetch(). Returns true if
* there's an event ready to process. This function must be non-blocking.
*
****************************************************************************/
bool PDC_check_key(void)
{
#warning Missing logic
return false;
}
/****************************************************************************
* Name: PDC_get_key
*
* Description:
* Get the next available key, or mouse event (indicated by a return of
* KEY_MOUSE), and remove it from the OS' input queue, if applicable. This
* function is called from wgetch(). This function may be blocking, and
* traditionally is; but it need not be. If a valid key or mouse event
* cannot be returned, for any reason, this function returns -1. Valid keys
* are those that fall within the appropriate character set, or are in the
* list of special keys found in curses.h (KEY_MIN through KEY_MAX). When
* returning a special key code, this routine must also set SP->key_code to
* true; otherwise it must set it to false. If SP->return_key_modifiers is
* true, this function may return modifier keys (shift, control, alt),
* pressed alone, as special key codes; if SP->return_key_modifiers is
* false, it must not. If modifier keys are returned, it should only happen
* if no other keys were pressed in the meantime; i.e., the return should
* happen on key up. But if this is not possible, it may return the
* modifier keys on key down (if and only if SP->return_key_modifiers is
* true).
*
****************************************************************************/
int PDC_get_key(void)
{
#warning Missing logic
return 0;
}
/****************************************************************************
* Name: PDC_get_input_fd
*
* Description:
* PDC_get_input_fd() returns the file descriptor that PDCurses reads its
* input from. It can be used for select().
*
****************************************************************************/
unsigned long PDC_get_input_fd(void)
{
PDC_LOG(("PDC_get_input_fd() - called\n"));
#warning Missing logic
return -1;
}
/****************************************************************************
* Name: PDC_set_keyboard_binary
*
* Description:
* Set keyboard input to "binary" mode. If you need to do something to keep
* the OS from processing ^C, etc. on your platform, do it here. true turns
* the mode on; false reverts it. This function is called from raw() and
* noraw().
*
****************************************************************************/
void PDC_set_keyboard_binary(bool on)
{
PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_flushinp
*
* Description:
* This is the core of flushinp(). It discards any pending key or mouse
* events, removing them from any internal queue and from the OS queue, if
* applicable.
*
****************************************************************************/
void PDC_flushinp(void)
{
PDC_LOG(("PDC_flushinp() - called\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_mouse_set
*
* Description:
* Called by mouse_set(), mouse_on(), and mouse_off() -- all the functions
* that modify SP->_trap_mbe. If your platform needs to do anything in
* response to a change in SP->_trap_mbe (for example, turning the mouse
* cursor on or off), do it here. Returns OK or ERR, which is passed on by
* the caller.
*
****************************************************************************/
int PDC_mouse_set(void)
{
#warning Missing logic
return OK;
}
/****************************************************************************
* Name: PDC_modifiers_set
*
* Description:
* Called from PDC_return_key_modifiers(). If your platform needs to do
* anything in response to a change in SP->return_key_modifiers, do it
* here. Returns OK or ERR, which is passed on by the caller.
*
****************************************************************************/
int PDC_modifiers_set(void)
{
#warning Missing logic
return OK;
}

View File

@ -0,0 +1,45 @@
/****************************************************************************
* apps/graphics/nuttx/pdcnuttx.h
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
#ifndef __APPS_GRAPHICS_PDCURS34_NUTTX_PDCNUTTX_H
#define __APPS_GRAPHICS_PDCURS34_NUTTX_PDCNUTTX_H 1
/****************************************************************************
* Included Files
****************************************************************************/
#include "curspriv.h"
#endif /* __APPS_GRAPHICS_PDCURS34_NUTTX_PDCNUTTX_H */

View File

@ -0,0 +1,262 @@
/****************************************************************************
* apps/graphics/nuttx/pdcscrn.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_scr_close
*
* Description:
* The platform-specific part of endwin(). It may restore the image of the
* original screen saved by PDC_scr_open(), if the PDC_RESTORE_SCREEN
* environment variable is set; either way, if using an existing terminal,
* this function should restore it to the mode it had at startup, and move
* the cursor to the lower left corner. (The X11 port does nothing.)
*
****************************************************************************/
void PDC_scr_close(void)
{
PDC_LOG(("PDC_scr_close() - called\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_scr_free
*
* Description:
* Frees the memory for SP allocated by PDC_scr_open(). Called by
* delscreen().
*
****************************************************************************/
void PDC_scr_free(void)
{
#warning Missing logic
}
/****************************************************************************
* Name: PDC_scr_open
*
* Description:
* The platform-specific part of initscr(). It's actually called from
* Xinitscr(); the arguments, if present, correspond to those used with
* main(), and may be used to set the title of the terminal window, or for
* other, platform-specific purposes. (The arguments are currently used
* only in X11.) PDC_scr_open() must allocate memory for SP, and must
* initialize acs_map[] (unless it's preset) and several members of SP,
* including lines, cols, mouse_wait, orig_attr (and if orig_attr is true,
* orig_fore and orig_back), mono, _restore and _preserve. (Although SP is
* used the same way in all ports, it's allocated here in order to allow
* the X11 port to map it to a block of shared memory.) If using an
* existing terminal, and the environment variable PDC_RESTORE_SCREEN is
* set, this function may also store the existing screen image for later
* restoration by PDC_scr_close().
*
****************************************************************************/
int PDC_scr_open(int argc, char **argv)
{
PDC_LOG(("PDC_scr_open() - called\n"));
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_resize_screen
*
* Description:
* This does the main work of resize_term(). It may respond to non-zero
* parameters, by setting the screen to the specified size; to zero
* parameters, by setting the screen to a size chosen by the user at
* runtime, in an unspecified way (e.g., by dragging the edges of the
* window); or both. It may also do nothing, if there's no appropriate
* action for the platform.
*
****************************************************************************/
int PDC_resize_screen(int nlines, int ncols)
{
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
nlines, ncols));
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_reset_prog_mode
*
* Description:
* The non-portable functionality of reset_prog_mode() is handled here --
* whatever's not done in _restore_mode(). In current ports: In OS/2, this
* sets the keyboard to binary mode; in Win32, it enables or disables the
* mouse pointer to match the saved mode; in others it does nothing.
*
****************************************************************************/
void PDC_reset_prog_mode(void)
{
PDC_LOG(("PDC_reset_prog_mode() - called.\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_reset_shell_mode
*
* Description:
* The same thing for reset_shell_mode() as PDC_reset_prog_mode(). In OS/2
* and Win32, it restores the default console mode; in others it does
* nothing.
*
****************************************************************************/
void PDC_reset_shell_mode(void)
{
PDC_LOG(("PDC_reset_shell_mode() - called.\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_restore_screen_mode
*
* Description:
* Called from _restore_mode() in pdc_kernel.c, this function does the
* actual mode changing, if applicable. Currently used only in DOS and OS/2.
*
****************************************************************************/
void PDC_restore_screen_mode(int i)
{
#warning Missing logic
}
/****************************************************************************
* Name: PDC_save_screen_mode
*
* Description:
* Called from _save_mode() in pdc_kernel.c, this function saves the actual
* screen mode, if applicable. Currently used only in DOS and OS/2.
*
****************************************************************************/
void PDC_save_screen_mode(int i)
{
#warning Missing logic
}
/****************************************************************************
* Name: PDC_init_pair
*
* Description:
* The core of init_pair(). This does all the work of that function, except
* checking for values out of range. The values passed to this function
* should be returned by a call to PDC_pair_content() with the same pair
* number. PDC_transform_line() should use the specified colors when
* rendering a chtype with the given pair number.
*
****************************************************************************/
void PDC_init_pair(short pair, short fg, short bg)
{
#warning Missing logic
}
/****************************************************************************
* Name: PDC_pair_content
*
* Description:
* The core of pair_content(). This does all the work of that function,
* except checking for values out of range and null pointers.
*
****************************************************************************/
int PDC_pair_content(short pair, short *fg, short *bg)
{
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_can_change_color
*
* Description:
* Returns true if init_color() and color_content() give meaningful
* results, false otherwise. Called from can_change_color().
*
****************************************************************************/
bool PDC_can_change_color(void)
{
#warning Missing logic
return false;
}
/****************************************************************************
* Name: PDC_color_content
*
* Description:
* The core of color_content(). This does all the work of that function,
* except checking for values out of range and null pointers.
*
****************************************************************************/
int PDC_color_content(short color, short *red, short *green, short *blue)
{
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_init_color
*
* Description:
* The core of init_color(). This does all the work of that function,
* except checking for values out of range.
*
****************************************************************************/
int PDC_init_color(short color, short red, short green, short blue)
{
#warning Missing logic
return ERR;
}

View File

@ -0,0 +1,99 @@
/****************************************************************************
* apps/graphics/nuttx/pdcsetsc.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <string.h>
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_curs_set
*
* Description:
* Called from curs_set(). Changes the appearance of the cursor -- 0 turns
* it off, 1 is normal (the terminal's default, if applicable, as
* determined by SP->orig_cursor), and 2 is high visibility. The exact
* appearance of these modes is not specified.
*
****************************************************************************/
int PDC_curs_set(int visibility)
{
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
#warning Missing logic
return ERR;
}
/****************************************************************************
* Name: PDC_set_title
*
* Description:
* PDC_set_title() sets the title of the window in which the curses
* program is running. This function may not do anything on some
* platforms. (Currently it only works in Win32 and X11.)
*
****************************************************************************/
void PDC_set_title(const char *title)
{
PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_set_blink
*
* Description:
* PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
* blink mode (true), or sets the background color to high intensity
* (false). The default is platform-dependent (false in most cases). It
* returns OK if it could set the state to match the given parameter,
* ERR otherwise. Current platforms also adjust the value of COLORS
* according to this function -- 16 for false, and 8 for true.
*
****************************************************************************/
int PDC_set_blink(bool blinkon)
{
#warning Missing logic
return ERR;
}

View File

@ -0,0 +1,97 @@
/****************************************************************************
* apps/graphics/nuttx/pdcutil.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <poll.h>
#include "pdcnuttx.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: PDC_beep
*
* Description:
* Emits a short audible beep. If this is not possible on your platform,
* you must set SP->audible to false during initialization (i.e., from
* PDC_scr_open() -- not here); otherwise, set it to true. This function is
* called from beep().
*
****************************************************************************/
void PDC_beep(void)
{
PDC_LOG(("PDC_beep() - called\n"));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_napms
*
* Description:
* This is the core delay routine, called by napms(). It pauses for about
* (the X/Open spec says "at least") ms milliseconds, then returns. High
* degrees of accuracy and precision are not expected (though desirable, if
* you can achieve them). More important is that this function gives back
* the process' time slice to the OS, so that PDCurses idles at low CPU
* usage.
*
****************************************************************************/
void PDC_napms(int ms)
{
PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
#warning Missing logic
}
/****************************************************************************
* Name: PDC_sysname
*
* Description:
* Returns a short string describing the platform, such as "DOS" or "X11".
* This is used by longname(). It must be no more than 100 characters; it
* should be much, much shorter (existing platforms use no more than 5).
*
****************************************************************************/
const char *PDC_sysname(void)
{
return "NuttX";
}