Formatting, cruft, dead code. Also, I changed the default name from

"main" to "PDCurses". I can't quite decide between that and "XCurses",
but either is better than "main".
This commit is contained in:
William McBrine
2006-01-11 06:46:25 +00:00
parent d5860c11a4
commit ba9d6a46be
14 changed files with 4319 additions and 4082 deletions

View File

@@ -19,39 +19,38 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.4 2006/01/03 07:34:43 wmcbrine Exp $";
char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.5 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
PDC_getclipboard() - Gets the contents of the clipboard
PDCurses Description:
This is a PDCurses only routine.
This is a PDCurses only routine.
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 with the PDC_freeclipboard() call. The length of the
clipboard contents is returned in the length argument.
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 with the PDC_freeclipboard() call. The length
of the clipboard contents is returned in the length argument.
PDCurses Return Value:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
PDC_CLIP_ACCESS_ERROR an error occured while accessing the
clipboard
PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
PDC_CLIP_ACCESS_ERROR an error occured while accessing the
clipboard
PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
the clipboard contents
PDC_CLIP_EMPTY the clipboard contains no text
Portability:
PDCurses int PDC_getclipboard( char **contents, long *length );
PDCurses int PDC_getclipboard(char **contents, long *length);
**man-end**********************************************************************/
@@ -59,28 +58,27 @@ int PDC_CDECL PDC_getclipboard(char **contents, long *length)
{
PDC_LOG(("PDC_getclipboard() - called\n"));
return XCurses_getclipboard( contents, length );
return XCurses_getclipboard(contents, length);
}
/*man-start*********************************************************************
PDC_setclipboard() - Sets the contents of the clipboard
PDCurses Description:
This is a PDCurses only routine.
This is a PDCurses only routine.
Copies the supplied text into the system's clipboard, emptying
the clipboard prior to the copy.
Copies the supplied text into the system's clipboard, emptying
the clipboard prior to the copy.
PDCurses Return Value:
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
PDC_CLIP_ACCESS_ERROR an error occured while accessing the
clipboard
indicator of success/failure of call.
PDC_CLIP_SUCCESS the call was successful
PDC_CLIP_ACCESS_ERROR an error occured while accessing the
clipboard
Portability:
PDCurses int PDC_getclipboard( char *contents, long length );
PDCurses int PDC_getclipboard(char *contents, long length);
**man-end**********************************************************************/
@@ -88,23 +86,24 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length)
{
PDC_LOG(("PDC_setclipboard() - called\n"));
return XCurses_setclipboard( contents, length );
return XCurses_setclipboard(contents, length);
}
/*man-start*********************************************************************
PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard
PDC_freeclipboard() - Frees the memory associated with the contents
of the clipboard
PDCurses Description:
This is a PDCurses only routine.
This is a PDCurses only routine.
Frees the memory allocated by PDC_getclipboard().
Frees the memory allocated by PDC_getclipboard().
PDCurses Return Value:
Always returns PDC_CLIP_SUCCESS
Always returns PDC_CLIP_SUCCESS
Portability:
PDCurses int PDC_freeclipboard( char *contents );
PDCurses int PDC_freeclipboard(char *contents);
**man-end**********************************************************************/
@@ -121,19 +120,19 @@ int PDC_CDECL PDC_freeclipboard(char *contents)
PDC_clearclipboard() - Clears the contents of the clipboard
PDCurses Description:
This is a PDCurses only routine.
This is a PDCurses only routine.
Clears the internal clipboard.
Clears the internal clipboard.
PDCurses Return Value:
Always returns PDC_CLIP_SUCCESS
Always returns PDC_CLIP_SUCCESS
Portability:
PDCurses int PDC_clearclipboard( void );
PDCurses int PDC_clearclipboard(void);
**man-end**********************************************************************/
int PDC_CDECL PDC_clearclipboard( void )
int PDC_CDECL PDC_clearclipboard(void)
{
return XCurses_clearclipboard( );
return XCurses_clearclipboard();
}

View File

@@ -19,18 +19,18 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#include <string.h>
#ifdef HAVE_MEMORY_H
# include <memory.h>
# include <memory.h>
#endif
#ifdef PDCDEBUG
char *rcsid_PDCdisp = "$Id: pdcdisp.c,v 1.5 2006/01/03 19:54:29 wmcbrine Exp $";
char *rcsid_PDCdisp = "$Id: pdcdisp.c,v 1.6 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
@@ -38,59 +38,57 @@ char *rcsid_PDCdisp = "$Id: pdcdisp.c,v 1.5 2006/01/03 19:54:29 wmcbrine Exp $"
PDC_clr_update() - Updates the screen with a full redraw.
PDCurses Description:
Updates the screen by clearing it and then redraw it in its
entirety. If SP->refrbrk is TRUE, and there is pending
input characters, the update will be prematurely terminated.
Updates the screen by clearing it and then redraw it in its
entirety. If SP->refrbrk is TRUE, and there is pending
input characters, the update will be prematurely terminated.
PDCurses Return Value:
This routine returns ERR if it is unable to accomplish its task.
This routine returns ERR if it is unable to accomplish its task.
The return value OK is returned if there were no errors.
The return value OK is returned if there were no errors.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_clr_update( WINDOW* s );
PDCurses int PDC_clr_update(WINDOW *s);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_clr_update(WINDOW *s)
int PDC_clr_update(WINDOW *s)
#else
int PDC_clr_update(s)
int PDC_clr_update(s)
WINDOW *s;
#endif
/***********************************************************************/
{
register int i=0;
WINDOW* w=NULL;
bool rc=FALSE;
int i;
PDC_LOG(("PDC_clr_update() - called\n"));
w = curscr;
if (w == (WINDOW *)NULL)
return( ERR );
if (curscr == (WINDOW *)NULL)
return ERR;
s->_clear = FALSE;
for (i = 0; i < LINES; i++) /* update physical screen */
{
if (s != w) /* copy s to curscr */
memcpy(w->_y[i], s->_y[i], COLS * sizeof(chtype));
XCurses_transform_line(w->_y[i],i,0,COLS);
if (s != curscr) /* copy s to curscr */
memcpy(curscr->_y[i], s->_y[i], COLS * sizeof(chtype));
if (SP->refrbrk && (SP->cbreak || SP->raw_inp))
{
rc = PDC_breakout();
if(rc)
break;
}
w->_firstch[i] = _NO_CHANGE;
w->_lastch[i] = _NO_CHANGE;
XCurses_transform_line(curscr->_y[i], i, 0, COLS);
if (SP->refrbrk && (SP->cbreak || SP->raw_inp)
&& PDC_breakout())
break;
curscr->_firstch[i] = _NO_CHANGE;
curscr->_lastch[i] = _NO_CHANGE;
}
return( OK );
return OK;
}
/*man-start*********************************************************************
@@ -98,27 +96,27 @@ WINDOW *s;
PDC_cursor_on() - Turns on the hardware cursor.
PDCurses Description:
Turns on the hardware curses, it does nothing if it is already on.
Turns on the hardware curses, it does nothing if it is already on.
PDCurses Return Value:
Returns OK upon success, ERR upon failure.
Returns OK upon success, ERR upon failure.
Portability:
PDCurses int PDC_cursor_on( void );
PDCurses int PDC_cursor_on(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_cursor_on(void)
int PDC_cursor_on(void)
#else
int PDC_cursor_on()
int PDC_cursor_on()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_cursor_on() - called\n"));
return( OK );
return OK;
}
/*man-start*********************************************************************
@@ -126,31 +124,30 @@ int PDC_cursor_on()
PDC_cursor_off() - Turns off the hardware cursor.
PDCurses Description:
Turns off the hardware curses, it does nothing if it is already off.
Turns off the hardware curses, it does nothing if it is already off.
PDCurses Return Value:
Returns OK upon success, ERR upon failure.
Returns OK upon success, ERR upon failure.
PDCurses Errors:
ERR will be returned if the hardware cursor
can not be disabled.
ERR will be returned if the hardware cursor can not be disabled.
Portability:
PDCurses int PDC_cursor_off( void );
PDCurses int PDC_cursor_off(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_cursor_off(void)
int PDC_cursor_off(void)
#else
int PDC_cursor_off()
int PDC_cursor_off()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_cursor_off() - called\n"));
return( OK );
return OK;
}
/*man-start*********************************************************************
@@ -158,37 +155,39 @@ int PDC_cursor_off()
PDC_gotoxy() - position hardware cursor at (x, y)
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Moves the physical cursor to the desired address on the
screen. We don't optimize here -- on a PC, it takes more time
to optimize than to do things directly.
Moves the physical cursor to the desired address on the
screen. We don't optimize here -- on a PC, it takes more time
to optimize than to do things directly.
PDCurses Return Value:
This function returns OK on success and ERR on error.
This function returns OK on success and ERR on error.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_gotoxy( int row, int col );
PDCurses int PDC_gotoxy(int row, int col);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_gotoxy(int row, int col)
int PDC_gotoxy(int row, int col)
#else
int PDC_gotoxy(row,col)
int PDC_gotoxy(row, col)
int row;
int col;
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_gotoxy() - called: row %d col %d\n",row,col));
PDC_LOG(("PDC_gotoxy() - called: row %d col %d\n", row, col));
XCurses_display_cursor(SP->cursrow,SP->curscol,row,col,SP->visibility);
return(OK);
XCurses_display_cursor(SP->cursrow, SP->curscol, row, col,
SP->visibility);
return OK;
}
/*man-start*********************************************************************
@@ -196,59 +195,53 @@ int col;
PDC_transform_line() - display a physical line of the screen
PDCurses Description:
This is a private PDCurses function.
This is a private PDCurses function.
Updates the given physical line to look like the corresponding
line in _curscr.
Updates the given physical line to look like the corresponding
line in _curscr.
PDCurses Return Value:
This routine returns TRUE if a premature refresh end
is allowed, and there is an input character pending. Otherwise,
FALSE is returned.
This routine returns TRUE if a premature refresh end is allowed,
and there is an input character pending. Otherwise, FALSE is
returned.
PDCurses Errors:
No errors are defined for this routine.
No errors are defined for this routine.
Portability:
PDCurses bool PDC_transform_line( int lineno );
PDCurses bool PDC_transform_line(int lineno);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
bool PDC_transform_line(register int lineno)
bool PDC_transform_line(int lineno)
#else
bool PDC_transform_line(lineno)
register int lineno;
bool PDC_transform_line(lineno)
int lineno;
#endif
/***********************************************************************/
{
register chtype* dstp=NULL;
int x=0;
int endx=0;
int len=0;
bool rc=FALSE;
chtype *dstp;
int x, endx, len;
PDC_LOG(("PDC_transform_line() - called: line %d\n",lineno));
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
if (curscr == (WINDOW *)NULL)
return( FALSE );
return FALSE;
x = curscr->_firstch[lineno];
endx = curscr->_lastch[lineno];
dstp = curscr->_y[lineno] + x;
len = endx-x+1;
len = endx - x + 1;
XCurses_transform_line(dstp,lineno,x,len);
XCurses_transform_line(dstp, lineno, x, len);
curscr->_firstch[lineno] = _NO_CHANGE;
curscr->_lastch[lineno] = _NO_CHANGE;
if (SP->refrbrk && (SP->cbreak || SP->raw_inp))
{
rc = PDC_breakout();
if(rc)
return(TRUE);
}
return(FALSE);
if (SP->refrbrk && (SP->cbreak || SP->raw_inp) && PDC_breakout())
return TRUE;
return FALSE;
}

View File

@@ -19,12 +19,12 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCgetsc = "$Id: pdcgetsc.c,v 1.2 2006/01/03 07:34:43 wmcbrine Exp $";
char *rcsid_PDCgetsc = "$Id: pdcgetsc.c,v 1.3 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
@@ -32,33 +32,33 @@ char *rcsid_PDCgetsc = "$Id: pdcgetsc.c,v 1.2 2006/01/03 07:34:43 wmcbrine Exp
PDC_get_columns() - return width of screen/viewport.
PDCurses Description:
This is a private PDCurses function
This is a private PDCurses function
This function will return the width of the current screen.
This function will return the width of the current screen.
PDCurses Return Value:
This routine will return OK upon success and otherwise ERR will be
returned.
This routine will return OK upon success and otherwise ERR will
be returned.
PDCurses Errors:
There are no defined errors for this routine.
There are no defined errors for this routine.
Portability:
PDCurses int PDC_get_columns( void );
PDCurses int PDC_get_columns(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_get_columns(void)
int PDC_get_columns(void)
#else
int PDC_get_columns()
int PDC_get_columns()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_get_columns() - called\n"));
return(XCurses_get_cols());
return XCurses_get_cols();
}
/*man-start*********************************************************************
@@ -66,33 +66,33 @@ int PDC_get_columns()
PDC_get_rows() - Return number of screen rows.
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Returns the maximum number of rows supported by the display.
e.g. 25, 28, 43, 50, 60, 66...
Returns the maximum number of rows supported by the display.
e.g. 25, 28, 43, 50, 60, 66...
PDCurses Return Value:
This function returns OK on success and ERR on error.
This function returns OK on success and ERR on error.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_get_rows( void );
PDCurses int PDC_get_rows(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_get_rows(void)
int PDC_get_rows(void)
#else
int PDC_get_rows()
int PDC_get_rows()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_get_rows() - called\n"));
return(XCurses_get_rows());
return XCurses_get_rows();
}
/*man-start*********************************************************************
@@ -100,31 +100,31 @@ int PDC_get_rows()
PDC_get_font() - Get the current font size
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
This function returns the current font size. This function only
works if the #define FAST_VIDEO is true.
This function returns the current font size. This function only
works if the #define FAST_VIDEO is true.
PDCurses Return Value:
This function returns OK on success and ERR on error.
This function returns OK on success and ERR on error.
PDCurses Errors:
An ERR will be returned if FAST_VIDEO is not true.
An ERR will be returned if FAST_VIDEO is not true.
Portability:
PDCurses int PDC_get_font( void );
PDCurses int PDC_get_font(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_get_font(void)
int PDC_get_font(void)
#else
int PDC_get_font()
int PDC_get_font()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_get_font() - called\n"));
return(OK);
return OK;
}

View File

@@ -20,12 +20,12 @@
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.9 2006/01/03 19:54:29 wmcbrine Exp $";
char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.10 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
@@ -33,19 +33,19 @@ char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.9 2006/01/03 19:54:29 wmcbrine Exp $";
PDC_get_input_fd() - Get file descriptor used for PDCurses input
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
This routine will return the file descriptor that PDCurses reads
its input from. It can be used for select().
This routine will return the file descriptor that PDCurses reads
its input from. It can be used for select().
PDCurses Return Value:
Returns a file descriptor.
Returns a file descriptor.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_get_input_fd( void );
PDCurses int PDC_get_input_fd(void);
**man-end**********************************************************************/
@@ -67,19 +67,19 @@ unsigned long PDC_get_input_fd()
PDC_check_bios_key() - Check BIOS key data area for input
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
This routine will check the BIOS for any indication that
keystrokes are pending.
This routine will check the BIOS for any indication that
keystrokes are pending.
PDCurses Return Value:
Returns 1 if a keyboard character is available, 0 otherwise.
Returns 1 if a keyboard character is available, 0 otherwise.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses bool PDC_check_bios_key( void );
PDCurses bool PDC_check_bios_key(void);
**man-end**********************************************************************/
@@ -93,7 +93,7 @@ bool PDC_check_bios_key()
{
PDC_LOG(("PDC_check_bios_key() - called\n"));
return(XCurses_kbhit());
return XCurses_kbhit();
}
/*man-start*********************************************************************
@@ -101,89 +101,82 @@ bool PDC_check_bios_key()
PDC_get_ctrl_break() - return OS control break state
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Returns the current OS Control Break Check state.
Returns the current OS Control Break Check state.
PDCurses Return Value:
This function returns TRUE if the Control Break
Check is enabled otherwise FALSE is returned.
This function returns TRUE if the Control Break
Check is enabled otherwise FALSE is returned.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses bool PDC_get_ctrl_break( void );
PDCurses bool PDC_get_ctrl_break(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
bool PDC_get_ctrl_break(void)
bool PDC_get_ctrl_break(void)
#else
bool PDC_get_ctrl_break()
bool PDC_get_ctrl_break()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_get_ctrl_break() - called\n"));
return(FALSE);
return FALSE;
}
/*man-start*********************************************************************
PDC_rawgetch() - Returns the next uninterpreted character (if available).
PDC_rawgetch() - Returns the next uninterpreted character
(if available).
PDCurses Description:
Gets a character without any interpretation at all and returns
it. If keypad mode is active for the designated window,
function key translation will be performed. Otherwise,
function keys are ignored. If nodelay mode is active in the
window, then PDC_rawgetch() returns -1 if no character is
available.
Gets a character without any interpretation at all and returns
it. If keypad mode is active for the designated window,
function key translation will be performed. Otherwise,
function keys are ignored. If nodelay mode is active in the
window, then PDC_rawgetch() returns -1 if no character is
available.
WARNING: It is unknown whether the FUNCTION key translation
is performed at this level. --Frotz 911130 BUG
WARNING: It is unknown whether the FUNCTION key translation
is performed at this level. --Frotz 911130 BUG
PDCurses Return Value:
This function returns OK on success and ERR on error.
This function returns OK on success and ERR on error.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_rawgetch( void );
PDCurses int PDC_rawgetch(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_rawgetch(void)
int PDC_rawgetch(void)
#else
int PDC_rawgetch()
int PDC_rawgetch()
#endif
/***********************************************************************/
{
extern WINDOW* _getch_win_;
extern WINDOW *_getch_win_;
int c;
bool return_immediately;
PDC_LOG(("PDC_rawgetch() - called\n"));
PDC_LOG(("PDC_rawgetch() - called\n"));
if (_getch_win_ == (WINDOW *)NULL)
return -1;
if (_getch_win_ == (WINDOW *)NULL) /* @@ */
return( -1 );
if ((SP->delaytenths || _getch_win_->_delayms || _getch_win_->_nodelay)
&& !PDC_breakout())
return -1;
if (SP->delaytenths || _getch_win_->_delayms || _getch_win_->_nodelay)
return_immediately = TRUE;
else
return_immediately = FALSE;
if (return_immediately && !PDC_breakout())
return( -1 );
c = XCurses_rawgetch( 0 );
return(c);
return XCurses_rawgetch(0);
}
/*man-start*********************************************************************
@@ -191,70 +184,70 @@ int PDC_rawgetch()
PDC_set_ctrl_break() - Enables/Disables the host OS BREAK key check.
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Enables/Disables the host OS BREAK key check. If the supplied setting
is TRUE, this enables CTRL/C and CTRL/BREAK to abort the process.
If FALSE, CTRL/C and CTRL/BREAK are ignored.
Enables/Disables the host OS BREAK key check. If the supplied
setting is TRUE, this enables CTRL/C and CTRL/BREAK to abort the
process. If FALSE, CTRL/C and CTRL/BREAK are ignored.
PDCurses Return Value:
This function returns OK on success and ERR on error.
This function returns OK on success and ERR on error.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_set_ctrl_break( bool setting );
PDCurses int PDC_set_ctrl_break(bool setting);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_set_ctrl_break(bool setting)
int PDC_set_ctrl_break(bool setting)
#else
int PDC_set_ctrl_break(setting)
int PDC_set_ctrl_break(setting)
bool setting;
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_set_ctrl_break() - called\n"));
return(OK);
return OK;
}
/*man-start*********************************************************************
PDC_get_key_modifiers() - Returns the keyboard modifier(s) at time of last getch()
PDC_get_key_modifiers() - Returns the keyboard modifier(s)
at time of last getch()
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Returns the keyboard modifiers effective at the time of the last getch()
call only if PDC_save_key_modifiers(TRUE) has been called before the
getch();
Use the macros; PDC_KEY_MODIFIER_* to determine which modifier(s)
were set.
Returns the keyboard modifiers effective at the time of the last
getch() call only if PDC_save_key_modifiers(TRUE) has been
called before the getch(). Use the macros; PDC_KEY_MODIFIER_* to
determine which modifier(s) were set.
PDCurses Return Value:
This function returns the modifiers.
This function returns the modifiers.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_get_key_modifiers( void );
PDCurses int PDC_get_key_modifiers(void);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
unsigned long PDC_get_key_modifiers(void)
unsigned long PDC_get_key_modifiers(void)
#else
unsigned long PDC_get_key_modifiers()
unsigned long PDC_get_key_modifiers()
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_get_key_modifiers() - called\n"));
return(XCurses_get_key_modifiers());
return XCurses_get_key_modifiers();
}

View File

@@ -19,12 +19,12 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCprint = "$Id: pdcprint.c,v 1.2 2006/01/03 07:34:43 wmcbrine Exp $";
char *rcsid_PDCprint = "$Id: pdcprint.c,v 1.3 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
@@ -33,30 +33,30 @@ char *rcsid_PDCprint = "$Id: pdcprint.c,v 1.2 2006/01/03 07:34:43 wmcbrine Exp
PDC_print() - Provides primitive access to the BIOS printer functions
PDCurses Description:
This is a private PDCurses routine.
This is a private PDCurses routine.
Implements write/init/read printer services at the BIOS level.
Implements write/init/read printer services at the BIOS level.
This provides the basic support that PDCurses needs to dump the
contents of windows or pads to the printer attached to the BIOS
printer port.
This provides the basic support that PDCurses needs to dump the
contents of windows or pads to the printer attached to the BIOS
printer port.
PDCurses Return Value:
See the BIOS INT 0x17 specifications.
See the BIOS INT 0x17 specifications.
PDCurses Errors:
See the BIOS INT 0x17 specifications.
See the BIOS INT 0x17 specifications.
Portability:
PDCurses int PDC_print( int cmd, int byte, int port );
PDCurses int PDC_print(int cmd, int byte, int port);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_print(int cmd, int byte, int port)
int PDC_print(int cmd, int byte, int port)
#else
int PDC_print(cmd,byte,port)
int PDC_print(cmd, byte, port)
int cmd;
int byte;
int port;
@@ -65,6 +65,5 @@ int port;
{
PDC_LOG(("PDC_print() - called\n"));
/* to be done */
return(OK);
return OK;
}

View File

@@ -19,40 +19,41 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.6 2006/01/03 19:54:29 wmcbrine Exp $";
char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.7 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
bool GLOBAL_sb_on=FALSE;
bool GLOBAL_slk_on=FALSE;
bool GLOBAL_sb_on = FALSE;
bool GLOBAL_slk_on = FALSE;
/*man-start*********************************************************************
PDC_scr_close() - Internal low-level binding to close the physical screen
PDC_scr_close() - Internal low-level binding to close the
physical screen
PDCurses Description:
This is a nop for the DOS platform.
This is a nop for the DOS platform.
PDCurses Return Value:
This function returns OK on success, otherwise an ERR is returned.
This function returns OK on success, otherwise an ERR is returned.
PDCurses Errors:
The DOS platform will never fail.
The DOS platform will never fail.
Portability:
PDCurses int PDC_scr_close( void );
PDCurses int PDC_scr_close(void);
**man-end**********************************************************************/
int PDC_scr_close(void)
int PDC_scr_close(void)
{
PDC_LOG(("PDC_scr_close() - called\n"));
return( OK );
return OK;
}
/*man-start*********************************************************************
@@ -60,27 +61,28 @@ int PDC_scr_close(void)
PDC_scrn_modes_equal() - Decide if two screen modes are equal
PDCurses Description:
Mainly required for OS/2. It decides if two screen modes
(VIOMODEINFO structure) are equal. Under DOS it just compares
two integers
Mainly required for OS/2. It decides if two screen modes
(VIOMODEINFO structure) are equal. Under DOS it just compares
two integers
PDCurses Return Value:
This function returns TRUE if equal else FALSe.
This function returns TRUE if equal else FALSe.
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses int PDC_scrn_modes_equal( int mode1, int mode2 );
OS2 PDCurses int PDC_scrn_modes_equal( VIOMODEINFO mode1, VIOMODEINFO mode2 );
PDCurses int PDC_scrn_modes_equal(int mode1, int mode2);
OS2 PDCurses int PDC_scrn_modes_equal(VIOMODEINFO mode1,
VIOMODEINFO mode2);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
bool PDC_scrn_modes_equal(int mode1, int mode2)
bool PDC_scrn_modes_equal(int mode1, int mode2)
#else
bool PDC_scrn_modes_equal(mode1,mode2)
bool PDC_scrn_modes_equal(mode1, mode2)
int mode1;
int mode2;
#endif
@@ -93,27 +95,28 @@ int mode2;
/*man-start*********************************************************************
PDC_scr_open() - Internal low-level binding to open the physical screen
PDC_scr_open() - Internal low-level binding to open the physical
screen
PDCurses Description:
This is a NOP in DOS.
PDCurses Return Value:
This function returns OK on success, otherwise an ERR is returned.
This function returns OK on success, otherwise an ERR is returned.
PDCurses Errors:
The DOS platform will never fail.
The DOS platform will never fail.
Portability:
PDCurses int PDC_scr_open( SCREEN* internal, bool echo );
PDCurses int PDC_scr_open(SCREEN *internal, bool echo);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_scr_open(SCREEN *internal, bool echo)
int PDC_scr_open(SCREEN *internal, bool echo)
#else
int PDC_scr_open(internal,echo)
int PDC_scr_open(internal, echo)
SCREEN *internal;
bool echo;
#endif
@@ -124,7 +127,7 @@ bool echo;
PDC_LOG(("PDC_scr_open() - called\n"));
internal->cursrow = internal->curscol = 0;
internal->direct_video = FALSE; /* Assume that we can't */
internal->direct_video = FALSE; /* Assume that we can't */
internal->autocr = TRUE; /* lf -> crlf by default */
internal->raw_out = FALSE; /* tty I/O modes */
internal->raw_inp = FALSE; /* tty I/O modes */
@@ -159,7 +162,7 @@ bool echo;
internal->sb_cur_x = 0;
internal->line_color = COLOR_WHITE;
return( OK );
return OK;
}
/*man-start*********************************************************************
@@ -167,35 +170,33 @@ bool echo;
PDC_resize_screen() - Internal low-level function to resize screen
PDCurses Description:
This function provides a means for the application program to
resize the overall dimensions of the screen. Under DOS and OS/2
the application can tell PDCurses what size to make the screen;
under X11, resizing is done by the user and this function simply
adjusts its internal structures to fit the new size.
This function provides a means for the application program to
resize the overall dimensions of the screen. Under DOS and OS/2
the application can tell PDCurses what size to make the screen;
under X11, resizing is done by the user and this function simply
adjusts its internal structures to fit the new size.
PDCurses Return Value:
This function returns OK on success, otherwise an ERR is returned.
This function returns OK on success, otherwise an ERR is returned.
PDCurses Errors:
Portability:
PDCurses int PDC_resize_screen( int, int );
PDCurses int PDC_resize_screen(int, int);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_resize_screen(int nlines, int ncols)
int PDC_resize_screen(int nlines, int ncols)
#else
int PDC_resize_screen(nlines, ncols)
int nlines,ncols;
int PDC_resize_screen(nlines, ncols)
int nlines, ncols;
#endif
/***********************************************************************/
{
int rc=OK;
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
nlines, ncols));
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",nlines,ncols));
rc = XCursesResizeScreen(nlines,ncols);
return (rc);
return XCursesResizeScreen(nlines, ncols);
}

View File

@@ -19,51 +19,50 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid_PDCsetsc = "$Id: pdcsetsc.c,v 1.4 2006/01/03 19:54:29 wmcbrine Exp $";
char *rcsid_PDCsetsc = "$Id: pdcsetsc.c,v 1.5 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
PDC_set_font() - sets the current font size
PDCurses Description:
This is a private PDCurses function.
This is a private PDCurses function.
This routine sets the current font size, if the adapter allows
such a change.
This routine sets the current font size, if the adapter allows
such a change.
PDCurses Return Value:
This function returns OK upon success otherwise ERR is returned.
This function returns OK upon success otherwise ERR is returned.
PDCurses Errors:
It is an error to attempt to change the font size on a "bogus"
adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same
identifying characteristics.
It is an error to attempt to change the font size on a "bogus"
adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same
identifying characteristics.
Portability:
PDCurses int PDC_set_font( int size );
PDCurses int PDC_set_font(int size);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_set_font(int size)
int PDC_set_font(int size)
#else
int PDC_set_font(size)
int PDC_set_font(size)
int size;
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_set_font() - called\n"));
return(OK);
return OK;
}
/*man-start*********************************************************************
@@ -71,57 +70,60 @@ int size;
PDC_set_rows() - sets the physical number of rows on screen
PDCurses Description:
This is a private PDCurses function.
This is a private PDCurses function.
This routine attempts to set the number of rows on the physical
screen to the passed value.
This routine attempts to set the number of rows on the physical
screen to the passed value.
PDCurses Return Value:
This function returns OK upon success otherwise ERR is returned.
This function returns OK upon success otherwise ERR is returned.
PDCurses Errors:
It is an error to attempt to change the screen size on a "bogus"
adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same
identifying characteristics.
It is an error to attempt to change the screen size on a "bogus"
adapter. The reason for this is that we have a known video
adapter identity problem. e.g. Two adapters report the same
identifying characteristics.
Portability:
PDCurses int PDC_set_rows( int rows );
PDCurses int PDC_set_rows(int rows);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_set_rows(int rows)
int PDC_set_rows(int rows)
#else
int PDC_set_rows(rows)
int PDC_set_rows(rows)
int rows;
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_set_rows() - called\n"));
return(0);
return 0;
}
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_curs_set(int visibility)
int PDC_curs_set(int visibility)
#else
int PDC_curs_set(visibility)
int PDC_curs_set(visibility)
int visibility;
#endif
/***********************************************************************/
{
int ret_vis = SP->visibility;
int ret_vis = SP->visibility;
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n",visibility));
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n",
visibility));
if ( visibility != -1 )
{
SP->visibility = visibility;
}
XCurses_display_cursor(SP->cursrow,SP->curscol,SP->cursrow,SP->curscol,visibility);
return(ret_vis);
if (visibility != -1)
SP->visibility = visibility;
XCurses_display_cursor(SP->cursrow, SP->curscol, SP->cursrow,
SP->curscol, visibility);
return ret_vis;
}
/*man-start*********************************************************************
@@ -129,30 +131,30 @@ int visibility;
PDC_set_title() - Set window title
PDCurses Description:
Sets the title of the window in which the curses program is running.
This function may not do anything on some platforms.
Sets the title of the window in which the curses program is running.
This function may not do anything on some platforms.
PDCurses Return Value:
N/A
N/A
PDCurses Errors:
No errors are defined for this function.
No errors are defined for this function.
Portability:
PDCurses void PDC_set_title( char *title );
PDCurses void PDC_set_title(char *title);
**man-end**********************************************************************/
/***********************************************************************/
#ifdef HAVE_PROTO
void PDC_set_title(char *title)
void PDC_set_title(char *title)
#else
void PDC_set_title(title)
void PDC_set_title(title)
char *title;
#endif
/***********************************************************************/
{
PDC_LOG(("PDC_set_title() - called:<%s>\n",title));
PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
XCurses_set_title(title);
return;
}

File diff suppressed because it is too large Load Diff

View File

@@ -23,11 +23,11 @@
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#include <stdio.h>
@@ -35,9 +35,8 @@
#include <ctype.h>
#include <pwd.h>
/*
* #includes specific to running XCurses with seperate processes
*/
/* #includes specific to running XCurses with seperate processes */
#ifdef USE_PROCESSES
# include <sys/types.h>
# include <sys/socket.h>
@@ -55,13 +54,6 @@
typedef char * XPointer;
#endif
/*
* #includes specific to running XCurses with threads
*/
#ifdef USE_THREADS
# include <pthreads.h>
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@ -82,14 +74,14 @@
#include <Shell.h>
#ifdef USE_XAW3D
#include <Xaw3d/Box.h>
#include <Xaw3d/Scrollbar.h>
# include <Xaw3d/Box.h>
# include <Xaw3d/Scrollbar.h>
#elif defined(USE_NEXTAW)
#include <neXtaw/Box.h>
#include <neXtaw/Scrollbar.h>
# include <neXtaw/Box.h>
# include <neXtaw/Scrollbar.h>
#else
#include <Xaw/Box.h>
#include <Xaw/Scrollbar.h>
# include <Xaw/Box.h>
# include <Xaw/Scrollbar.h>
#endif
#include "x11/ScrollBox.h"
@@ -103,11 +95,11 @@
#endif
#ifdef HAVE_DECKEYSYM_H
#include <DECkeysym.h>
# include <DECkeysym.h>
#endif
#ifdef HAVE_SUNKEYSYM_H
#include <Sunkeysym.h>
# include <Sunkeysym.h>
#endif
#ifdef HAVE_XPM_H
@@ -193,50 +185,50 @@
#define XtCColorBoldWhite "ColorBoldWhite"
#ifndef MAX_PATH
# define MAX_PATH 256
# define MAX_PATH 256
#endif
typedef struct
{
int lines;
int cols;
Pixel cursorColor;
Pixel colorBlack;
Pixel colorRed;
Pixel colorGreen;
Pixel colorYellow;
Pixel colorBlue;
Pixel colorMagenta;
Pixel colorCyan;
Pixel colorWhite;
Pixel colorBoldBlack;
Pixel colorBoldRed;
Pixel colorBoldGreen;
Pixel colorBoldYellow;
Pixel colorBoldBlue;
Pixel colorBoldMagenta;
Pixel colorBoldCyan;
Pixel colorBoldWhite;
Pixel pointerForeColor;
Pixel pointerBackColor;
XFontStruct *normalfont;
XFontStruct *italicfont;
char *bitmapFile;
int lines;
int cols;
Pixel cursorColor;
Pixel colorBlack;
Pixel colorRed;
Pixel colorGreen;
Pixel colorYellow;
Pixel colorBlue;
Pixel colorMagenta;
Pixel colorCyan;
Pixel colorWhite;
Pixel colorBoldBlack;
Pixel colorBoldRed;
Pixel colorBoldGreen;
Pixel colorBoldYellow;
Pixel colorBoldBlue;
Pixel colorBoldMagenta;
Pixel colorBoldCyan;
Pixel colorBoldWhite;
Pixel pointerForeColor;
Pixel pointerBackColor;
XFontStruct *normalfont;
XFontStruct *italicfont;
char *bitmapFile;
#ifdef HAVE_XPM_H
char *pixmapFile;
char *pixmapFile;
#endif
char *composeKey;
Cursor pointer;
int shmmin;
int borderWidth;
int borderColor;
int clickPeriod;
int doubleClickPeriod;
int scrollbarWidth;
int cursorBlinkRate;
char *textCursor;
char *composeKey;
Cursor pointer;
int shmmin;
int borderWidth;
int borderColor;
int clickPeriod;
int doubleClickPeriod;
int scrollbarWidth;
int cursorBlinkRate;
char *textCursor;
#if 0
XtWidgetGeometry geometry;
XtWidgetGeometry geometry;
#endif
} AppData;
@@ -263,28 +255,31 @@ typedef struct
#define XCURSESGEOMETRY app_data.geometry
#define XCURSESTEXTCURSOR app_data.textCursor
#define XCURSESDISPLAY (XtDisplay(drawing))
#define XCURSESWIN (XtWindow(drawing))
#define XCURSESDISPLAY (XtDisplay(drawing))
#define XCURSESWIN (XtWindow(drawing))
#define XCLOGMSG (XCursesProcess ? " X" : "CURSES")
#define MAX_COLORS 8 /* maximum of "normal" colours */
#define COLOR_CURSOR 16 /* colour of cursor - 1 more than 2*MAX_COLORS */
#define COLOR_BORDER 17 /* colour of border - 2 more than 2*MAX_COLORS */
#define COLOR_CURSOR 16 /* colour of cursor - 1 more than 2 * MAX_COLORS */
#define COLOR_BORDER 17 /* colour of border - 2 more than 2 * MAX_COLORS */
#ifdef HAVE_XPM_H
# define PDC_NUMBER_OPTIONS 33
#define PDC_NUMBER_APP_RESOURCES 35
#else
# define PDC_NUMBER_OPTIONS 32
#define PDC_NUMBER_APP_RESOURCES 34
# define PDC_NUMBER_APP_RESOURCES 34
#endif
#define PDC_NUMBER_XCURSES_ACTIONS 5
#include "x11.h"
extern GC normal_gc,block_cursor_gc,rect_cursor_gc,italic_gc,border_gc;
extern int XCursesFontHeight,XCursesFontWidth;
extern int XCursesFontAscent,XCursesFontDescent;
extern int XCursesWindowWidth,XCursesWindowHeight;
extern int resizeXCursesWindowWidth,resizeXCursesWindowHeight;
extern GC normal_gc, block_cursor_gc, rect_cursor_gc, italic_gc, border_gc;
extern int XCursesFontHeight, XCursesFontWidth;
extern int XCursesFontAscent, XCursesFontDescent;
extern int XCursesWindowWidth, XCursesWindowHeight;
extern int resizeXCursesWindowWidth, resizeXCursesWindowHeight;
extern char *bitmap_file;
#ifdef HAVE_XPM_H
extern char *pixmap_file;
@@ -300,7 +295,7 @@ extern char *defaultTranslations;
extern XtActionsRec XCursesActions[PDC_NUMBER_XCURSES_ACTIONS];
extern char *XCursesClassName;
extern XtAppContext app_context;
extern Widget topLevel,drawing,d1,scrollBox,scrollVert,scrollHoriz;
extern Widget topLevel, drawing, d1, scrollBox, scrollVert, scrollHoriz;
extern int ReceivedMapNotify;
extern Boolean mouse_selection;
extern char *tmpsel;
@@ -319,7 +314,7 @@ extern XrmOptionDescRec options[PDC_NUMBER_OPTIONS];
extern char global_display_name[100];
extern Bool after_first_curses_request;
/* extern char *XCursesProgramName; */
extern int colors[(2*MAX_COLORS)+2];
extern int colors[(2 * MAX_COLORS) + 2];
extern int windowEntered;
extern int visible_cursor;
extern Bool vertical_cursor;
@@ -327,13 +322,15 @@ extern Bool vertical_cursor;
typedef RETSIGTYPE (*signal_handler)();
#ifdef HAVE_PROTO
void XCursesNonmaskable(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch);
void XCursesExpose(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch);
signal_handler XCursesSetSignal(int,signal_handler);
void XCursesNonmaskable(Widget w, XtPointer client_data, XEvent *event,
Boolean *continue_to_dispatch);
void XCursesExpose(Widget w, XtPointer client_data, XEvent *event,
Boolean *continue_to_dispatch);
signal_handler XCursesSetSignal(int, signal_handler);
void XCursesGetIcon(void);
int XCursesRefreshScrollbar(void);
int XCursesSendKeyToCurses(unsigned long, MOUSE_STATUS *);
void XCursesButton(Widget,XEvent *,String *,Cardinal *);
void XCursesButton(Widget, XEvent *, String *, Cardinal *);
void XCursesCursorBlink(XtPointer unused, XtIntervalId *id);
void Scroll_up_down(Widget w, XtPointer client_data, XtPointer call_data);
void Scroll_left_right(Widget w, XtPointer client_data, XtPointer call_data);

File diff suppressed because it is too large Load Diff

View File

@@ -1,41 +1,51 @@
#ifdef HAVE_PROTO
void dummy_function(void);
void get_GC(Display *,Window, GC *, XFontStruct *,int ,int, bool );
void makeXY(int ,int ,int ,int ,int *,int *);
void get_GC(Display *, Window, GC *, XFontStruct *, int, int, bool);
void makeXY(int, int, int, int, int *, int *);
int get_colors(void);
void start_event_handler(void);
int XCursesTransformLine(int ,int ,chtype ,int ,int,int,char *);
int XCursesDisplayText(chtype *, int, int, int,bool);
void XCursesDisplayScreen(bool);
void XCursesDisplayCursor( int ,int ,int ,int );
void XCursesStructureNotify(Widget,XtPointer ,XEvent *,Boolean *);
void XCursesEnterLeaveWindow(Widget,XtPointer ,XEvent *,Boolean *);
void XCursesPasteSelection(Widget,XButtonEvent *);
void XCursesHandleString(Widget,XEvent *,String *,Cardinal *);
void XCursesKeyPress(Widget,XEvent *,String *,Cardinal *);
void XCursesModifierPress(Widget,XEvent *,String *,Cardinal *);
void XCursesButton(Widget,XEvent *,String *,Cardinal *);
Boolean XCursesConvertProc(Widget,Atom *,Atom *,Atom *,XtPointer *,unsigned long *,int *);
void XCursesLoseOwnership(Widget,Atom *);
void XCursesRequestorCallbackForPaste(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *);
void XCursesRequestorCallbackForGetSelection(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *);
RETSIGTYPE XCursesSignalHandler(int);
void XCursesExitXCursesProcess(int,int,char *);
void SelectionOff(void);
void SelectionOn(int,int);
void SelectionExtend(int,int);
void SelectionSet( void );
int write_socket(int,char *,int);
int read_socket(int,char *,int);
int XCursesSetupX(char *display_name,int argc, char *argv[]);
int XCursesTransformLine(int, int, chtype, int, int, int, char *);
int XCursesDisplayText(chtype *, int, int, int, bool);
void XCursesDisplayScreen(bool);
void XCursesDisplayCursor(int, int, int, int);
void XCursesStructureNotify(Widget, XtPointer, XEvent *, Boolean *);
void XCursesEnterLeaveWindow(Widget, XtPointer, XEvent *, Boolean *);
void XCursesPasteSelection(Widget, XButtonEvent *);
void XCursesHandleString(Widget, XEvent *, String *, Cardinal *);
void XCursesKeyPress(Widget, XEvent *, String *, Cardinal *);
void XCursesModifierPress(Widget, XEvent *, String *, Cardinal *);
void XCursesButton(Widget, XEvent *, String *, Cardinal *);
Boolean XCursesConvertProc(Widget, Atom *, Atom *, Atom *, XtPointer *,
unsigned long *, int *);
void XCursesLoseOwnership(Widget, Atom *);
void XCursesRequestorCallbackForPaste(Widget, XtPointer, Atom *, Atom *,
XtPointer, unsigned long *, int *);
void XCursesRequestorCallbackForGetSelection(Widget, XtPointer, Atom *, Atom *,
XtPointer, unsigned long *, int *);
RETSIGTYPE XCursesSignalHandler(int);
void XCursesExitXCursesProcess(int, int, char *);
void SelectionOff(void);
void SelectionOn(int, int);
void SelectionExtend(int, int);
void SelectionSet(void);
int write_socket(int, char *, int);
int read_socket(int, char *, int);
int XCursesSetupX(char *display_name, int argc, char *argv[]);
RETSIGTYPE XCursesSigwinchHandler(int signo);
#else
void dummy_function(void);
void get_GC();
void makeXY();
int get_colors();
void start_event_handler();
int XCursesTransformLine();
int XCursesDisplayText();
void XCursesDisplayScreen();
@@ -53,6 +63,7 @@ void XCursesRequestorCallbackForPaste();
void XCursesRequestorCallbackForGetSelection();
RETSIGTYPE XCursesSignalHandler();
void XCursesExitXCursesProcess();
void SelectionOff();
void SelectionOn();
void SelectionExtend();
@@ -60,8 +71,10 @@ void SelectionSet();
int write_socket();
int read_socket();
int XCursesSetupX();
RETSIGTYPE XCursesSigwinchHandler();
#endif
#ifdef _HPUX_SOURCE
@@ -69,6 +82,7 @@ RETSIGTYPE XCursesSigwinchHandler();
#else
# define FD_SET_CAST fd_set *
#endif
extern fd_set readfds;
extern fd_set writefds;
extern struct timeval socket_timeout;

View File

@@ -22,18 +22,19 @@
*/
#include "pdcx11.h"
/*
* Variables specific to process port
*/
/* Variables specific to process port */
unsigned char *Xcurscr;
int XCursesProcess=1;
int XCursesProcess = 1;
int shmidSP;
int shmid_Xcurscr;
int shmkeySP;
int shmkey_Xcurscr;
int otherpid;
int XCursesLINES=24;
int XCursesCOLS=80;
int XCursesLINES = 24;
int XCursesCOLS = 80;
int display_sock;
int key_sock;
int display_sockets[2];
@@ -42,102 +43,88 @@ int exit_sock;
fd_set readfds;
fd_set writefds;
struct timeval socket_timeout;
/***********************************************************************/
#ifdef HAVE_PROTO
int write_socket(int sock_num,char *buf,int len)
int write_socket(int sock_num, char *buf, int len)
#else
int write_socket(sock_num,buf,len)
int write_socket(sock_num, buf, len)
int sock_num;
char *buf;
int len;
#endif
/***********************************************************************/
{
int start=0,length=len,rc;
int start = 0, rc;
PDC_LOG(("%s:write_socket called: sock_num %d len %d\n",(XCursesProcess)?" X":"CURSES",sock_num,len));
PDC_LOG(("%s:write_socket called: sock_num %d len %d\n",
XCLOGMSG, sock_num, len));
#ifdef MOUSE_DEBUG1
if (sock_num == key_sock)
printf("%s:write_socket(key) len: %d\n",(XCursesProcess)?" X":"CURSES",len);
if (sock_num == key_sock)
printf("%s:write_socket(key) len: %d\n", XCLOGMSG, len);
#endif
while(1)
{
rc = write(sock_num,buf+start,length);
if (rc < 0
|| rc == length)
return(rc);
length -= rc;
start = rc;
}
while(1)
{
rc = write(sock_num, buf + start, len);
if (rc < 0 || rc == len)
return rc;
len -= rc;
start = rc;
}
}
/***********************************************************************/
#ifdef HAVE_PROTO
int read_socket(int sock_num,char *buf,int len)
int read_socket(int sock_num, char *buf, int len)
#else
int read_socket(sock_num,buf,len)
int read_socket(sock_num, buf, len)
int sock_num;
char *buf;
int len;
#endif
/***********************************************************************/
{
int start=0,length=len,rc;
int start = 0, length = len, rc;
PDC_LOG(("%s:read_socket called: sock_num %d len %d\n",(XCursesProcess)?" X":"CURSES",sock_num,len));
PDC_LOG(("%s:read_socket called: sock_num %d len %d\n",
XCLOGMSG, sock_num, len));
while(1)
{
rc = read(sock_num,buf+start,length);
#ifdef MOUSE_DEBUG1
if (sock_num == key_sock)
printf("%s:read_socket(key) rc %d errno %d resized: %d\n",(XCursesProcess)?" X":"CURSES",
rc,errno,SP->resized);
#endif
if (rc < 0
&& sock_num == key_sock
&& errno == EINTR
#ifdef BEFORE_CHANGE_BY_G_FUCHS
/*
* Patch by:
* Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999
*/
&& SP->resized == TRUE)
{
#ifdef MOUSE_DEBUG1
printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES");
#endif
rc = 0;
#else
&& SP->resized != FALSE)
{
#ifdef MOUSE_DEBUG1
printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES");
#endif
rc = 0;
if (SP->resized > 1)
SP->resized = TRUE;
else
SP->resized = FALSE;
#endif
memcpy(buf,(char *)&rc,sizeof(int));
return(0); /* must be >= 0 to avoid error */
}
while(1)
{
rc = read(sock_num, buf + start, length);
#ifdef BEFORE_CHANGE_BY_G_FUCHS
/*
* Patch by:
* Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999
*/
if (rc < 0
#else
if (rc <= 0
#ifdef MOUSE_DEBUG1
if (sock_num == key_sock)
printf("%s:read_socket(key) rc %d errno %d resized: %d\n",
XCLOGMSG, rc, errno, SP->resized);
#endif
|| rc == length)
return(rc);
length -= rc;
start = rc;
}
if (rc < 0 && sock_num == key_sock && errno == EINTR
&& SP->resized != FALSE)
{
#ifdef MOUSE_DEBUG1
printf("%s:continuing\n", XCLOGMSG);
#endif
rc = 0;
if (SP->resized > 1)
SP->resized = TRUE;
else
SP->resized = FALSE;
memcpy(buf, (char *)&rc, sizeof(int));
return 0;
}
if (rc <= 0 || rc == length)
return rc;
length -= rc;
start = rc;
}
}

File diff suppressed because it is too large Load Diff

122
x11/sb.c
View File

@@ -19,7 +19,7 @@
*/
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
# include <config.h>
# include <config.h>
#endif
#include <curses.h>
@@ -36,7 +36,7 @@
#endif
#ifdef PDCDEBUG
char *rcsid_sb = "$Id: sb.c,v 1.3 2006/01/03 07:34:43 wmcbrine Exp $";
char *rcsid_sb = "$Id: sb.c,v 1.4 2006/01/11 06:46:24 wmcbrine Exp $";
#endif
/*man-start*********************************************************************
@@ -44,19 +44,18 @@ char *rcsid_sb = "$Id: sb.c,v 1.3 2006/01/03 07:34:43 wmcbrine Exp $";
Name: sb
Synopsis:
int sb_init(void)
int sb_set_horz(int total, int viewport, int cur)
int sb_set_vert(int total, int viewport, int cur)
int sb_get_horz(int *total, int *viewport, int *cur)
int sb_get_vert(int *total, int *viewport, int *cur)
int sb_refresh(void);
int sb_init(void)
int sb_set_horz(int total, int viewport, int cur)
int sb_set_vert(int total, int viewport, int cur)
int sb_get_horz(int *total, int *viewport, int *cur)
int sb_get_vert(int *total, int *viewport, int *cur)
int sb_refresh(void);
PDCurses Description:
These functions manipulate the scrollbar...
These functions manipulate the scrollbar.
PDCurses Return Value:
All functions return OK on success and ERR on error.
All functions return OK on success and ERR on error.
Portability X/Open BSD SYS V
Dec '88
@@ -71,11 +70,10 @@ char *rcsid_sb = "$Id: sb.c,v 1.3 2006/01/03 07:34:43 wmcbrine Exp $";
bool sb_started = FALSE;
/* sb_init() is the sb initialization routine.
This must be called before initscr(). */
/***********************************************************************/
/*
sb_init() is the sb initialization routine.
This must be called before initscr().
*/
#ifdef HAVE_PROTO
int PDC_CDECL sb_init(void)
#else
@@ -86,20 +84,20 @@ int PDC_CDECL sb_init()
PDC_LOG(("sb_init() - called\n"));
if (SP)
return (ERR);
return ERR;
sb_started = TRUE;
return(OK);
return OK;
}
/***********************************************************************/
/*
sb_set_horz() Used to set horizontal scrollbar.
/* sb_set_horz() - Used to set horizontal scrollbar.
total = total number of columns
viewport = size of viewport in columns
cur = current column in total
*/
cur = current column in total */
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_CDECL sb_set_horz(int total, int viewport, int cur)
#else
@@ -108,25 +106,26 @@ int total, viewport, cur;
#endif
/***********************************************************************/
{
PDC_LOG(("sb_set_horz() - called: total %d viewport %d cur %d\n",total, viewport, cur));
PDC_LOG(("sb_set_horz() - called: total %d viewport %d cur %d\n",
total, viewport, cur));
if (!SP)
return(ERR);
return ERR;
SP->sb_total_x = total;
SP->sb_viewport_x = viewport;
SP->sb_cur_x = cur;
return( OK );
return OK;
}
/***********************************************************************/
/*
sb_set_vert() Used to set vertical scrollbar.
/* sb_set_vert() - Used to set vertical scrollbar.
total = total number of columns on line
viewport = size of viewport in columns
cur = current column in total
*/
cur = current column in total */
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_CDECL sb_set_vert(int total, int viewport, int cur)
#else
@@ -135,25 +134,26 @@ int total, viewport, cur;
#endif
/***********************************************************************/
{
PDC_LOG(("sb_set_vert() - called: total %d viewport %d cur %d\n",total, viewport, cur));
PDC_LOG(("sb_set_vert() - called: total %d viewport %d cur %d\n",
total, viewport, cur));
if (!SP)
return(ERR);
return ERR;
SP->sb_total_y = total;
SP->sb_viewport_y = viewport;
SP->sb_cur_y = cur;
return( OK );
return OK;
}
/***********************************************************************/
/*
sb_get_horz() Used to get horizontal scrollbar.
/* sb_get_horz() - Used to get horizontal scrollbar.
total = total number of lines
viewport = size of viewport in lines
cur = current line in total
*/
cur = current line in total */
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_CDECL sb_get_horz(int *total, int *viewport, int *cur)
#else
@@ -165,22 +165,25 @@ int *total, *viewport, *cur;
PDC_LOG(("sb_get_horz() - called\n"));
if (!SP)
return(ERR);
return ERR;
if (total) *total = SP->sb_total_x;
if (viewport) *viewport = SP->sb_viewport_x;
if (cur) *cur = SP->sb_cur_x;
return( OK );
if (total)
*total = SP->sb_total_x;
if (viewport)
*viewport = SP->sb_viewport_x;
if (cur)
*cur = SP->sb_cur_x;
return OK;
}
/***********************************************************************/
/*
sb_get_vert() Used to get vertical scrollbar.
/* sb_get_vert() - Used to get vertical scrollbar.
total = total number of lines
viewport = size of viewport in lines
cur = current line in total
*/
cur = current line in total */
/***********************************************************************/
#ifdef HAVE_PROTO
int PDC_CDECL sb_get_vert(int *total, int *viewport, int *cur)
#else
@@ -192,18 +195,21 @@ int *total, *viewport, *cur;
PDC_LOG(("sb_get_vert() - called\n"));
if (!SP)
return(ERR);
return ERR;
if (total) *total = SP->sb_total_y;
if (viewport) *viewport = SP->sb_viewport_y;
if (cur) *cur = SP->sb_cur_y;
return( OK );
if (total)
*total = SP->sb_total_y;
if (viewport)
*viewport = SP->sb_viewport_y;
if (cur)
*cur = SP->sb_cur_y;
return OK;
}
/* sb_refresh() - Used to draw the scrollbars. */
/***********************************************************************/
/*
sb_refresh() Used to draw the scrollbars.
*/
#ifdef HAVE_PROTO
int PDC_CDECL sb_refresh(void)
#else
@@ -214,7 +220,7 @@ int PDC_CDECL sb_refresh()
PDC_LOG(("sb_refresh() - called\n"));
if (!SP)
return(ERR);
return ERR;
return(XCurses_refresh_scrollbar());
return XCurses_refresh_scrollbar();
}