win-plot-refs.c - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/win-plot-refs.c
blob: 3dbd4dd90d9f46685e5df1422d716c52d39a0f18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

#include <lua.h>
#include <lauxlib.h>
#include "lua-defs.h"
#include "refs.h"
#include "win-plot-refs.h"
static char const * const window_plot_ref_table_name = "GSL.winpltrefs";
void
window_plot_ref_prepare (lua_State *L)
{
 register_ref_table (L, window_plot_ref_table_name);
}
void
window_plot_ref_add (lua_State *L, int slot_id, int window_index, int plot_index)
{
 INDEX_SET_ABS_2(L, window_index, plot_index);
 lua_getfield (L, LUA_REGISTRYINDEX, window_plot_ref_table_name);
 lua_pushvalue (L, window_index);
 lua_rawget (L, -2);
 if (lua_isnil (L, -1))
 {
 lua_pop (L, 1);
 lua_newtable (L);
 lua_pushvalue (L, plot_index);
 lua_rawseti (L, -2, slot_id);
 lua_pushvalue (L, window_index);
 lua_insert (L, -2);
 lua_rawset (L, -3);
 }
 else
 {
 lua_pushvalue (L, plot_index);
 lua_rawseti (L, -2, slot_id);
 }
 lua_pop (L, 2);
}
void
window_plot_ref_remove (lua_State *L, int slot_id, int window_index)
{
 INDEX_SET_ABS(L, window_index);
 lua_getfield (L, LUA_REGISTRYINDEX, window_plot_ref_table_name);
 lua_pushvalue (L, window_index);
 lua_rawget (L, -2);
 if (! lua_isnil (L, -1))
 {
 lua_pushnil (L);
 lua_rawseti (L, -2, slot_id);
 }
 lua_pop (L, 2);
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月27日 11:48:54 +0000

AltStyle によって変換されたページ (->オリジナル) /