Blame view

src/idl/dustem_init_plugins.pro 2.52 KB
759a527d   Ilyes Choubani   general update
1
PRO dustem_init_plugins, pd, fpd
e7938fa3   Ilyes Choubani   Corrected02: Impl...
2

e7938fa3   Ilyes Choubani   Corrected02: Impl...
3

7f2b2149   Jean-Philippe Bernard   a Ilyes
4
plugin_names=['']
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
5
plugind_detect_string='dustem_plugin'
83b3ddee   Jean-Philippe Bernard   modified with Ily...
6
Nplugins=0L
607060e5   Ilyes Choubani   test version
7

7f2b2149   Jean-Philippe Bernard   a Ilyes
8
9
10
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
3c479f24   Ilyes Choubani   Allowing to fix p...
11
        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)    
7f2b2149   Jean-Philippe Bernard   a Ilyes
12
13
14
15
        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]
83b3ddee   Jean-Philippe Bernard   modified with Ily...
16
        Nplugins=Nplugins+1
7f2b2149   Jean-Philippe Bernard   a Ilyes
17
18
    ENDIF
ENDFOR
9e6a6a33   Ilyes Choubani   a JP /BUT HAS FAU...
19

607060e5   Ilyes Choubani   test version
20

3c479f24   Ilyes Choubani   Allowing to fix p...
21
22
23
24
25
26
27
28
29
30
31
32
33
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
607060e5   Ilyes Choubani   test version
34

759a527d   Ilyes Choubani   general update
35

83b3ddee   Jean-Philippe Bernard   modified with Ily...
36
37
38
39
40
41
42
43
44
45
46
47
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

cbf75ef0   Ilyes Choubani   dustem_init_plugi...
48

3c479f24   Ilyes Choubani   Allowing to fix p...
49
50
51
52
53
54
55
56
57
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
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
58
59


4750086c   Ilyes Choubani   nouvelle philosph...
60

3c479f24   Ilyes Choubani   Allowing to fix p...
61
;---------------------------------------------
e7938fa3   Ilyes Choubani   Corrected02: Impl...
62

e7938fa3   Ilyes Choubani   Corrected02: Impl...
63

3c479f24   Ilyes Choubani   Allowing to fix p...
64
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). 
e7938fa3   Ilyes Choubani   Corrected02: Impl...
65

e7938fa3   Ilyes Choubani   Corrected02: Impl...
66

4750086c   Ilyes Choubani   nouvelle philosph...
67
end