diff options
Diffstat (limited to 'src/if_xcmdsrv.c')
-rw-r--r-- | src/if_xcmdsrv.c | 159 |
1 files changed, 69 insertions, 90 deletions
diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c index a758f2b56..0b9b1a819 100644 --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -214,9 +214,9 @@ static char_u *empty_prop = (char_u *)""; /* empty GetRegProp() result */ * Returns FAIL or OK. */ int -serverRegisterName(dpy, name) - Display *dpy; /* display to register with */ - char_u *name; /* the name that will be used as a base */ +serverRegisterName( + Display *dpy, /* display to register with */ + char_u *name) /* the name that will be used as a base */ { int i; int res; @@ -252,9 +252,7 @@ serverRegisterName(dpy, name) } static int -DoRegisterName(dpy, name) - Display *dpy; - char_u *name; +DoRegisterName(Display *dpy, char_u *name) { Window w; XErrorHandler old_handler; @@ -332,9 +330,9 @@ DoRegisterName(dpy, name) * Change any registered window ID. */ void -serverChangeRegisteredWindow(dpy, newwin) - Display *dpy; /* Display to register with */ - Window newwin; /* Re-register to this ID */ +serverChangeRegisteredWindow( + Display *dpy, /* Display to register with */ + Window newwin) /* Re-register to this ID */ { char_u propInfo[MAX_NAME_LENGTH + 20]; @@ -368,15 +366,15 @@ serverChangeRegisteredWindow(dpy, newwin) * Returns 0 for OK, negative for an error. */ int -serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) - Display *dpy; /* Where to send. */ - char_u *name; /* Where to send. */ - char_u *cmd; /* What to send. */ - char_u **result; /* Result of eval'ed expression */ - Window *server; /* Actual ID of receiving app */ - Bool asExpr; /* Interpret as keystrokes or expr ? */ - Bool localLoop; /* Throw away everything but result */ - int silent; /* don't complain about no server */ +serverSendToVim( + Display *dpy, /* Where to send. */ + char_u *name, /* Where to send. */ + char_u *cmd, /* What to send. */ + char_u **result, /* Result of eval'ed expression */ + Window *server, /* Actual ID of receiving app */ + Bool asExpr, /* Interpret as keystrokes or expr ? */ + Bool localLoop, /* Throw away everything but result */ + int silent) /* don't complain about no server */ { Window w; char_u *property; @@ -535,8 +533,7 @@ serverSendToVim(dpy, name, cmd, result, server, asExpr, localLoop, silent) } static int -WaitForPend(p) - void *p; +WaitForPend(void *p) { PendingCommand *pending = (PendingCommand *) p; return pending->result != NULL; @@ -546,9 +543,7 @@ WaitForPend(p) * Return TRUE if window "w" exists and has a "Vim" property on it. */ static int -WindowValid(dpy, w) - Display *dpy; - Window w; +WindowValid(Display *dpy, Window w) { XErrorHandler old_handler; Atom *plist; @@ -577,13 +572,13 @@ WindowValid(dpy, w) * Enter a loop processing X events & polling chars until we see a result */ static void -ServerWait(dpy, w, endCond, endData, localLoop, seconds) - Display *dpy; - Window w; - EndCond endCond; - void *endData; - int localLoop; - int seconds; +ServerWait( + Display *dpy, + Window w, + EndCond endCond, + void *endData, + int localLoop, + int seconds) { time_t start; time_t now; @@ -649,8 +644,7 @@ ServerWait(dpy, w, endCond, endData, localLoop, seconds) * Returns a newline separated list in allocated memory or NULL. */ char_u * -serverGetVimNames(dpy) - Display *dpy; +serverGetVimNames(Display *dpy) { char_u *regProp; char_u *entry; @@ -704,9 +698,7 @@ serverGetVimNames(dpy) */ static struct ServerReply * -ServerReplyFind(w, op) - Window w; - enum ServerReplyOp op; +ServerReplyFind(Window w, enum ServerReplyOp op) { struct ServerReply *p; struct ServerReply e; @@ -748,8 +740,7 @@ ServerReplyFind(w, op) * Issue an error if the id is invalid. */ Window -serverStrToWin(str) - char_u *str; +serverStrToWin(char_u *str) { unsigned id = None; @@ -765,9 +756,7 @@ serverStrToWin(str) * Return -1 if the window is invalid. */ int -serverSendReply(name, str) - char_u *name; - char_u *str; +serverSendReply(char_u *name, char_u *str) { char_u *property; int length; @@ -807,8 +796,7 @@ serverSendReply(name, str) } static int -WaitForReply(p) - void *p; +WaitForReply(void *p) { Window *w = (Window *) p; return ServerReplyFind(*w, SROP_Find) != NULL; @@ -820,11 +808,11 @@ WaitForReply(p) * Return -1 if the window becomes invalid while waiting. */ int -serverReadReply(dpy, win, str, localLoop) - Display *dpy; - Window win; - char_u **str; - int localLoop; +serverReadReply( + Display *dpy, + Window win, + char_u **str, + int localLoop) { int len; char_u *s; @@ -858,10 +846,7 @@ serverReadReply(dpy, win, str, localLoop) * Return TRUE and a non-malloc'ed string if there is. Else return FALSE. */ int -serverPeekReply(dpy, win, str) - Display *dpy; - Window win; - char_u **str; +serverPeekReply(Display *dpy, Window win, char_u **str) { struct ServerReply *p; @@ -882,8 +867,7 @@ serverPeekReply(dpy, win, str) * results. */ static int -SendInit(dpy) - Display *dpy; +SendInit(Display *dpy) { XErrorHandler old_handler; @@ -939,11 +923,11 @@ SendInit(dpy) * removed from the registry property. */ static Window -LookupName(dpy, name, delete, loose) - Display *dpy; /* Display whose registry to check. */ - char_u *name; /* Name of a server. */ - int delete; /* If non-zero, delete info about name. */ - char_u **loose; /* Do another search matching -999 if not found +LookupName( + Display *dpy, /* Display whose registry to check. */ + char_u *name, /* Name of a server. */ + int delete, /* If non-zero, delete info about name. */ + char_u **loose) /* Do another search matching -999 if not found Return result here if a match is found */ { char_u *regProp, *entry; @@ -1033,9 +1017,9 @@ LookupName(dpy, name, delete, loose) * 3. The window will mistakenly be regarded valid because of own commWindow */ static void -DeleteAnyLingerer(dpy, win) - Display *dpy; /* Display whose registry to check. */ - Window win; /* Window to remove */ +DeleteAnyLingerer( + Display *dpy, /* Display whose registry to check. */ + Window win) /* Window to remove */ { char_u *regProp, *entry = NULL; char_u *p; @@ -1095,11 +1079,11 @@ DeleteAnyLingerer(dpy, win) * Return OK when successful. */ static int -GetRegProp(dpy, regPropp, numItemsp, domsg) - Display *dpy; - char_u **regPropp; - long_u *numItemsp; - int domsg; /* When TRUE give error message. */ +GetRegProp( + Display *dpy, + char_u **regPropp, + long_u *numItemsp, + int domsg) /* When TRUE give error message. */ { int result, actualFormat; long_u bytesAfter; @@ -1152,10 +1136,10 @@ GetRegProp(dpy, regPropp, numItemsp, domsg) * response. */ void -serverEventProc(dpy, eventPtr, immediate) - Display *dpy; - XEvent *eventPtr; /* Information about event. */ - int immediate; /* Run event immediately. Should mostly be 0. */ +serverEventProc( + Display *dpy, + XEvent *eventPtr, /* Information about event. */ + int immediate) /* Run event immediately. Should mostly be 0. */ { char_u *propInfo; int result, actualFormat; @@ -1197,9 +1181,7 @@ serverEventProc(dpy, eventPtr, immediate) * vim is idle. */ static void -save_in_queue(propInfo, len) - char_u *propInfo; - long_u len; +save_in_queue(char_u *propInfo, long_u len) { x_queue_T *node; @@ -1226,7 +1208,7 @@ save_in_queue(propInfo, len) * Parses queued clientserver messages. */ void -server_parse_messages() +server_parse_messages(void) { x_queue_T *node; @@ -1247,7 +1229,7 @@ server_parse_messages() * int the queue. */ int -server_waiting() +server_waiting(void) { return head.next != NULL && head.next != &head; } @@ -1258,10 +1240,10 @@ server_waiting() * "propInfo" will be freed. */ static void -server_parse_message(dpy, propInfo, numItems) - Display *dpy; - char_u *propInfo; /* A string containing 0 or more X commands */ - long_u numItems; /* The size of propInfo in bytes. */ +server_parse_message( + Display *dpy, + char_u *propInfo, /* A string containing 0 or more X commands */ + long_u numItems) /* The size of propInfo in bytes. */ { char_u *p; int code; @@ -1539,12 +1521,12 @@ server_parse_message(dpy, propInfo, numItems) * Return: 0 for OK, -1 for error */ static int -AppendPropCarefully(dpy, window, property, value, length) - Display *dpy; /* Display on which to operate. */ - Window window; /* Window whose property is to be modified. */ - Atom property; /* Name of property. */ - char_u *value; /* Characters to append to property. */ - int length; /* How much to append */ +AppendPropCarefully( + Display *dpy, /* Display on which to operate. */ + Window window, /* Window whose property is to be modified. */ + Atom property, /* Name of property. */ + char_u *value, /* Characters to append to property. */ + int length) /* How much to append */ { XErrorHandler old_handler; @@ -1562,9 +1544,7 @@ AppendPropCarefully(dpy, window, property, value, length) * Another X Error handler, just used to check for errors. */ static int -x_error_check(dpy, error_event) - Display *dpy UNUSED; - XErrorEvent *error_event UNUSED; +x_error_check(Display *dpy UNUSED, XErrorEvent *error_event UNUSED) { got_x_error = TRUE; return 0; @@ -1575,8 +1555,7 @@ x_error_check(dpy, error_event) * Actually just checks if the name ends in a digit. */ static int -IsSerialName(str) - char_u *str; +IsSerialName(char_u *str) { int len = STRLEN(str); |