comparison src/netbeans.c @ 27:ce185ac4a252

updated for version 7.0018
author vimboss
date Mon, 11 Oct 2004 10:00:50 +0000
parents 3fc0f57ecb91
children f6033dcbaf31
comparison
equal deleted inserted replaced
26:404aac550f35 27:ce185ac4a252
774 * for function calls, the ! is replaced by a / 774 * for function calls, the ! is replaced by a /
775 */ 775 */
776 static void 776 static void
777 nb_parse_cmd(char_u *cmd) 777 nb_parse_cmd(char_u *cmd)
778 { 778 {
779 char_u *verb; 779 char *verb;
780 char_u *q; 780 char *q;
781 int bufno; 781 int bufno;
782 int isfunc = -1; 782 int isfunc = -1;
783 783
784 if (STRCMP(cmd, "DISCONNECT") == 0) 784 if (STRCMP(cmd, "DISCONNECT") == 0)
785 { 785 {
800 sock_close(sd); 800 sock_close(sd);
801 netbeans_disconnect(); 801 netbeans_disconnect();
802 return; 802 return;
803 } 803 }
804 804
805 bufno = strtol((char *)cmd, (char **)&verb, 10); 805 bufno = strtol((char *)cmd, &verb, 10);
806 806
807 if (*verb != ':') 807 if (*verb != ':')
808 { 808 {
809 EMSG2("E627: missing colon: %s", cmd); 809 EMSG2("E627: missing colon: %s", cmd);
810 return; 810 return;
831 { 831 {
832 EMSG2("E628: missing ! or / in: %s", cmd); 832 EMSG2("E628: missing ! or / in: %s", cmd);
833 return; 833 return;
834 } 834 }
835 835
836 cmdno = strtol((char *)q, (char **)&q, 10); 836 cmdno = strtol(q, &q, 10);
837 837
838 q = skipwhite(q); 838 q = (char *)skipwhite((char_u *)q);
839 839
840 if (nb_do_cmd(bufno, verb, isfunc, cmdno, q) == FAIL) 840 if (nb_do_cmd(bufno, (char_u *)verb, isfunc, cmdno, (char_u *)q) == FAIL)
841 { 841 {
842 nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd)); 842 nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd));
843 EMSG("E629: bad return from nb_do_cmd"); 843 EMSG("E629: bad return from nb_do_cmd");
844 } 844 }
845 } 845 }
1219 int doupdate = 0; 1219 int doupdate = 0;
1220 long off = 0; 1220 long off = 0;
1221 nbbuf_T *buf = nb_get_buf(bufno); 1221 nbbuf_T *buf = nb_get_buf(bufno);
1222 static int skip = 0; 1222 static int skip = 0;
1223 int retval = OK; 1223 int retval = OK;
1224 char *cp; /* for when a char pointer is needed */
1224 1225
1225 nbdebug(("%s %d: (%d) %s %s\n", (func) ? "FUN" : "CMD", cmdno, bufno, cmd, 1226 nbdebug(("%s %d: (%d) %s %s\n", (func) ? "FUN" : "CMD", cmdno, bufno, cmd,
1226 STRCMP(cmd, "insert") == 0 ? "<text>" : (char *)args)); 1227 STRCMP(cmd, "insert") == 0 ? "<text>" : (char *)args));
1227 1228
1228 if (func) 1229 if (func)
1370 netbeansSuppressNoLines = TRUE; 1371 netbeansSuppressNoLines = TRUE;
1371 1372
1372 if (curbuf != buf->bufp) 1373 if (curbuf != buf->bufp)
1373 set_curbuf(buf->bufp, DOBUF_GOTO); 1374 set_curbuf(buf->bufp, DOBUF_GOTO);
1374 wasChanged = buf->bufp->b_changed; 1375 wasChanged = buf->bufp->b_changed;
1375 off = strtol((char *)args, (char **)&args, 10); 1376 cp = (char *)args;
1376 count = strtol((char *)args, (char **)&args, 10); 1377 off = strtol(cp, &cp, 10);
1378 count = strtol(cp, &cp, 10);
1379 args = (char_u *)cp;
1377 /* delete "count" chars, starting at "off" */ 1380 /* delete "count" chars, starting at "off" */
1378 pos = off2pos(buf->bufp, off); 1381 pos = off2pos(buf->bufp, off);
1379 if (!pos) 1382 if (!pos)
1380 { 1383 {
1381 nb_reply_text(cmdno, (char_u *)"!bad position"); 1384 nb_reply_text(cmdno, (char_u *)"!bad position");
1455 nb_reply_nil(cmdno); 1458 nb_reply_nil(cmdno);
1456 return OK; 1459 return OK;
1457 } 1460 }
1458 1461
1459 /* get offset */ 1462 /* get offset */
1460 off = strtol((char *)args, (char **)&args, 10); 1463 cp = (char *)args;
1464 off = strtol(cp, &cp, 10);
1465 args = (char_u *)cp;
1461 1466
1462 /* get text to be inserted */ 1467 /* get text to be inserted */
1463 args = skipwhite(args); 1468 args = skipwhite(args);
1464 args = to_free = (char_u *)nb_unquote(args, NULL); 1469 args = to_free = (char_u *)nb_unquote(args, NULL);
1465 1470
1925 /* =====================================================================*/ 1930 /* =====================================================================*/
1926 } 1931 }
1927 else if (streq((char *)cmd, "setExitDelay")) 1932 else if (streq((char *)cmd, "setExitDelay"))
1928 { 1933 {
1929 /* New in version 2.1. */ 1934 /* New in version 2.1. */
1930 exit_delay = strtol((char *)args, (char **)&args, 10); 1935 cp = (char *)args;
1936 exit_delay = strtol(cp, &cp, 10);
1937 args = (char_u *)cp;
1931 /* =====================================================================*/ 1938 /* =====================================================================*/
1932 } 1939 }
1933 else if (streq((char *)cmd, "defineAnnoType")) 1940 else if (streq((char *)cmd, "defineAnnoType"))
1934 { 1941 {
1935 #ifdef FEAT_SIGNS 1942 #ifdef FEAT_SIGNS
1947 { 1954 {
1948 EMSG("E650: null buf in defineAnnoType"); 1955 EMSG("E650: null buf in defineAnnoType");
1949 return FAIL; 1956 return FAIL;
1950 } 1957 }
1951 1958
1952 typeNum = strtol((char *)args, (char **)&args, 10); 1959 cp = (char *)args;
1960 typeNum = strtol(cp, &cp, 10);
1961 args = (char_u *)cp;
1953 args = skipwhite(args); 1962 args = skipwhite(args);
1954 typeName = (char_u *)nb_unquote(args, &args); 1963 typeName = (char_u *)nb_unquote(args, &args);
1955 args = skipwhite(args + 1); 1964 args = skipwhite(args + 1);
1956 tooltip = (char_u *)nb_unquote(args, &args); 1965 tooltip = (char_u *)nb_unquote(args, &args);
1957 args = skipwhite(args + 1); 1966 args = skipwhite(args + 1);
1964 if (STRNCMP(args, "none", 4) == 0) 1973 if (STRNCMP(args, "none", 4) == 0)
1965 args += 5; 1974 args += 5;
1966 else 1975 else
1967 { 1976 {
1968 use_fg = 1; 1977 use_fg = 1;
1969 fg = strtol((char *)args, (char **)&args, 10); 1978 cp = (char *)args;
1979 fg = strtol(cp, &cp, 10);
1980 args = (char_u *)cp;
1970 } 1981 }
1971 if (STRNCMP(args, "none", 4) == 0) 1982 if (STRNCMP(args, "none", 4) == 0)
1972 args += 5; 1983 args += 5;
1973 else 1984 else
1974 { 1985 {
1975 use_bg = 1; 1986 use_bg = 1;
1976 bg = strtol((char *)args, (char **)&args, 10); 1987 cp = (char *)args;
1988 bg = strtol(cp, &cp, 10);
1989 args = (char_u *)cp;
1977 } 1990 }
1978 if (typeName != NULL && tooltip != NULL && glyphFile != NULL) 1991 if (typeName != NULL && tooltip != NULL && glyphFile != NULL)
1979 addsigntype(buf, typeNum, typeName, tooltip, glyphFile, 1992 addsigntype(buf, typeNum, typeName, tooltip, glyphFile,
1980 use_fg, fg, use_bg, bg); 1993 use_fg, fg, use_bg, bg);
1981 else 1994 else
2005 return FAIL; 2018 return FAIL;
2006 } 2019 }
2007 2020
2008 doupdate = 1; 2021 doupdate = 1;
2009 2022
2010 serNum = strtol((char *)args, (char **)&args, 10); 2023 cp = (char *)args;
2024 serNum = strtol(cp, &cp, 10);
2011 2025
2012 /* Get the typenr specific for this buffer and convert it to 2026 /* Get the typenr specific for this buffer and convert it to
2013 * the global typenumber, as used for the sign name. */ 2027 * the global typenumber, as used for the sign name. */
2014 localTypeNum = strtol((char *)args, (char **)&args, 10); 2028 localTypeNum = strtol(cp, &cp, 10);
2029 args = (char_u *)cp;
2015 typeNum = mapsigntype(buf, localTypeNum); 2030 typeNum = mapsigntype(buf, localTypeNum);
2016 2031
2017 pos = get_off_or_lnum(buf->bufp, &args); 2032 pos = get_off_or_lnum(buf->bufp, &args);
2018 2033
2034 cp = (char *)args;
2019 # ifdef NBDEBUG 2035 # ifdef NBDEBUG
2020 len = 2036 len =
2021 # endif 2037 # endif
2022 strtol((char *)args, (char **)&args, 10); 2038 strtol(cp, &cp, 10);
2039 args = (char_u *)cp;
2023 # ifdef NBDEBUG 2040 # ifdef NBDEBUG
2024 if (len != -1) 2041 if (len != -1)
2025 { 2042 {
2026 nbdebug((" partial line annotation -- Not Yet Implemented!")); 2043 nbdebug((" partial line annotation -- Not Yet Implemented!"));
2027 } 2044 }
2053 { 2070 {
2054 nbdebug((" null bufp in removeAnno")); 2071 nbdebug((" null bufp in removeAnno"));
2055 return FAIL; 2072 return FAIL;
2056 } 2073 }
2057 doupdate = 1; 2074 doupdate = 1;
2058 serNum = strtol((char *)args, (char **)&args, 10); 2075 cp = (char *)args;
2076 serNum = strtol(cp, &cp, 10);
2077 args = (char_u *)cp;
2059 coloncmd(":sign unplace %d buffer=%d", 2078 coloncmd(":sign unplace %d buffer=%d",
2060 serNum, buf->bufp->b_fnum); 2079 serNum, buf->bufp->b_fnum);
2061 redraw_buf_later(buf->bufp, NOT_VALID); 2080 redraw_buf_later(buf->bufp, NOT_VALID);
2062 #endif 2081 #endif
2063 /* =====================================================================*/ 2082 /* =====================================================================*/
2091 nbdebug((" null bufp in %s command", cmd)); 2110 nbdebug((" null bufp in %s command", cmd));
2092 return FAIL; 2111 return FAIL;
2093 } 2112 }
2094 if (curbuf != buf->bufp) 2113 if (curbuf != buf->bufp)
2095 set_curbuf(buf->bufp, DOBUF_GOTO); 2114 set_curbuf(buf->bufp, DOBUF_GOTO);
2096 off = strtol((char *)args, (char **)&args, 10); 2115 cp = (char *)args;
2097 len = strtol((char *)args, 0, 10); 2116 off = strtol(cp, &cp, 10);
2117 len = strtol(cp, NULL, 10);
2118 args = (char_u *)cp;
2098 pos = off2pos(buf->bufp, off); 2119 pos = off2pos(buf->bufp, off);
2099 doupdate = 1; 2120 doupdate = 1;
2100 if (!pos) 2121 if (!pos)
2101 nbdebug((" no such start pos in %s, %ld\n", cmd, off)); 2122 nbdebug((" no such start pos in %s, %ld\n", cmd, off));
2102 else 2123 else