Added get_line_lock() and release_line_lock(); made dummy_function()

static.
This commit is contained in:
William McBrine
2006-07-21 04:07:05 +00:00
parent 4f28970294
commit f1e58de2e1
5 changed files with 37 additions and 47 deletions

View File

@@ -19,7 +19,7 @@
#include <string.h>
RCSID("$Id: pdcdisp.c,v 1.28 2006/07/21 03:23:50 wmcbrine Exp $");
RCSID("$Id: pdcdisp.c,v 1.29 2006/07/21 04:07:05 wmcbrine Exp $");
int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol,
int visibility)
@@ -168,12 +168,7 @@ void PDC_transform_line(int lineno)
dstp = curscr->_y[lineno] + x;
len = endx - x + 1;
/* loop until we can write to the line */
while (*(Xcurscr + XCURSCR_FLAG_OFF + lineno))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + lineno) = 1;
get_line_lock(lineno);
memcpy(Xcurscr + XCURSCR_Y_OFF(lineno) + (x * sizeof(chtype)),
dstp, len * sizeof(chtype));
@@ -181,7 +176,7 @@ void PDC_transform_line(int lineno)
*(Xcurscr + XCURSCR_START_OFF + lineno) = x;
*(Xcurscr + XCURSCR_LENGTH_OFF + lineno) = len;
*(Xcurscr + XCURSCR_FLAG_OFF + lineno) = 0;
release_line_lock(lineno);
curscr->_firstch[lineno] = _NO_CHANGE;
curscr->_lastch[lineno] = _NO_CHANGE;

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
RCSID("$Id: pdcx11.c,v 1.76 2006/07/21 03:45:24 wmcbrine Exp $");
RCSID("$Id: pdcx11.c,v 1.77 2006/07/21 04:07:05 wmcbrine Exp $");
AppData app_data;
@@ -888,10 +888,6 @@ void XCsay(const char *msg)
}
#endif
void dummy_function(void)
{
}
#ifdef PDC_WIDE
static int to_utf8(char *outcode, int code)
{
@@ -1382,18 +1378,12 @@ static void XCursesDisplayScreen(void)
for (row = 0; row < XCursesLINES; row++)
{
/* loop until we can write to the line -- Patch by:
Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
get_line_lock(row);
XCursesDisplayText((const chtype *)(Xcurscr +
XCURSCR_Y_OFF(row)), row, 0, COLS, FALSE);
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
release_line_lock(row);
}
XCursesDisplayCursor(SP->cursrow, SP->curscol, SP->cursrow,
@@ -2007,19 +1997,13 @@ void ShowSelection(int start_x, int start_y, int end_x, int end_y,
row = start_y + i;
}
/* loop until we can write to the line - Patch by: Georg
Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 */
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
get_line_lock(row);
XCursesDisplayText((const chtype *)(Xcurscr +
XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))),
row, start_col, num_cols, highlight);
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
release_line_lock(row);
}
}
@@ -2212,13 +2196,7 @@ void SelectionSet(void)
row = start_y + i;
}
/* loop until we can write to the line -- Patch by:
Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
get_line_lock(row);
ptr = (chtype *)(Xcurscr + XCURSCR_Y_OFF(row) +
start_col * sizeof(chtype));
@@ -2240,7 +2218,7 @@ void SelectionSet(void)
for (j = 0; j <= last_nonblank; j++)
tmpsel[num_chars++] = ptr[j];
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
release_line_lock(row);
if (i < end_y - start_y)
tmpsel[num_chars++] = '\n';

View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: pdcx11.h,v 1.41 2006/07/21 03:45:25 wmcbrine Exp $ */
/* $Id: pdcx11.h,v 1.42 2006/07/21 04:07:05 wmcbrine Exp $ */
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
@@ -277,7 +277,8 @@ extern AppData app_data;
#endif
#define PDC_NUMBER_XCURSES_ACTIONS 5
void dummy_function(void);
void get_line_lock(int);
void release_line_lock(int);
void get_GC(Display *, Window, GC *, XFontStruct *, int, int, bool);
int get_colors(void);

View File

@@ -19,7 +19,7 @@
#include <stdlib.h>
RCSID("$Id: x11.c,v 1.57 2006/07/21 03:45:25 wmcbrine Exp $");
RCSID("$Id: x11.c,v 1.58 2006/07/21 04:07:05 wmcbrine Exp $");
int visible_cursor = 0;
int windowEntered = 1;
@@ -73,10 +73,7 @@ static int XCursesRefreshScreen(void)
if (num_cols != 0)
{
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
get_line_lock(row);
start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row);
@@ -85,8 +82,7 @@ static int XCursesRefreshScreen(void)
sizeof(chtype))), row, start_col,
num_cols, FALSE);
*(Xcurscr + XCURSCR_LENGTH_OFF + row) = 0;
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
release_line_lock(row);
}
}

View File

@@ -17,7 +17,7 @@
#include "pdcx11.h"
RCSID("$Id: x11common.c,v 1.16 2006/07/02 07:08:28 wmcbrine Exp $");
RCSID("$Id: x11common.c,v 1.17 2006/07/21 04:07:05 wmcbrine Exp $");
/* Variables specific to process port */
@@ -42,6 +42,26 @@ fd_set writefds;
struct timeval socket_timeout;
static void dummy_function(void)
{
}
void get_line_lock(int row)
{
/* loop until we can write to the line -- Patch by:
Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
dummy_function();
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
}
void release_line_lock(int row)
{
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
}
int write_socket(int sock_num, const char *buf, int len)
{
int start = 0, rc;