summaryrefslogtreecommitdiffstats
path: root/funtools/notes/ds9.notes
blob: 2d947d5afe6dffff589c761ef3b02ac63fcce7db (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
		Extensions to Analysis specification syntax
		   to support mainlib (internal) analysis

# add user-specified name/value pair for analysis macro expansion
set LIB $HOME/lib

# xtype: for backward compatibility, default has type=external,
# i.e. execute current sh -c "cmd"
menu
menu xtype=external

#  internal uses mainlib, requires package name and (maybe) shared object name
menu xtype=internal package=funtools source=static
menu xtype=internal package=funtools source=$LIB/libfuntoolsMainLib.dylib

bind x xtype=internal package=funtools source=static
bind x xtype=internal package=funtools source=$LIB/libfuntoolsMainLib.dylib

Notes:

1. set name val

Add user-specified name and value to the macro expansion.  Not
specific to internal processing but will help with shared object pathnames.

2. xtype=internal

Execute a mainlib action by performing macro subsititution, generating
an in-memory FITS file if necessary, and then calling:

	set result [mainlib "command"]

Question: what triggers generation of in-memory FITS? Is it $file or a new
keyword?

3. source=static package=<name>

Valid for xtype=internal only.

Assumes that a routine named <name>MainLibInit() is linked into
ds9. The name and entry point will have to be pre-loaded into a table
so that the entry point for the routine can be looked up and
executed. Calling sequence:

	int nameMainLibInit(void)

returns 1 on success, 0 on failure.

4. source=<shared object> package=<name>

Valid for xtype=internal only.

ds9 must call:

      int MainLibLoad(char *name, char *source,  void **dl, char **ermsg) 

or the Tcl equivalent:

      set dl [mainlibload name source]

to load shared object and call the init routine. This can be done either
when processing the analysis specification or just before executing
the command for the first time.  The returned dl is the handle from
dlopen and can be used with dlclose(), if desired.

5. ds9 will link libfuntools.a into the executable, as usual. 
To access the mainlib support, we can either:

a. link libfuntoolsMainLib.a into the executable and use source=static
in the analysis menu. In this case, the static library is created using:

	make mainlib

and requires --enable-mainlib=yes on the configure command line.

b. we can load libfuntoolsMainLib.[so,dylib] and use source=<shobj>
in the analysis menu. In this case, the dynamic library is created using:

	make shmainlib

and requires --enable-mainlib=shared on the configure command line.

Probably the static method is preferable so that funtools is part of a
single execuable?

6. The LD_LIBRARY_PATH is critical for loading shared libraries. How
will we deal with this? One possibility is to add an argument to MainLibLoad()
to specify a directory which gets added to LD_LIBRARY_PATH before the call
to dlopen()???