Add XC_ prefix to functions that are shared between processes. More to

do in this regard.
This commit is contained in:
William McBrine
2006-07-30 23:03:33 +00:00
parent 36ae8c07c2
commit 00f5d78b09
8 changed files with 69 additions and 69 deletions

View File

@@ -19,7 +19,7 @@
#include <stdlib.h>
RCSID("$Id: pdcclip.c,v 1.19 2006/07/21 03:23:49 wmcbrine Exp $");
RCSID("$Id: pdcclip.c,v 1.20 2006/07/30 23:03:33 wmcbrine Exp $");
/*man-start**************************************************************
@@ -57,13 +57,13 @@ int PDC_getclipboard(char **contents, long *length)
XCursesInstructAndWait(CURSES_GET_SELECTION);
if (read_socket(display_sock, (char *)&result, sizeof(int)) < 0)
if (XC_read_socket(display_sock, (char *)&result, sizeof(int)) < 0)
XCursesExitCursesProcess(5,
"exiting from PDC_getclipboard");
if (result == PDC_CLIP_SUCCESS)
{
if (read_socket(display_sock, (char *)&len, sizeof(int)) < 0)
if (XC_read_socket(display_sock, (char *)&len, sizeof(int)) < 0)
XCursesExitCursesProcess(5,
"exiting from PDC_getclipboard");
@@ -75,7 +75,7 @@ int PDC_getclipboard(char **contents, long *length)
XCursesExitCursesProcess(6, "exiting from "
"PDC_getclipboard - synchronization error");
if (read_socket(display_sock, *contents, len) < 0)
if (XC_read_socket(display_sock, *contents, len) < 0)
XCursesExitCursesProcess(5,
"exiting from PDC_getclipboard");
@@ -117,9 +117,9 @@ int PDC_setclipboard(const char *contents, long length)
/* Write, then wait for X to do its stuff; expect return code. */
if (write_socket(display_sock, (char *)&length, sizeof(long)) >= 0)
if (write_socket(display_sock, contents, length) >= 0)
if (read_socket(display_sock, (char *)&rc, sizeof(int)) >= 0)
if (XC_write_socket(display_sock, (char *)&length, sizeof(long)) >= 0)
if (XC_write_socket(display_sock, contents, length) >= 0)
if (XC_read_socket(display_sock, (char *)&rc, sizeof(int)) >= 0)
return rc;
XCursesExitCursesProcess(5, "exiting from PDC_setclipboard");
@@ -181,8 +181,8 @@ int PDC_clearclipboard(void)
/* Write, then wait for X to do its stuff; expect return code. */
if (write_socket(display_sock, (char *)&len, sizeof(long)) >= 0)
if (read_socket(display_sock, (char *)&rc, sizeof(int)) >= 0)
if (XC_write_socket(display_sock, (char *)&len, sizeof(long)) >= 0)
if (XC_read_socket(display_sock, (char *)&rc, sizeof(int)) >= 0)
return rc;
XCursesExitCursesProcess(5, "exiting from PDC_clearclipboard");

View File

@@ -19,7 +19,7 @@
#include <string.h>
RCSID("$Id: pdcdisp.c,v 1.33 2006/07/28 22:06:53 wmcbrine Exp $");
RCSID("$Id: pdcdisp.c,v 1.34 2006/07/30 23:03:33 wmcbrine Exp $");
int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol,
int visibility)
@@ -55,7 +55,7 @@ int PDC_display_cursor(int oldrow, int oldcol, int newrow, int newcol,
idx += sizeof(int);
}
if (write_socket(display_sock, buf, idx) < 0)
if (XC_write_socket(display_sock, buf, idx) < 0)
XCursesExitCursesProcess(1,
"exiting from PDC_display_cursor");
@@ -106,7 +106,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
get_line_lock(lineno);
XC_get_line_lock(lineno);
memcpy(Xcurscr + XCURSCR_Y_OFF(lineno) + (x * sizeof(chtype)),
srcp, len * sizeof(chtype));
@@ -114,7 +114,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
*(Xcurscr + XCURSCR_START_OFF + lineno) = x;
*(Xcurscr + XCURSCR_LENGTH_OFF + lineno) = len;
release_line_lock(lineno);
XC_release_line_lock(lineno);
XCursesInstructAndWait(CURSES_REFRESH);
}

View File

@@ -17,7 +17,7 @@
#include "pdcx11.h"
RCSID("$Id: pdckbd.c,v 1.31 2006/07/30 22:00:25 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.32 2006/07/30 23:03:33 wmcbrine Exp $");
MOUSE_STATUS Trapped_Mouse_status;
@@ -59,7 +59,7 @@ int PDC_get_bios_key(void)
while (1)
{
if (read_socket(key_sock, (char *)&newkey,
if (XC_read_socket(key_sock, (char *)&newkey,
sizeof(unsigned long)) < 0)
XCursesExitCursesProcess(2,
"exiting from PDC_get_bios_key");
@@ -69,7 +69,7 @@ int PDC_get_bios_key(void)
if (key == KEY_MOUSE)
{
if (read_socket(key_sock, (char *)&Trapped_Mouse_status,
if (XC_read_socket(key_sock, (char *)&Trapped_Mouse_status,
sizeof(MOUSE_STATUS)) < 0)
XCursesExitCursesProcess(2,
"exiting from PDC_get_bios_key");

View File

@@ -19,7 +19,7 @@
#include <string.h>
RCSID("$Id: pdcsetsc.c,v 1.20 2006/07/23 13:45:52 wmcbrine Exp $");
RCSID("$Id: pdcsetsc.c,v 1.21 2006/07/30 23:03:33 wmcbrine Exp $");
/*man-start**************************************************************
@@ -94,8 +94,8 @@ void PDC_set_title(const char *title)
XCursesInstruct(CURSES_TITLE);
if (write_display_socket_int(len) >= 0)
if (write_socket(display_sock, title, len) >= 0)
if (XC_write_display_socket_int(len) >= 0)
if (XC_write_socket(display_sock, title, len) >= 0)
return;
XCursesExitCursesProcess(1, "exiting from PDC_set_title");

View File

@@ -19,7 +19,7 @@
#include <stdlib.h>
RCSID("$Id: pdcx11.c,v 1.78 2006/07/21 15:28:18 wmcbrine Exp $");
RCSID("$Id: pdcx11.c,v 1.79 2006/07/30 23:03:33 wmcbrine Exp $");
/*** Functions that are called by both processes ***/
@@ -49,7 +49,7 @@ static void dummy_function(void)
{
}
void get_line_lock(int row)
void XC_get_line_lock(int row)
{
/* loop until we can write to the line -- Patch by:
Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */
@@ -60,21 +60,21 @@ void get_line_lock(int row)
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
}
void release_line_lock(int row)
void XC_release_line_lock(int row)
{
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
}
int write_socket(int sock_num, const char *buf, int len)
int XC_write_socket(int sock_num, const char *buf, int len)
{
int start = 0, rc;
PDC_LOG(("%s:write_socket called: sock_num %d len %d\n",
PDC_LOG(("%s:XC_write_socket called: sock_num %d len %d\n",
XCLOGMSG, sock_num, len));
#ifdef MOUSE_DEBUG
if (sock_num == key_sock)
printf("%s:write_socket(key) len: %d\n", XCLOGMSG, len);
printf("%s:XC_write_socket(key) len: %d\n", XCLOGMSG, len);
#endif
while (1)
{
@@ -88,11 +88,11 @@ int write_socket(int sock_num, const char *buf, int len)
}
}
int read_socket(int sock_num, char *buf, int len)
int XC_read_socket(int sock_num, char *buf, int len)
{
int start = 0, length = len, rc;
PDC_LOG(("%s:read_socket called: sock_num %d len %d\n",
PDC_LOG(("%s:XC_read_socket called: sock_num %d len %d\n",
XCLOGMSG, sock_num, len));
while (1)
@@ -101,7 +101,7 @@ int read_socket(int sock_num, char *buf, int len)
#ifdef MOUSE_DEBUG
if (sock_num == key_sock)
printf("%s:read_socket(key) rc %d errno %d resized: %d\n",
printf("%s:XC_read_socket(key) rc %d errno %d resized: %d\n",
XCLOGMSG, rc, errno, SP->resized);
#endif
if (rc < 0 && sock_num == key_sock && errno == EINTR
@@ -129,9 +129,9 @@ int read_socket(int sock_num, char *buf, int len)
}
}
int write_display_socket_int(int x)
int XC_write_display_socket_int(int x)
{
return write_socket(display_sock, (char *)&x, sizeof(int));
return XC_write_socket(display_sock, (char *)&x, sizeof(int));
}
@@ -143,7 +143,7 @@ int XCursesInstruct(int flag)
/* Send a request to X */
if (write_display_socket_int(flag) < 0)
if (XC_write_display_socket_int(flag) < 0)
XCursesExitCursesProcess(4, "exiting from XCursesInstruct");
return OK;
@@ -161,7 +161,7 @@ int XCursesInstructAndWait(int flag)
/* wait for X to say the refresh has occurred*/
if (read_socket(display_sock, (char *)&result, sizeof(int)) < 0)
if (XC_read_socket(display_sock, (char *)&result, sizeof(int)) < 0)
XCursesExitCursesProcess(5,
"exiting from XCursesInstructAndWait");
@@ -187,7 +187,7 @@ static int XCursesSetupCurses(void)
FD_ZERO(&readfds);
FD_ZERO(&writefds);
read_socket(display_sock, (char *)&wait_value, sizeof(int));
XC_read_socket(display_sock, (char *)&wait_value, sizeof(int));
if (wait_value != CURSES_CHILD)
return ERR;

View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: pdcx11.h,v 1.45 2006/07/30 22:00:25 wmcbrine Exp $ */
/* $Id: pdcx11.h,v 1.46 2006/07/30 23:03:33 wmcbrine Exp $ */
#define CURSES_LIBRARY 1
#ifdef HAVE_CONFIG_H
@@ -143,8 +143,8 @@ extern AppData app_data;
#define XCLOGMSG (XCursesProcess ? " X" : "CURSES")
void get_line_lock(int);
void release_line_lock(int);
void XC_get_line_lock(int);
void XC_release_line_lock(int);
int PDC_display_cursor(int, int, int, int, int);
@@ -153,9 +153,9 @@ int XCursesInstruct(int);
int XCursesInstructAndWait(int);
int XCursesInitscr(int, char **);
int write_socket(int, const char *, int);
int read_socket(int, char *, int);
int write_display_socket_int(int);
int XC_write_socket(int, const char *, int);
int XC_read_socket(int, char *, int);
int XC_write_display_socket_int(int);
int XCursesSetupX(int argc, char *argv[]);
RETSIGTYPE XCursesSigwinchHandler(int signo);

View File

@@ -25,7 +25,7 @@
#undef sb_get_vert
#undef sb_refresh
RCSID("$Id: sb.c,v 1.17 2006/07/07 13:11:43 wmcbrine Exp $");
RCSID("$Id: sb.c,v 1.18 2006/07/30 23:03:33 wmcbrine Exp $");
/*man-start**************************************************************
@@ -170,7 +170,7 @@ int sb_refresh(void)
if (!SP)
return ERR;
if (write_display_socket_int(CURSES_REFRESH_SCROLLBAR) < 0)
if (XC_write_display_socket_int(CURSES_REFRESH_SCROLLBAR) < 0)
XCursesExitCursesProcess(1,
"exiting from sb_refresh");

View File

@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>
RCSID("$Id: x11.c,v 1.4 2006/07/30 22:00:25 wmcbrine Exp $");
RCSID("$Id: x11.c,v 1.5 2006/07/30 23:03:33 wmcbrine Exp $");
#ifndef XPOINTER_TYPEDEFED
typedef char * XPointer;
@@ -1433,12 +1433,12 @@ static void XCursesDisplayScreen(void)
for (row = 0; row < XCursesLINES; row++)
{
get_line_lock(row);
XC_get_line_lock(row);
XCursesDisplayText((const chtype *)(Xcurscr +
XCURSCR_Y_OFF(row)), row, 0, COLS, FALSE);
release_line_lock(row);
XC_release_line_lock(row);
}
XCursesDisplayCursor(SP->cursrow, SP->curscol, SP->cursrow,
@@ -1467,7 +1467,7 @@ static void XCursesRefreshScreen(void)
if (num_cols != 0)
{
get_line_lock(row);
XC_get_line_lock(row);
start_col = (int)*(Xcurscr + XCURSCR_START_OFF + row);
@@ -1478,7 +1478,7 @@ static void XCursesRefreshScreen(void)
*(Xcurscr + XCURSCR_LENGTH_OFF + row) = 0;
release_line_lock(row);
XC_release_line_lock(row);
}
}
@@ -2086,13 +2086,13 @@ static void ShowSelection(int start_x, int start_y, int end_x, int end_y,
row = start_y + i;
}
get_line_lock(row);
XC_get_line_lock(row);
XCursesDisplayText((const chtype *)(Xcurscr +
XCURSCR_Y_OFF(row) + (start_col * sizeof(chtype))),
row, start_col, num_cols, highlight);
release_line_lock(row);
XC_release_line_lock(row);
}
}
@@ -2285,7 +2285,7 @@ static void SelectionSet(void)
row = start_y + i;
}
get_line_lock(row);
XC_get_line_lock(row);
ptr = (chtype *)(Xcurscr + XCURSCR_Y_OFF(row) +
start_col * sizeof(chtype));
@@ -2307,7 +2307,7 @@ static void SelectionSet(void)
for (j = 0; j <= last_nonblank; j++)
tmpsel[num_chars++] = ptr[j];
release_line_lock(row);
XC_release_line_lock(row);
if (i < end_y - start_y)
tmpsel[num_chars++] = '\n';
@@ -2466,7 +2466,7 @@ static void XCursesSendKeyToCurses(unsigned long key, MOUSE_STATUS *ms)
PDC_LOG(("%s:XCursesSendKeyToCurses() - called: sending %d\n",
XCLOGMSG, key));
if (write_socket(key_sock, (char *)&key, sizeof(unsigned long)) < 0)
if (XC_write_socket(key_sock, (char *)&key, sizeof(unsigned long)) < 0)
XCursesExitXCursesProcess(1, SIGKILL,
"exiting from XCursesSendKeyToCurses");
@@ -2474,7 +2474,7 @@ static void XCursesSendKeyToCurses(unsigned long key, MOUSE_STATUS *ms)
{
MOUSE_LOG(("%s:writing mouse stuff\n", XCLOGMSG));
if (write_socket(key_sock, (char *)&Mouse_status,
if (XC_write_socket(key_sock, (char *)&Mouse_status,
sizeof(MOUSE_STATUS)) < 0)
XCursesExitXCursesProcess(1, SIGKILL,
"exiting from XCursesSendKeyToCurses");
@@ -2982,7 +2982,7 @@ static void XCursesExitXCursesProcess(int rc, int sig, char *msg)
static void XCursesContinue(void)
{
if (write_display_socket_int(CURSES_CONTINUE) < 0)
if (XC_write_display_socket_int(CURSES_CONTINUE) < 0)
XCursesExitXCursesProcess(4, SIGKILL,
"exiting from XCursesProcessRequestsFromCurses");
}
@@ -3024,14 +3024,14 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
been received */
PDC_LOG(("%s:XCursesProcessRequestsFromCurses() - "
"before read_socket()\n", XCLOGMSG));
"before XC_read_socket()\n", XCLOGMSG));
if (read_socket(display_sock, (char *)&num_cols, sizeof(int)) < 0)
if (XC_read_socket(display_sock, (char *)&num_cols, sizeof(int)) < 0)
XCursesExitXCursesProcess(3, SIGKILL, "exiting from "
"XCursesProcessRequestsFromCurses - first read");
PDC_LOG(("%s:XCursesProcessRequestsFromCurses() - "
"after read_socket()\n", XCLOGMSG));
"after XC_read_socket()\n", XCLOGMSG));
after_first_curses_request = True;
@@ -3062,7 +3062,7 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
case CURSES_CURSOR:
XC_LOG(("CURSES_CURSOR received from child\n"));
if (read_socket(display_sock, buf, sizeof(int) * 2) < 0)
if (XC_read_socket(display_sock, buf, sizeof(int) * 2) < 0)
XCursesExitXCursesProcess(5, SIGKILL,
"exiting from CURSES_CURSOR "
"XCursesProcessRequestsFromCurses");
@@ -3119,12 +3119,12 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
case CURSES_TITLE:
XC_LOG(("CURSES_TITLE received from child\n"));
if (read_socket(display_sock, (char *)&pos, sizeof(int)) < 0)
if (XC_read_socket(display_sock, (char *)&pos, sizeof(int)) < 0)
XCursesExitXCursesProcess(5, SIGKILL,
"exiting from CURSES_TITLE "
"XCursesProcessRequestsFromCurses");
if (read_socket(display_sock, title, pos) < 0)
if (XC_read_socket(display_sock, title, pos) < 0)
XCursesExitXCursesProcess(5, SIGKILL,
"exiting from CURSES_TITLE "
"XCursesProcessRequestsFromCurses");
@@ -3195,7 +3195,7 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
case CURSES_SET_SELECTION:
XC_LOG(("CURSES_SET_SELECTION received from child\n"));
if (read_socket(display_sock, (char *)&length,
if (XC_read_socket(display_sock, (char *)&length,
sizeof(long)) < 0)
XCursesExitXCursesProcess(5, SIGKILL,
"exiting from CURSES_SET_SELECTION "
@@ -3213,13 +3213,13 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
if (!tmpsel)
{
if (write_display_socket_int(PDC_CLIP_MEMORY_ERROR) < 0)
if (XC_write_display_socket_int(PDC_CLIP_MEMORY_ERROR) < 0)
XCursesExitXCursesProcess(4, SIGKILL,
"exiting from XCursesProcessRequestsFromCurses");
break;
}
if (read_socket(display_sock, (char *)tmpsel,
if (XC_read_socket(display_sock, (char *)tmpsel,
length * sizeof(chtype)) < 0)
XCursesExitXCursesProcess(5, SIGKILL,
"exiting from CURSES_SET_SELECTION "
@@ -3241,7 +3241,7 @@ static void XCursesProcessRequestsFromCurses(XtPointer client_data, int *fid,
SelectionOff();
if (write_display_socket_int(old_x) < 0)
if (XC_write_display_socket_int(old_x) < 0)
XCursesExitXCursesProcess(4, SIGKILL,
"exiting from XCursesProcessRequestsFromCurses");
break;
@@ -3523,7 +3523,7 @@ int XCursesSetupX(int argc, char *argv[])
that when the curses process makes a request, the Xcurses
process can service the request.*/
write_display_socket_int(CURSES_CHILD);
XC_write_display_socket_int(CURSES_CHILD);
XtRealizeWidget(topLevel);
@@ -3715,7 +3715,7 @@ static RETSIGTYPE XCursesSignalHandler(int signo)
/* Send a CURSES_EXIT to myself */
if (write_socket(exit_sock, (char *)&flag, sizeof(int)) < 0)
if (XC_write_socket(exit_sock, (char *)&flag, sizeof(int)) < 0)
XCursesExitXCursesProcess(7, signo,
"exiting from XCursesSignalHandler");
}
@@ -3731,7 +3731,7 @@ static void XCursesRequestorCallbackForGetSelection(Widget w, XtPointer data,
if ((value == NULL) && (*length == 0))
{
if (write_display_socket_int(PDC_CLIP_EMPTY) >= 0)
if (XC_write_display_socket_int(PDC_CLIP_EMPTY) >= 0)
return;
}
else
@@ -3739,9 +3739,9 @@ static void XCursesRequestorCallbackForGetSelection(Widget w, XtPointer data,
/* Here all is OK, send PDC_CLIP_SUCCESS, then length, then
contents */
if (write_display_socket_int(PDC_CLIP_SUCCESS) >= 0)
if (write_display_socket_int((int)(*length)) >= 0)
if (write_socket(display_sock, (char *)value, *length) >= 0)
if (XC_write_display_socket_int(PDC_CLIP_SUCCESS) >= 0)
if (XC_write_display_socket_int((int)(*length)) >= 0)
if (XC_write_socket(display_sock, (char *)value, *length) >= 0)
return;
}