Mercurial > vim
comparison src/eval.c @ 453:3ffdc64af1e5 v7.0120
updated for version 7.0120
author | vimboss |
---|---|
date | Sat, 30 Jul 2005 22:45:36 +0000 |
parents | 3709cf52b9b5 |
children | 3b705e71c7b0 |
comparison
equal
deleted
inserted
replaced
452:01af1008a8d8 | 453:3ffdc64af1e5 |
---|---|
1403 | 1403 |
1404 return ret; | 1404 return ret; |
1405 } | 1405 } |
1406 | 1406 |
1407 /* | 1407 /* |
1408 * Call some vimL function and return the result as a string | 1408 * Call vimL function "func" and return the result as a string. |
1409 * Returns NULL when calling the function fails. | |
1409 * Uses argv[argc] for the function arguments. | 1410 * Uses argv[argc] for the function arguments. |
1410 */ | 1411 */ |
1411 void * | 1412 void * |
1412 call_func_retstr(func, argc, argv, safe) | 1413 call_func_retstr(func, argc, argv, safe) |
1413 char_u *func; | 1414 char_u *func; |
1414 int argc; | 1415 int argc; |
1415 char_u **argv; | 1416 char_u **argv; |
1416 int safe; /* use the sandbox */ | 1417 int safe; /* use the sandbox */ |
1417 { | 1418 { |
1418 typval_T rettv; | 1419 typval_T rettv; |
1419 char_u *retval = NULL; | 1420 char_u *retval; |
1420 | 1421 |
1421 if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL) | 1422 if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL) |
1422 return NULL; | 1423 return NULL; |
1423 | 1424 |
1424 retval = vim_strsave(get_tv_string(&rettv)); | 1425 retval = vim_strsave(get_tv_string(&rettv)); |
1425 | |
1426 clear_tv(&rettv); | 1426 clear_tv(&rettv); |
1427 | |
1428 return retval; | 1427 return retval; |
1429 } | 1428 } |
1430 | 1429 |
1431 /* | 1430 #if defined(FEAT_COMPL_FUNC) || defined(PROTO) |
1432 * Call some vimL function and return the result as a list | 1431 /* |
1432 * Call vimL function "func" and return the result as a number. | |
1433 * Returns -1 when calling the function fails. | |
1434 * Uses argv[argc] for the function arguments. | |
1435 */ | |
1436 long | |
1437 call_func_retnr(func, argc, argv, safe) | |
1438 char_u *func; | |
1439 int argc; | |
1440 char_u **argv; | |
1441 int safe; /* use the sandbox */ | |
1442 { | |
1443 typval_T rettv; | |
1444 long retval; | |
1445 | |
1446 if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL) | |
1447 return -1; | |
1448 | |
1449 retval = get_tv_number_chk(&rettv, NULL); | |
1450 clear_tv(&rettv); | |
1451 return retval; | |
1452 } | |
1453 #endif | |
1454 | |
1455 /* | |
1456 * Call vimL function "func" and return the result as a list | |
1433 * Uses argv[argc] for the function arguments. | 1457 * Uses argv[argc] for the function arguments. |
1434 */ | 1458 */ |
1435 void * | 1459 void * |
1436 call_func_retlist(func, argc, argv, safe) | 1460 call_func_retlist(func, argc, argv, safe) |
1437 char_u *func; | 1461 char_u *func; |