1 | #=============================================================================== |
---|
2 | #**************SPEC macros for the Advanced Photon Source*********************** |
---|
3 | #=============================================================================== |
---|
4 | # |
---|
5 | # Beamline/Sector: 4ID |
---|
6 | # |
---|
7 | # Macro Package: hkl_ioc.mac |
---|
8 | # |
---|
9 | # Version: 1.0 (August,2005) |
---|
10 | # |
---|
11 | # Description: A user defined calcHKL to write the current HKL postion to a |
---|
12 | # soft IOC. It requires spec softioc running. |
---|
13 | # |
---|
14 | # Written by: X. Jiao 08/08/2005 |
---|
15 | # |
---|
16 | # Modified by: |
---|
17 | # |
---|
18 | # User macros: ioc_HKL -> to turn on/off the feature of putting HKL to shared |
---|
19 | # memory. |
---|
20 | # |
---|
21 | # Internal macros: ioc_put_HKL -> write HKL to the soft IOC |
---|
22 | # |
---|
23 | # Modification history: |
---|
24 | # |
---|
25 | #$Log$ |
---|
26 | #Revision 1.3 2006/05/22 20:34:35 jiaox |
---|
27 | #removed unsed lines in ioc_HKL. |
---|
28 | # |
---|
29 | #Revision 1.2 2006/05/11 17:46:31 jiaox |
---|
30 | #Added CVS Log entry. |
---|
31 | # |
---|
32 | #=============================================================================== |
---|
33 | |
---|
34 | #=============================================================================== |
---|
35 | # preload check/setting here |
---|
36 | #=============================================================================== |
---|
37 | |
---|
38 | cdef("user_save_HKL","","ioc_HKL") |
---|
39 | cdef("calcHKL","calc(2); user_save_HKL;","ioc_HKL") |
---|
40 | |
---|
41 | #=============================================================================== |
---|
42 | # global variables defined here |
---|
43 | #=============================================================================== |
---|
44 | if( unset("SIOC_PV") ) { |
---|
45 | global SIOC_PV |
---|
46 | local foo tmp[] |
---|
47 | SIOC_PREFIX="4id" |
---|
48 | unix("hostname | cut -f1 -d.",foo) |
---|
49 | split(foo,tmp,"\n") |
---|
50 | foo=tmp[0] |
---|
51 | SIOC_PV = sprintf("%s:%s:spec",SIOC_PREFIX,foo) |
---|
52 | printf("Spec soft IOC PV(SIOC_PV): %s",SIOC_PV) |
---|
53 | } |
---|
54 | |
---|
55 | #=============================================================================== |
---|
56 | # user macros defined here |
---|
57 | #=============================================================================== |
---|
58 | def ioc_HKL '{ |
---|
59 | |
---|
60 | if($# != 1) { eprint "Usage: ioc_HKL on/off ";exit} |
---|
61 | |
---|
62 | |
---|
63 | if(("$1" == "on")) { |
---|
64 | cdef("user_save_HKL","ioc_put_HKL","ioc_HKL","0x20") |
---|
65 | print "Now put HKL to softioc." |
---|
66 | exit |
---|
67 | } |
---|
68 | if(("$1" == "off")) { |
---|
69 | cdef("user_save_HKL","","ioc_HKL","delete") |
---|
70 | print "Stop put HKL to softioc." |
---|
71 | exit |
---|
72 | } |
---|
73 | eprint "Usage: ioc_HKL on/off " |
---|
74 | }' |
---|
75 | |
---|
76 | |
---|
77 | #=============================================================================== |
---|
78 | # internal macros defined here |
---|
79 | #=============================================================================== |
---|
80 | def ioc_put_HKL ' |
---|
81 | epics_put(sprintf("%s:H",SIOC_PV),H) |
---|
82 | epics_put(sprintf("%s:K",SIOC_PV),K) |
---|
83 | epics_put(sprintf("%s:L",SIOC_PV),L) |
---|
84 | epics_put(sprintf("%s:NPTS",SIOC_PV),NPTS) |
---|
85 | ' |
---|
86 | |
---|
87 | |
---|