New funcref structure is something like `struct func_T {void *func_data; struct func_funcs *functions; <GC vars>};` (former is arbitrary reference with function definition; latter holds references to C functions that actually call various functions, they all always receive func_data). It all can easily be defined statically assuming `struct type1_S {type2_T *data;};` and `struct generictype1_S {void *data;};` are equivalent structures pointers to which can be casted to each other without problems. AFAIK this statement is true. You only need to create dictionary and record these functions there with my suggestion then. Without it can be left in the statically created array; there is no must in keeping built-ins strictly in dictionary like I suggested, only reducing asymptomatic complexity of getting funcref from function name.
diff -r bdbdab08cc4d -r 9ea73172864c src/testdir/test86.in
--- a/src/testdir/test86.in Wed May 15 19:07:47 2013 +0200
+++ b/src/testdir/test86.in Thu May 16 05:49:26 2013 +0400
@@ -7,6 +7,7 @@
STARTTEST
+:lang C
:so small.vim
:if !has('python') | e! test.ok | wq! test.out | endif
:py import vim
@@ -354,7 +355,7 @@
:" colorcolumn: string, window-local
:" statusline: string, window-local/global
:" autoindent: boolean, buffer-local
-:" iminsert: number, buffer-local
+:" shiftwidth: number, buffer-local
:" omnifunc: string, buffer-local
:" preserveindent: boolean, buffer-local/global
:" path: string, buffer-local/global
@@ -411,7 +412,7 @@
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]]
:let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]]
:let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]]
-:let lst+=[['iminsert', 0, 2, 1, 3, 0, 0, 2 ]]
+:let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]]
:let lst+=[['omnifunc', 'A', 'B', 'C', 1, 0, 0, 2 ]]
:let lst+=[['preserveindent', 0, 1, 1, 2, 1, 1, 2 ]]
:let lst+=[['path', '.,,', ',,', '.', 0, 0, 1, 2 ]]
diff -r bdbdab08cc4d -r 9ea73172864c src/testdir/test86.ok
--- a/src/testdir/test86.ok Wed May 15 19:07:47 2013 +0200
+++ b/src/testdir/test86.ok Thu May 16 05:49:26 2013 +0400
@@ -232,7 +232,7 @@
G: 0
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
->>> iminsert
+>>> shiftwidth
p/gopts1! KeyError
inv: 3! KeyError
gopts1! KeyError
@@ -241,15 +241,15 @@
wopts1! KeyError
wopts2! KeyError
wopts3! KeyError
- p/bopts1: 2
- G: 1
- W: 1:0 2:2 3:2 4:1
- B: 1:0 2:2 3:2 4:1
+ p/bopts1: 8
+ G: 8
+ W: 1:0 2:2 3:8 4:1
+ B: 1:0 2:2 3:8 4:1
del wopts3! KeyError
del bopts3! ValueError
- G: 1
- W: 1:0 2:2 3:2 4:1
- B: 1:0 2:2 3:2 4:1
+ G: 8
+ W: 1:0 2:2 3:8 4:1
+ B: 1:0 2:2 3:8 4:1
>>> omnifunc
p/gopts1! KeyError
inv: 1! KeyError
@@ -333,7 +333,7 @@
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
- <window object (unknown)>(0): displays buffer <buffer test86.in>; cursor is at (954, 0)
+ <window object (unknown)>(0): displays buffer <buffer test86.in>; cursor is at (955, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(0): displays buffer <buffer 0>; cursor is at (1, 0)
diff -r bdbdab08cc4d -r 9ea73172864c src/testdir/test87.in
--- a/src/testdir/test87.in Wed May 15 19:07:47 2013 +0200
+++ b/src/testdir/test87.in Thu May 16 05:49:26 2013 +0400
@@ -1,6 +1,7 @@
Tests for various python features. vim: set ft=vim :
STARTTEST
+:lang C
:so small.vim
:if !has('python3') | e! test.ok | wq! test.out | endif
:py3 import vim
@@ -340,7 +341,7 @@
:" colorcolumn: string, window-local
:" statusline: string, window-local/global
:" autoindent: boolean, buffer-local
-:" iminsert: number, buffer-local
+:" shiftwidth: number, buffer-local
:" omnifunc: string, buffer-local
:" preserveindent: boolean, buffer-local/global
:" path: string, buffer-local/global
@@ -397,7 +398,7 @@
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]]
:let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]]
:let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]]
-:let lst+=[['iminsert', 0, 2, 1, 3, 0, 0, 2 ]]
+:let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]]
:let lst+=[['omnifunc', 'A', 'B', 'C', 1, 0, 0, 2 ]]
:let lst+=[['preserveindent', 0, 1, 1, 2, 1, 1, 2 ]]
:let lst+=[['path', '.,,', ',,', '.', 0, 0, 1, 2 ]]
diff -r bdbdab08cc4d -r 9ea73172864c src/testdir/test87.ok
--- a/src/testdir/test87.ok Wed May 15 19:07:47 2013 +0200
+++ b/src/testdir/test87.ok Thu May 16 05:49:26 2013 +0400
@@ -221,7 +221,7 @@
G: 0
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
->>> iminsert
+>>> shiftwidth
p/gopts1! KeyError
inv: 3! KeyError
gopts1! KeyError
@@ -230,15 +230,15 @@
wopts1! KeyError
wopts2! KeyError
wopts3! KeyError
- p/bopts1: 2
- G: 1
- W: 1:0 2:2 3:2 4:1
- B: 1:0 2:2 3:2 4:1
+ p/bopts1: 8
+ G: 8
+ W: 1:0 2:2 3:8 4:1
+ B: 1:0 2:2 3:8 4:1
del wopts3! KeyError
del bopts3! ValueError
- G: 1
- W: 1:0 2:2 3:2 4:1
- B: 1:0 2:2 3:2 4:1
+ G: 8
+ W: 1:0 2:2 3:8 4:1
+ B: 1:0 2:2 3:8 4:1
>>> omnifunc
p/gopts1! KeyError
inv: 1! KeyError
@@ -322,7 +322,7 @@
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
- <window object (unknown)>(0): displays buffer <buffer test87.in>; cursor is at (929, 0)
+ <window object (unknown)>(0): displays buffer <buffer test87.in>; cursor is at (930, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(0): displays buffer <buffer 0>; cursor is at (1, 0)