Mercurial > vim
comparison src/userfunc.c @ 18104:e59ff7b5d7a7 v8.1.2047
patch 8.1.2047: cannot check the current state
Commit: https://github.com/vim/vim/commit/0e57dd859ecb1e8a3b91509d2f4343e839340eb8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 16 22:56:03 2019 +0200
patch 8.1.2047: cannot check the current state
Problem: Cannot check the current state.
Solution: Add the state() function.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 16 Sep 2019 23:00:04 +0200 |
parents | 6249953b0609 |
children | fe5afdc03bd2 |
comparison
equal
deleted
inserted
replaced
18103:71bc51a0d8d8 | 18104:e59ff7b5d7a7 |
---|---|
1445 clear_tv(&argv[--argc]); | 1445 clear_tv(&argv[--argc]); |
1446 | 1446 |
1447 return r; | 1447 return r; |
1448 } | 1448 } |
1449 | 1449 |
1450 static int callback_depth = 0; | |
1451 | |
1452 int | |
1453 get_callback_depth(void) | |
1454 { | |
1455 return callback_depth; | |
1456 } | |
1457 | |
1450 /* | 1458 /* |
1451 * Invoke call_func() with a callback. | 1459 * Invoke call_func() with a callback. |
1452 */ | 1460 */ |
1453 int | 1461 int |
1454 call_callback( | 1462 call_callback( |
1458 int argcount, // number of "argvars" | 1466 int argcount, // number of "argvars" |
1459 typval_T *argvars) // vars for arguments, must have "argcount" | 1467 typval_T *argvars) // vars for arguments, must have "argcount" |
1460 // PLUS ONE elements! | 1468 // PLUS ONE elements! |
1461 { | 1469 { |
1462 funcexe_T funcexe; | 1470 funcexe_T funcexe; |
1471 int ret; | |
1463 | 1472 |
1464 vim_memset(&funcexe, 0, sizeof(funcexe)); | 1473 vim_memset(&funcexe, 0, sizeof(funcexe)); |
1465 funcexe.evaluate = TRUE; | 1474 funcexe.evaluate = TRUE; |
1466 funcexe.partial = callback->cb_partial; | 1475 funcexe.partial = callback->cb_partial; |
1467 return call_func(callback->cb_name, len, rettv, argcount, argvars, | 1476 ++callback_depth; |
1468 &funcexe); | 1477 ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe); |
1478 --callback_depth; | |
1479 return ret; | |
1469 } | 1480 } |
1470 | 1481 |
1471 /* | 1482 /* |
1472 * Call a function with its resolved parameters | 1483 * Call a function with its resolved parameters |
1473 * | 1484 * |