Mercurial > vim
comparison src/eval.c @ 1228:5eb1ac6f92ad v7.1b
updated for version 7.1b
author | vimboss |
---|---|
date | Thu, 10 May 2007 19:30:25 +0000 |
parents | c9b7b1e711d1 |
children | 3ae106044109 |
comparison
equal
deleted
inserted
replaced
1227:40943ccdf160 | 1228:5eb1ac6f92ad |
---|---|
1904 else | 1904 else |
1905 return skip_var_one(arg); | 1905 return skip_var_one(arg); |
1906 } | 1906 } |
1907 | 1907 |
1908 /* | 1908 /* |
1909 * Skip one (assignable) variable name, includig @r, $VAR, &option, d.key, | 1909 * Skip one (assignable) variable name, including @r, $VAR, &option, d.key, |
1910 * l[idx]. | 1910 * l[idx]. |
1911 */ | 1911 */ |
1912 static char_u * | 1912 static char_u * |
1913 skip_var_one(arg) | 1913 skip_var_one(arg) |
1914 char_u *arg; | 1914 char_u *arg; |
4504 } | 4504 } |
4505 | 4505 |
4506 /* | 4506 /* |
4507 * Handle sixth level expression: | 4507 * Handle sixth level expression: |
4508 * number number constant | 4508 * number number constant |
4509 * "string" string contstant | 4509 * "string" string constant |
4510 * 'string' literal string contstant | 4510 * 'string' literal string constant |
4511 * &option-name option value | 4511 * &option-name option value |
4512 * @r register contents | 4512 * @r register contents |
4513 * identifier variable value | 4513 * identifier variable value |
4514 * function() function call | 4514 * function() function call |
4515 * $VAR environment variable | 4515 * $VAR environment variable |
7016 { | 7016 { |
7017 char *f_name; /* function name */ | 7017 char *f_name; /* function name */ |
7018 char f_min_argc; /* minimal number of arguments */ | 7018 char f_min_argc; /* minimal number of arguments */ |
7019 char f_max_argc; /* maximal number of arguments */ | 7019 char f_max_argc; /* maximal number of arguments */ |
7020 void (*f_func) __ARGS((typval_T *args, typval_T *rvar)); | 7020 void (*f_func) __ARGS((typval_T *args, typval_T *rvar)); |
7021 /* implemenation of function */ | 7021 /* implementation of function */ |
7022 } functions[] = | 7022 } functions[] = |
7023 { | 7023 { |
7024 {"add", 2, 2, f_add}, | 7024 {"add", 2, 2, f_add}, |
7025 {"append", 2, 2, f_append}, | 7025 {"append", 2, 2, f_append}, |
7026 {"argc", 0, 0, f_argc}, | 7026 {"argc", 0, 0, f_argc}, |
20666 static int shortpath_for_invalid_fname __ARGS((char_u **fname, char_u **bufp, int *fnamelen)); | 20666 static int shortpath_for_invalid_fname __ARGS((char_u **fname, char_u **bufp, int *fnamelen)); |
20667 static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen)); | 20667 static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen)); |
20668 | 20668 |
20669 /* | 20669 /* |
20670 * Get the short pathname of a file. | 20670 * Get the short pathname of a file. |
20671 * Returns 1 on success. *fnamelen is 0 for nonexistant path. | 20671 * Returns 1 on success. *fnamelen is 0 for nonexistent path. |
20672 */ | 20672 */ |
20673 static int | 20673 static int |
20674 get_short_pathname(fnamep, bufp, fnamelen) | 20674 get_short_pathname(fnamep, bufp, fnamelen) |
20675 char_u **fnamep; | 20675 char_u **fnamep; |
20676 char_u **bufp; | 20676 char_u **bufp; |
20733 --plen; | 20733 --plen; |
20734 } | 20734 } |
20735 | 20735 |
20736 do | 20736 do |
20737 { | 20737 { |
20738 /* Go back one path-seperator */ | 20738 /* Go back one path-separator */ |
20739 while (s > pbuf2 && !after_pathsep(pbuf2, s + 1)) | 20739 while (s > pbuf2 && !after_pathsep(pbuf2, s + 1)) |
20740 { | 20740 { |
20741 --s; | 20741 --s; |
20742 ++slen; | 20742 ++slen; |
20743 --plen; | 20743 --plen; |
20744 } | 20744 } |
20745 if (s <= pbuf2) | 20745 if (s <= pbuf2) |
20746 break; | 20746 break; |
20747 | 20747 |
20748 /* Remeber the character that is about to be blatted */ | 20748 /* Remember the character that is about to be splatted */ |
20749 ch = *s; | 20749 ch = *s; |
20750 *s = 0; /* get_short_pathname requires a null-terminated string */ | 20750 *s = 0; /* get_short_pathname requires a null-terminated string */ |
20751 | 20751 |
20752 /* Try it in situ */ | 20752 /* Try it in situ */ |
20753 p = pbuf2; | 20753 p = pbuf2; |
20759 *s = ch; /* Preserve the string */ | 20759 *s = ch; /* Preserve the string */ |
20760 } while (plen == 0); | 20760 } while (plen == 0); |
20761 | 20761 |
20762 if (plen > 0) | 20762 if (plen > 0) |
20763 { | 20763 { |
20764 /* Remeber the length of the new string. */ | 20764 /* Remember the length of the new string. */ |
20765 *fnamelen = len = plen + slen; | 20765 *fnamelen = len = plen + slen; |
20766 vim_free(*bufp); | 20766 vim_free(*bufp); |
20767 if (len > len2) | 20767 if (len > len2) |
20768 { | 20768 { |
20769 /* If there's not enough space in the currently allocated string, | 20769 /* If there's not enough space in the currently allocated string, |