aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tedit/display/curses/bindstruct.x
blob: f9502c3da085c806b4b488e1028b9dde0014d248 (plain) (blame)
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
include "../curses.h"
include "window.h"

# BINDSTRUCT -- Bind a data structure and function to a window

procedure bindstruct (func, structure)

extern	func		# i: Input function
pointer	structure	# i: Data structure
#--

begin
	call wbindstruct (STDSCR, func, structure)
end

procedure wbindstruct (win, func, structure)

int	win		# i: Window descriptor
extern	func		# i: Input function
pointer	structure	# i: Data structure
#--
include "window.com"

pointer	pwin
pointer	locpr()

begin
	pwin = warray[win]
	if (WIN_DATA(pwin) != NULL)
	    call mfree (WIN_DATA(pwin), TY_STRUCT)

	WIN_FUNC(pwin) = locpr (func)
	WIN_DATA(pwin) = structure

end