dustem_init_plugins.pro
2.52 KB
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
PRO dustem_init_plugins, pd, fpd
plugin_names=['']
plugind_detect_string='dustem_plugin'
Nplugins=0L
for i=0L,n_elements(pd)-1 do begin
fi=strtrim(strmid(pd(i),0,strlen(plugind_detect_string)),2)
if fi eq plugind_detect_string then begin
ftn = strmid(pd(i),0);strmid((*(*!dustem_fit).param_descs)(i),0) ;Try replacing this ;String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)
ii = strsplit(ftn,'_',count=countx)
ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
plugin_names=[plugin_names,ftn]
Nplugins=Nplugins+1
ENDIF
ENDFOR
IF KEYWORD_SET(fpd) THEN BEGIN
for i=0L,n_elements(fpd)-1 do begin
fi=strtrim(strmid(fpd(i),0,strlen(plugind_detect_string)),2)
if fi eq plugind_detect_string then begin
ftn = strmid(fpd(i),0) ; String containing the name of the plugin and the keyword used (ie: dustem_create_continuum_2)
ii = strsplit(ftn,'_',count=countx)
ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword
ftn = strmid(ftn,14,ii-14) ; String containing the name of the plugin without the associated keyword
plugin_names=[plugin_names,ftn]
Nplugins+=1
ENDIF
ENDFOR
ENDIF
IF Nplugins EQ 0 THEN BEGIN
plugin_names=['NONE']
Nplugins=1
ENDIF ELSE BEGIN
plugin_names=plugin_names[1:*]
order=sort(plugin_names)
plugin_names=plugin_names[order]
un=uniq(plugin_names)
plugin_names=plugin_names[un]
Nplugins=n_elements(plugin_names)
ENDELSE
IF Nplugins NE 0 THEN BEGIN
for i=0L, Nplugins-1 do begin
If i EQ 0 then begin ;probably won't need the freezing part.
strct = create_struct(plugin_names(i),{spec:ptr_new(),scope:ptr_new(),paramtag:ptr_new()});,freeze:{key:ptr_new(),val:ptr_new()}})
endif else begin ;IF i GE 1
strct = create_struct(strct,plugin_names(i),{spec:ptr_new(),scope:ptr_new(),paramtag:ptr_new()});,freeze:{key:ptr_new(),val:ptr_new()}})
endelse
ENDFOR
ENDIF
;---------------------------------------------
defsysv, '!dustem_plugin', ptr_new(strct) ; Need the use of the pointer because dustem_init_plugins is called in dustem_init (avoid conflicting structures error).
end