Mercurial > vim
comparison src/eval.c @ 795:86ce35c9750f v7.0231
updated for version 7.0231
author | vimboss |
---|---|
date | Tue, 21 Mar 2006 21:33:03 +0000 |
parents | 98a88a884610 |
children | 95dac6af3b3a |
comparison
equal
deleted
inserted
replaced
794:f19994020dad | 795:86ce35c9750f |
---|---|
581 static void f_prevnonblank __ARGS((typval_T *argvars, typval_T *rettv)); | 581 static void f_prevnonblank __ARGS((typval_T *argvars, typval_T *rettv)); |
582 static void f_printf __ARGS((typval_T *argvars, typval_T *rettv)); | 582 static void f_printf __ARGS((typval_T *argvars, typval_T *rettv)); |
583 static void f_pumvisible __ARGS((typval_T *argvars, typval_T *rettv)); | 583 static void f_pumvisible __ARGS((typval_T *argvars, typval_T *rettv)); |
584 static void f_range __ARGS((typval_T *argvars, typval_T *rettv)); | 584 static void f_range __ARGS((typval_T *argvars, typval_T *rettv)); |
585 static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv)); | 585 static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv)); |
586 static void f_reltime __ARGS((typval_T *argvars, typval_T *rettv)); | |
587 static void f_reltimestr __ARGS((typval_T *argvars, typval_T *rettv)); | |
586 static void f_remote_expr __ARGS((typval_T *argvars, typval_T *rettv)); | 588 static void f_remote_expr __ARGS((typval_T *argvars, typval_T *rettv)); |
587 static void f_remote_foreground __ARGS((typval_T *argvars, typval_T *rettv)); | 589 static void f_remote_foreground __ARGS((typval_T *argvars, typval_T *rettv)); |
588 static void f_remote_peek __ARGS((typval_T *argvars, typval_T *rettv)); | 590 static void f_remote_peek __ARGS((typval_T *argvars, typval_T *rettv)); |
589 static void f_remote_read __ARGS((typval_T *argvars, typval_T *rettv)); | 591 static void f_remote_read __ARGS((typval_T *argvars, typval_T *rettv)); |
590 static void f_remote_send __ARGS((typval_T *argvars, typval_T *rettv)); | 592 static void f_remote_send __ARGS((typval_T *argvars, typval_T *rettv)); |
7030 {"prevnonblank", 1, 1, f_prevnonblank}, | 7032 {"prevnonblank", 1, 1, f_prevnonblank}, |
7031 {"printf", 2, 19, f_printf}, | 7033 {"printf", 2, 19, f_printf}, |
7032 {"pumvisible", 0, 0, f_pumvisible}, | 7034 {"pumvisible", 0, 0, f_pumvisible}, |
7033 {"range", 1, 3, f_range}, | 7035 {"range", 1, 3, f_range}, |
7034 {"readfile", 1, 3, f_readfile}, | 7036 {"readfile", 1, 3, f_readfile}, |
7037 {"reltime", 0, 2, f_reltime}, | |
7038 {"reltimestr", 1, 1, f_reltimestr}, | |
7035 {"remote_expr", 2, 3, f_remote_expr}, | 7039 {"remote_expr", 2, 3, f_remote_expr}, |
7036 {"remote_foreground", 1, 1, f_remote_foreground}, | 7040 {"remote_foreground", 1, 1, f_remote_foreground}, |
7037 {"remote_peek", 1, 2, f_remote_peek}, | 7041 {"remote_peek", 1, 2, f_remote_peek}, |
7038 {"remote_read", 1, 1, f_remote_read}, | 7042 {"remote_read", 1, 1, f_remote_read}, |
7039 {"remote_send", 2, 3, f_remote_send}, | 7043 {"remote_send", 2, 3, f_remote_send}, |
8980 do | 8984 do |
8981 { | 8985 { |
8982 vim_free(fresult); | 8986 vim_free(fresult); |
8983 fresult = find_file_in_path_option(first ? fname : NULL, | 8987 fresult = find_file_in_path_option(first ? fname : NULL, |
8984 first ? (int)STRLEN(fname) : 0, | 8988 first ? (int)STRLEN(fname) : 0, |
8985 0, first, path, dir, NULL); | 8989 0, first, path, dir, NULL, |
8990 dir ? (char_u *)"" : curbuf->b_p_sua); | |
8986 first = FALSE; | 8991 first = FALSE; |
8987 } while (--count > 0 && fresult != NULL); | 8992 } while (--count > 0 && fresult != NULL); |
8988 } | 8993 } |
8989 | 8994 |
8990 rettv->vval.v_string = fresult; | 8995 rettv->vval.v_string = fresult; |
10595 #ifdef FEAT_PRINTER | 10600 #ifdef FEAT_PRINTER |
10596 "printer", | 10601 "printer", |
10597 #endif | 10602 #endif |
10598 #ifdef FEAT_PROFILE | 10603 #ifdef FEAT_PROFILE |
10599 "profile", | 10604 "profile", |
10605 #endif | |
10606 #ifdef FEAT_RELTIME | |
10607 "reltime", | |
10600 #endif | 10608 #endif |
10601 #ifdef FEAT_QUICKFIX | 10609 #ifdef FEAT_QUICKFIX |
10602 "quickfix", | 10610 "quickfix", |
10603 #endif | 10611 #endif |
10604 #ifdef FEAT_RIGHTLEFT | 10612 #ifdef FEAT_RIGHTLEFT |
12633 | 12641 |
12634 vim_free(prev); | 12642 vim_free(prev); |
12635 fclose(fd); | 12643 fclose(fd); |
12636 } | 12644 } |
12637 | 12645 |
12646 #if defined(FEAT_RELTIME) | |
12647 static int list2proftime __ARGS((typval_T *arg, proftime_T *tm)); | |
12648 | |
12649 /* | |
12650 * Convert a List to proftime_T. | |
12651 * Return FAIL when there is something wrong. | |
12652 */ | |
12653 static int | |
12654 list2proftime(arg, tm) | |
12655 typval_T *arg; | |
12656 proftime_T *tm; | |
12657 { | |
12658 long n1, n2; | |
12659 int error = FALSE; | |
12660 | |
12661 if (arg->v_type != VAR_LIST || arg->vval.v_list == NULL | |
12662 || arg->vval.v_list->lv_len != 2) | |
12663 return FAIL; | |
12664 n1 = list_find_nr(arg->vval.v_list, 0L, &error); | |
12665 n2 = list_find_nr(arg->vval.v_list, 1L, &error); | |
12666 # ifdef WIN3264 | |
12667 tm->QuadPart = (n1 << 32) + n2; | |
12668 # else | |
12669 tm->tv_sec = n1; | |
12670 tm->tv_usec = n2; | |
12671 # endif | |
12672 return error ? FAIL : OK; | |
12673 } | |
12674 #endif /* FEAT_RELTIME */ | |
12675 | |
12676 /* | |
12677 * "reltime()" function | |
12678 */ | |
12679 static void | |
12680 f_reltime(argvars, rettv) | |
12681 typval_T *argvars; | |
12682 typval_T *rettv; | |
12683 { | |
12684 #ifdef FEAT_RELTIME | |
12685 proftime_T res; | |
12686 proftime_T start; | |
12687 | |
12688 if (argvars[0].v_type == VAR_UNKNOWN) | |
12689 { | |
12690 /* No arguments: get current time. */ | |
12691 profile_start(&res); | |
12692 } | |
12693 else if (argvars[1].v_type == VAR_UNKNOWN) | |
12694 { | |
12695 if (list2proftime(&argvars[0], &res) == FAIL) | |
12696 return; | |
12697 profile_end(&res); | |
12698 } | |
12699 else | |
12700 { | |
12701 /* Two arguments: compute the difference. */ | |
12702 if (list2proftime(&argvars[0], &start) == FAIL | |
12703 || list2proftime(&argvars[1], &res) == FAIL) | |
12704 return; | |
12705 profile_sub(&res, &start); | |
12706 } | |
12707 | |
12708 if (rettv_list_alloc(rettv) == OK) | |
12709 { | |
12710 long n1, n2; | |
12711 | |
12712 # ifdef WIN3264 | |
12713 n1 = res.QuadPart >> 32; | |
12714 n2 = res.QuadPart & 0xffffffff; | |
12715 # else | |
12716 n1 = res.tv_sec; | |
12717 n2 = res.tv_usec; | |
12718 # endif | |
12719 list_append_number(rettv->vval.v_list, (varnumber_T)n1); | |
12720 list_append_number(rettv->vval.v_list, (varnumber_T)n2); | |
12721 } | |
12722 #endif | |
12723 } | |
12724 | |
12725 /* | |
12726 * "reltimestr()" function | |
12727 */ | |
12728 static void | |
12729 f_reltimestr(argvars, rettv) | |
12730 typval_T *argvars; | |
12731 typval_T *rettv; | |
12732 { | |
12733 #ifdef FEAT_RELTIME | |
12734 proftime_T tm; | |
12735 #endif | |
12736 | |
12737 rettv->v_type = VAR_STRING; | |
12738 rettv->vval.v_string = NULL; | |
12739 #ifdef FEAT_RELTIME | |
12740 if (list2proftime(&argvars[0], &tm) == OK) | |
12741 rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); | |
12742 #endif | |
12743 } | |
12638 | 12744 |
12639 #if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) | 12745 #if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) |
12640 static void make_connection __ARGS((void)); | 12746 static void make_connection __ARGS((void)); |
12641 static int check_connection __ARGS((void)); | 12747 static int check_connection __ARGS((void)); |
12642 | 12748 |
15096 EMSG(_("E677: Error writing temp file")); | 15202 EMSG(_("E677: Error writing temp file")); |
15097 goto done; | 15203 goto done; |
15098 } | 15204 } |
15099 } | 15205 } |
15100 | 15206 |
15101 res = get_cmd_output(get_tv_string(&argvars[0]), infile, SHELL_SILENT); | 15207 res = get_cmd_output(get_tv_string(&argvars[0]), infile, |
15208 SHELL_SILENT | SHELL_COOKED); | |
15102 | 15209 |
15103 #ifdef USE_CR | 15210 #ifdef USE_CR |
15104 /* translate <CR> into <NL> */ | 15211 /* translate <CR> into <NL> */ |
15105 if (res != NULL) | 15212 if (res != NULL) |
15106 { | 15213 { |