mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Added ins_wstr() family.
This commit is contained in:
10
curses.h
10
curses.h
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curses.h,v 1.177 2006/06/18 21:52:02 wmcbrine Exp $ */
|
||||
/* $Id: curses.h,v 1.178 2006/06/18 23:22:42 wmcbrine Exp $ */
|
||||
|
||||
/*----------------------------------------------------------------------*
|
||||
* PDCurses *
|
||||
@@ -1465,19 +1465,27 @@ int addnwstr(const wchar_t *, int);
|
||||
int addwstr(const wchar_t *);
|
||||
int erasewchar(wchar_t *);
|
||||
int innwstr(wchar_t *, int);
|
||||
int ins_nwstr(const wchar_t *, int);
|
||||
int ins_wstr(const wchar_t *);
|
||||
int inwstr(wchar_t *);
|
||||
int killwchar(wchar_t *);
|
||||
int mvaddnwstr(int, int, const wchar_t *, int);
|
||||
int mvaddwstr(int, int, const wchar_t *);
|
||||
int mvinnwstr(int, int, wchar_t *, int);
|
||||
int mvins_nwstr(int, int, const wchar_t *, int);
|
||||
int mvins_wstr(int, int, const wchar_t *);
|
||||
int mvinwstr(int, int, wchar_t *);
|
||||
int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
|
||||
int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
|
||||
int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
|
||||
int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
|
||||
int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
|
||||
int mvwinwstr(WINDOW *, int, int, wchar_t *);
|
||||
int waddnwstr(WINDOW *, const wchar_t *, int);
|
||||
int waddwstr(WINDOW *, const wchar_t *);
|
||||
int winnwstr(WINDOW *, wchar_t *, int);
|
||||
int wins_nwstr(WINDOW *, const wchar_t *, int);
|
||||
int wins_wstr(WINDOW *, const wchar_t *);
|
||||
int winwstr(WINDOW *, wchar_t *);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -477,19 +477,27 @@ FUNCTIONS
|
||||
addwstr addstr
|
||||
erasewchar termattr
|
||||
innwstr instr
|
||||
ins_nwstr insstr
|
||||
ins_wstr insstr
|
||||
inwstr instr
|
||||
killwchar termattr
|
||||
mvaddnwstr addstr
|
||||
mvaddwstr addstr
|
||||
mvinnwstr instr
|
||||
mvins_nwstr insstr
|
||||
mvins_wstr insstr
|
||||
mvinwstr instr
|
||||
mvwaddnwstr addstr
|
||||
mvwaddwstr addstr
|
||||
mvwinnwstr instr
|
||||
mvwins_nwstr insstr
|
||||
mvwins_wstr insstr
|
||||
mvwinwstr instr
|
||||
waddnwstr addstr
|
||||
waddwstr addstr
|
||||
winnwstr instr
|
||||
wins_nwstr insstr
|
||||
wins_wstr insstr
|
||||
winwstr instr
|
||||
|
||||
The following table lists each private curses routine and the
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# undef waddch
|
||||
#endif
|
||||
|
||||
RCSID("$Id: insstr.c,v 1.22 2006/03/29 20:06:41 wmcbrine Exp $");
|
||||
RCSID("$Id: insstr.c,v 1.23 2006/06/18 23:22:43 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -53,6 +53,15 @@ RCSID("$Id: insstr.c,v 1.22 2006/03/29 20:06:41 wmcbrine Exp $");
|
||||
int mvwinsstr(WINDOW *win, int y, int x, const char *str);
|
||||
int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n);
|
||||
|
||||
int ins_wstr(const wchar_t *wstr);
|
||||
int ins_nwstr(const wchar_t *wstr, int n);
|
||||
int wins_wstr(WINDOW *win, const wchar_t *wstr);
|
||||
int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n);
|
||||
int mvins_wstr(int y, int x, const wchar_t *wstr);
|
||||
int mvins_nwstr(int y, int x, const wchar_t *wstr, int n);
|
||||
int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr);
|
||||
int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n);
|
||||
|
||||
System V Curses Description:
|
||||
With these routines, a character string (as many characters as
|
||||
will fit on the line) is inserted before the character under
|
||||
@@ -66,14 +75,6 @@ RCSID("$Id: insstr.c,v 1.22 2006/03/29 20:06:41 wmcbrine Exp $");
|
||||
NOTE: insstr(), insnstr(), mvinsstr(), mvinsnstr(), mvwinsstr()
|
||||
and mvwinsnstr() are implemented as macros.
|
||||
|
||||
PDCurses Description:
|
||||
The *raw*() routines output 8 bit values. These contrast to
|
||||
their normal counterparts which output 7 bit values and convert
|
||||
control character to the ^X notation.
|
||||
|
||||
str is a standard 8 bit character string WITHOUT embedded
|
||||
attributes.
|
||||
|
||||
X/Open Return Value:
|
||||
All functions return OK on success and ERR on error.
|
||||
|
||||
@@ -120,7 +121,7 @@ int winsnstr(WINDOW *win, const char *str, int n)
|
||||
|
||||
PDC_LOG(("winsnstr() - called: string=\"%s\" n %d \n", str, n));
|
||||
|
||||
if (win == (WINDOW *)NULL)
|
||||
if (win == (WINDOW *)NULL || str == (const char *)NULL)
|
||||
return ERR;
|
||||
|
||||
ic = strlen(str);
|
||||
@@ -179,3 +180,91 @@ int mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n)
|
||||
|
||||
return winsnstr(win, str, n);
|
||||
}
|
||||
|
||||
#ifdef UNICODE
|
||||
int ins_wstr(const wchar_t *wstr)
|
||||
{
|
||||
PDC_LOG(("ins_wstr() - called\n"));
|
||||
|
||||
return wins_nwstr(stdscr, wstr, -1);
|
||||
}
|
||||
|
||||
int ins_nwstr(const wchar_t *wstr, int n)
|
||||
{
|
||||
PDC_LOG(("ins_nwstr() - called\n"));
|
||||
|
||||
return wins_nwstr(stdscr, wstr, n);
|
||||
}
|
||||
|
||||
int wins_wstr(WINDOW *win, const wchar_t *wstr)
|
||||
{
|
||||
PDC_LOG(("wins_wstr() - called\n"));
|
||||
|
||||
return wins_nwstr(win, wstr, -1);
|
||||
}
|
||||
|
||||
int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
|
||||
{
|
||||
const wchar_t *p;
|
||||
int ic;
|
||||
|
||||
PDC_LOG(("wins_nwstr() - called\n"));
|
||||
|
||||
if (win == (WINDOW *)NULL || wstr == (const wchar_t *)NULL)
|
||||
return ERR;
|
||||
|
||||
for (ic = 0, p = wstr; *p != L'\0'; p++)
|
||||
ic++;
|
||||
|
||||
if (n > 0)
|
||||
ic = ((ic < n) ? ic : n) - 1;
|
||||
else
|
||||
--ic;
|
||||
|
||||
for (; ic >= 0; ic--)
|
||||
if (winsch(win, wstr[ic]) == ERR)
|
||||
return ERR;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int mvins_wstr(int y, int x, const wchar_t *wstr)
|
||||
{
|
||||
PDC_LOG(("mvins_wstr() - called\n"));
|
||||
|
||||
if (move(y, x) == ERR)
|
||||
return ERR;
|
||||
|
||||
return wins_nwstr(stdscr, wstr, -1);
|
||||
}
|
||||
|
||||
int mvins_nwstr(int y, int x, const wchar_t *wstr, int n)
|
||||
{
|
||||
PDC_LOG(("mvinsnstr() - called\n"));
|
||||
|
||||
if (move(y, x) == ERR)
|
||||
return ERR;
|
||||
|
||||
return wins_nwstr(stdscr, wstr, n);
|
||||
}
|
||||
|
||||
int mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr)
|
||||
{
|
||||
PDC_LOG(("mvwinsstr() - called\n"));
|
||||
|
||||
if (wmove(win, y, x) == ERR)
|
||||
return ERR;
|
||||
|
||||
return wins_nwstr(win, wstr, -1);
|
||||
}
|
||||
|
||||
int mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n)
|
||||
{
|
||||
PDC_LOG(("mvwinsnstr() - called\n"));
|
||||
|
||||
if (wmove(win, y, x) == ERR)
|
||||
return ERR;
|
||||
|
||||
return wins_nwstr(win, wstr, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user