<commit_before>/************************************************************************ 
 * This file is part of PDCurses. PDCurses is public domain software;	*
 * you may use it for any purpose. This software is provided AS IS with	*
 * NO WARRANTY whatsoever.						*
 *									*
 * If you use PDCurses in an application, an acknowledgement would be	*
 * appreciated, but is not mandatory. If you make corrections or	*
 * enhancements to PDCurses, please forward them to the current		*
 * maintainer for the benefit of other users.				*
 *									*
 * No distribution of modified PDCurses code may be made under the name	*
 * "PDCurses", except by the current maintainer. (Although PDCurses is	*
 * public domain, the name is a trademark.)				*
 *									*
 * See the file maintain.er for details of the current maintainer.	*
 ************************************************************************/

#define	CURSES_LIBRARY 1
#include <curses.h>

/* undefine any macros for functions defined in this module */
#undef addstr
#undef addnstr
#undef waddstr
#undef waddnstr
#undef mvaddstr
#undef mvaddnstr
#undef mvwaddstr
#undef mvwaddnstr

/* undefine any macros for functions called by this module if in debug mode */
#ifdef PDCDEBUG
# undef move
# undef wmove
# undef addch
# undef waddch
#endif

RCSID("$Id: addstr.c,v 1.25 2006/07/15 15:38:24 wmcbrine Exp $");

/*man-start**************************************************************

  Name:                                                        addstr

  Synopsis:
	int addstr(const char *str);
	int addnstr(const char *str, int n);
	int waddstr(WINDOW *win, const char *str);
	int waddnstr(WINDOW *win, const char *str, int n);
	int mvaddstr(int y, int x, const char *str);
	int mvaddnstr(int y, int x, const char *str, int n);
	int mvwaddstr(WINDOW *, int y, int x, const char *str);
	int mvwaddnstr(WINDOW *, int y, int x, const char *str, int n);

	int addwstr(const wchar_t *wstr);
	int addnwstr(const wchar_t *wstr, int n);
	int waddwstr(WINDOW *win, const wchar_t *wstr);
	int waddnwstr(WINDOW *win, const wchar_t *wstr, int n);
	int mvaddwstr(int y, int x, const wchar_t *wstr);
	int mvaddnwstr(int y, int x, const wchar_t *wstr, int n);
	int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr);
	int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n);

  X/Open Description:
	These routines write all the characters of the null-terminated 
	string str on the given window.  The functionality is equivalent 
	to calling waddch() once for each character in the string.  The 
	four routines with n as the last argument write at most n 
	characters.  If n is negative, then the entire string will be 
	added.

	NOTE: addstr(), addnstr(), mvaddstr(), mvaddnstr(), mvwaddstr(), 
	and mvwaddnstr() are implemented as macros.

  X/Open Return Value:
	All functions return OK on success and ERR on error.

  Portability				     X/Open    BSD    SYS V
					     Dec '88
	addstr					Y	Y	Y
	waddstr					Y	Y	Y
	mvaddstr				Y	Y	Y
	mvwaddstr				Y	Y	Y
	addnstr					-	-      4.0
	waddnstr				-	-      4.0
	mvaddnstr				-	-      4.0
	mvwaddnstr				-	-      4.0

**man-end****************************************************************/

int addstr(const char *str)
{
	PDC_LOG(("addstr() - called: string=\"%s\"\n", str));

	return waddnstr(stdscr, str, -1);
}

int addnstr(const char *str, int n)
{
	PDC_LOG(("addnstr() - called: string=\"%s\" n %d \n", str, n));

	return waddnstr(stdscr, str, n);
}

int waddstr(WINDOW *win, const char *str)
{
	PDC_LOG(("waddstr() - called: string=\"%s\"\n", str));

	return waddnstr(win, str, -1);
}

int waddnstr(WINDOW *win, const char *str, int n)
{
	int i, ic;

	PDC_LOG(("waddnstr() - called: string=\"%s\" n %d \n", str, n));

	if (win == (WINDOW *)NULL || str == (const char *)NULL)
		return ERR;

	for (ic = 0; *str && (ic < n || n < 0); ic++)
	{
		/* make negative chars positive - PJK */
		if ((i = *str++) < 0)
			i += 256;

		if (waddch(win, (chtype)i) == ERR)
			return ERR;
	}

	return OK;
}<commit_msg>Less silly.<commit_after>/************************************************************************ 
 * This file is part of PDCurses. PDCurses is public domain software;	*
 * you may use it for any purpose. This software is provided AS IS with	*
 * NO WARRANTY whatsoever.						*
 *									*
 * If you use PDCurses in an application, an acknowledgement would be	*
 * appreciated, but is not mandatory. If you make corrections or	*
 * enhancements to PDCurses, please forward them to the current		*
 * maintainer for the benefit of other users.				*
 *									*
 * No distribution of modified PDCurses code may be made under the name	*
 * "PDCurses", except by the current maintainer. (Although PDCurses is	*
 * public domain, the name is a trademark.)				*
 *									*
 * See the file maintain.er for details of the current maintainer.	*
 ************************************************************************/

#define	CURSES_LIBRARY 1
#include <curses.h>

/* undefine any macros for functions defined in this module */
#undef addstr
#undef addnstr
#undef waddstr
#undef waddnstr
#undef mvaddstr
#undef mvaddnstr
#undef mvwaddstr
#undef mvwaddnstr

/* undefine any macros for functions called by this module if in debug mode */
#ifdef PDCDEBUG
# undef move
# undef wmove
# undef addch
# undef waddch
#endif

RCSID("$Id: addstr.c,v 1.26 2006/07/28 23:58:24 wmcbrine Exp $");

/*man-start**************************************************************

  Name:                                                        addstr

  Synopsis:
	int addstr(const char *str);
	int addnstr(const char *str, int n);
	int waddstr(WINDOW *win, const char *str);
	int waddnstr(WINDOW *win, const char *str, int n);
	int mvaddstr(int y, int x, const char *str);
	int mvaddnstr(int y, int x, const char *str, int n);
	int mvwaddstr(WINDOW *, int y, int x, const char *str);
	int mvwaddnstr(WINDOW *, int y, int x, const char *str, int n);

	int addwstr(const wchar_t *wstr);
	int addnwstr(const wchar_t *wstr, int n);
	int waddwstr(WINDOW *win, const wchar_t *wstr);
	int waddnwstr(WINDOW *win, const wchar_t *wstr, int n);
	int mvaddwstr(int y, int x, const wchar_t *wstr);
	int mvaddnwstr(int y, int x, const wchar_t *wstr, int n);
	int mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *wstr);
	int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n);

  X/Open Description:
	These routines write all the characters of the null-terminated 
	string str on the given window.  The functionality is equivalent 
	to calling waddch() once for each character in the string.  The 
	four routines with n as the last argument write at most n 
	characters.  If n is negative, then the entire string will be 
	added.

	NOTE: addstr(), addnstr(), mvaddstr(), mvaddnstr(), mvwaddstr(), 
	and mvwaddnstr() are implemented as macros.

  X/Open Return Value:
	All functions return OK on success and ERR on error.

  Portability				     X/Open    BSD    SYS V
					     Dec '88
	addstr					Y	Y	Y
	waddstr					Y	Y	Y
	mvaddstr				Y	Y	Y
	mvwaddstr				Y	Y	Y
	addnstr					-	-      4.0
	waddnstr				-	-      4.0
	mvaddnstr				-	-      4.0
	mvwaddnstr				-	-      4.0

**man-end****************************************************************/

int addstr(const char *str)
{
	PDC_LOG(("addstr() - called: string=\"%s\"\n", str));

	return waddnstr(stdscr, str, -1);
}

int addnstr(const char *str, int n)
{
	PDC_LOG(("addnstr() - called: string=\"%s\" n %d \n", str, n));

	return waddnstr(stdscr, str, n);
}

int waddstr(WINDOW *win, const char *str)
{
	PDC_LOG(("waddstr() - called: string=\"%s\"\n", str));

	return waddnstr(win, str, -1);
}

int waddnstr(WINDOW *win, const char *str, int n)
{
	int ic;

	PDC_LOG(("waddnstr() - called: string=\"%s\" n %d \n", str, n));

	if (win == (WINDOW *)NULL || str == (const char *)NULL)
		return ERR;

	for (ic = 0; *str && (ic < n || n < 0); ic++)
	{
		if (waddch(win, (unsigned char)(*str++)) == ERR)
			return ERR;
	}

	return OK;
}
{'fraction_non_alphanumeric': 0.17588191143357518, 'fraction_numerical': 0.00850637978483863, 'mean_word_length': 3.338035811177428, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5170845', 'n_tokens_mistral': 3066, 'n_tokens_neox': 2787, 'n_words': 1008}