1 | /* file mfexec.h |
---|
2 | * ======== |
---|
3 | * |
---|
4 | * version 29, 21-Nov-2007 |
---|
5 | * |
---|
6 | * execution of SH commands (header file) |
---|
7 | * K. Stammler, 25-Feb-93 |
---|
8 | */ |
---|
9 | |
---|
10 | |
---|
11 | /* |
---|
12 | * |
---|
13 | * SeismicHandler, seismic analysis software |
---|
14 | * Copyright (C) 1996, Klaus Stammler, Federal Institute for Geosciences |
---|
15 | * and Natural Resources (BGR), Germany |
---|
16 | * |
---|
17 | * This program is free software; you can redistribute it and/or modify |
---|
18 | * it under the terms of the GNU General Public License as published by |
---|
19 | * the Free Software Foundation; either version 2 of the License, or |
---|
20 | * (at your option) any later version. |
---|
21 | * |
---|
22 | * This program is distributed in the hope that it will be useful, |
---|
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
25 | * GNU General Public License for more details. |
---|
26 | * |
---|
27 | * You should have received a copy of the GNU General Public License |
---|
28 | * along with this program; if not, write to the Free Software |
---|
29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
30 | * |
---|
31 | */ |
---|
32 | |
---|
33 | |
---|
34 | /* error codes */ |
---|
35 | #define MXE_OFFSET 4400 |
---|
36 | #define MXE_PROG_BUG (MXE_OFFSET+1) /* program bug */ |
---|
37 | #define MXE_NOT_IMPL (MXE_OFFSET+2) /* not implemented */ |
---|
38 | #define MXE_NO_GSE_MATCH (MXE_OFFSET+3) /* no GSE files found */ |
---|
39 | #define MXE_STROVFL (MXE_OFFSET+4) /* string overflow */ |
---|
40 | #define MXE_ILL_ANALYST (MXE_OFFSET+5) /* illegal analyst */ |
---|
41 | #define MXE_NO_TRACES (MXE_OFFSET+6) /* no traces found */ |
---|
42 | #define MXE_ILL_EXTROUT (MXE_OFFSET+7) /* illegal par to ext. rout. */ |
---|
43 | #define MXE_OPENREAD (MXE_OFFSET+8) /* error opening input file */ |
---|
44 | #define MXE_MANY_SELECT (MXE_OFFSET+9) /* too many traces selected */ |
---|
45 | #define MXE_NONE_SELECT (MXE_OFFSET+10) /* no traces selected */ |
---|
46 | #define MXE_NO_PHASES (MXE_OFFSET+11) /* no phases found */ |
---|
47 | #define MXE_NO_MLENTRY (MXE_OFFSET+12) /* no ml found on trace */ |
---|
48 | #define MXE_NOSTATIONS (MXE_OFFSET+13) /* no stations selected */ |
---|
49 | #define MXE_NOCHANNELS (MXE_OFFSET+14) /* no channel selected */ |
---|
50 | #define MXE_NOT_FOUND (MXE_OFFSET+15) /* not found */ |
---|
51 | #define MXE_ILL_SUBSET (MXE_OFFSET+16) /* undefined station subset */ |
---|
52 | #define MXE_CONFIG_SETUP (MXE_OFFSET+17) /* conig file setup error */ |
---|
53 | |
---|
54 | |
---|
55 | /* constants */ |
---|
56 | |
---|
57 | /* read formats */ |
---|
58 | #define MXC_FORMAT_SEED 1 |
---|
59 | #define MXC_FORMAT_GSE 2 |
---|
60 | #define MXC_FORMAT_GSE2 3 |
---|
61 | #define MXC_FORMAT_AH 4 |
---|
62 | #define MXC_FORMAT_Q 5 |
---|
63 | |
---|
64 | #define MXC_CHANLTH 2 |
---|
65 | #define MXC_MAXCHAN 4 |
---|
66 | |
---|
67 | #define MXC_STATLIST_LTH 30 |
---|
68 | #define MXC_STATSTR_LTH 9 |
---|
69 | |
---|
70 | #define MXC_COMP_STRLTH 10 |
---|
71 | |
---|
72 | |
---|
73 | typedef struct { |
---|
74 | char code[MXC_STATLIST_LTH][MXC_STATSTR_LTH+1]; /* station codes */ |
---|
75 | char set1code[MXC_STATSTR_LTH+1]; /* name of first subset */ |
---|
76 | char set2code[MXC_STATSTR_LTH+1]; /* name of second subset */ |
---|
77 | int set1start; /* first station of subset 1 */ |
---|
78 | int set1end; /* last station of subset 1 */ |
---|
79 | int set2start; /* first station of subset 2 */ |
---|
80 | int set2end; /* last station of subset 2 */ |
---|
81 | char channel[MXC_MAXCHAN][MXC_CHANLTH+1]; /* channel codes */ |
---|
82 | } MX_STATLIST; |
---|
83 | |
---|
84 | |
---|
85 | /* readg */ |
---|
86 | typedef struct { |
---|
87 | int format; /* format type: MXC_FORMAT_... */ |
---|
88 | BOOLEAN keep; /* keep traces */ |
---|
89 | char device[BC_FILELTH+1]; /* directory */ |
---|
90 | /* following for MXC_FORMAT_SEED */ |
---|
91 | char start[BC_LINELTH+1]; /* start time */ |
---|
92 | float seclth; /* length in seconds */ |
---|
93 | long stations; /* station list bits */ |
---|
94 | char comp[MXC_COMP_STRLTH+1];/* component chars */ |
---|
95 | char chanstr[MXC_MAXCHAN][MXC_CHANLTH+1]; /* channel strings */ |
---|
96 | int channum; /* number of channels used */ |
---|
97 | BOOLEAN use_reads; /* use reads command */ |
---|
98 | BOOLEAN use_readk; /* use readk command on VAX */ |
---|
99 | BOOLEAN reads_invhdr; /* use qualifier INVHDR on reads */ |
---|
100 | char sfdfile[BC_FILELTH+1]; /* name of sfd-file used */ |
---|
101 | /* following for other formats */ |
---|
102 | char filename[BC_FILELTH+1]; /* file names (wildcards possible) */ |
---|
103 | /* station list of dialog box */ |
---|
104 | MX_STATLIST sl; /* station list of dialog box */ |
---|
105 | } MX_CMD_READG; |
---|
106 | |
---|
107 | typedef struct { |
---|
108 | char name[BC_FILELTH+1]; /* name of filter */ |
---|
109 | float autocut; /* auto cut window */ |
---|
110 | } MX_CMD_FILTER; |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | /*--------------------------------------------------------------------------*/ |
---|
115 | |
---|
116 | |
---|
117 | void mx_exec_sh( Widget w, MGT_DSPCTRL *ctrl, char line[] ); |
---|
118 | |
---|
119 | /* executes command line |
---|
120 | * |
---|
121 | * parameters of routine |
---|
122 | * Widget w; input; widget of drawing area |
---|
123 | * MGT_DSPCTRL *ctrl; input; display control parameters |
---|
124 | * char line[]; input; command line |
---|
125 | */ |
---|
126 | |
---|
127 | |
---|
128 | /*--------------------------------------------------------------------------*/ |
---|
129 | |
---|
130 | |
---|
131 | void mx_readg( MX_CMD_READG *par, Widget wm, Widget ws, MGT_DSPCTRL *ctrl, |
---|
132 | BOOLEAN keep_phases, char autoevt[], STATUS *status ); |
---|
133 | |
---|
134 | /* executes readg command |
---|
135 | * |
---|
136 | * parameters of routine |
---|
137 | * XM_CMD_READG *par; input; command parameters |
---|
138 | * Widget wm; input; main DrawingArea Widget |
---|
139 | * Widget ws; input; single trace window |
---|
140 | * MGT_DSPCTRL *ctrl; input; display control parameters |
---|
141 | * BOOLEAN keep_phases; input; keep phases in memory |
---|
142 | * char *autoevt input; name of evt file for retrieving stat. names |
---|
143 | * STATUS *status; output; return status |
---|
144 | */ |
---|
145 | |
---|
146 | |
---|
147 | /*--------------------------------------------------------------------------*/ |
---|
148 | |
---|
149 | |
---|
150 | void mx_filter( MX_CMD_FILTER *filter, Widget w, MGT_DSPCTRL *ctrl, |
---|
151 | STATUS *status ); |
---|
152 | |
---|
153 | /* performs filtering |
---|
154 | * |
---|
155 | * parameters of routine |
---|
156 | * MX_CMD_FILTER *filter; input; filter command parameters |
---|
157 | * Widget w; input; DrawingArea Widget |
---|
158 | * MGT_DSPCTRL *ctrl; input; display control parameters |
---|
159 | * STATUS *status; output; return status |
---|
160 | */ |
---|
161 | |
---|
162 | |
---|
163 | /*--------------------------------------------------------------------------*/ |
---|
164 | |
---|
165 | |
---|
166 | void mx_stw( Widget wm, Widget ws, MGT_DSPCTRL *ctrl ); |
---|
167 | |
---|
168 | /* executes stw command |
---|
169 | * |
---|
170 | * parameters of routine |
---|
171 | * Widget wm; input; widget ID of main DrawingArea |
---|
172 | * Widget ws; input; widget ID of single trace DrawingArea |
---|
173 | * MGT_DSPCTRL *ctrl; input; display control parameters |
---|
174 | */ |
---|
175 | |
---|
176 | |
---|
177 | /*---------------------------------------------------------------------------*/ |
---|
178 | |
---|
179 | |
---|
180 | void mx_handle_beam( Widget wm, Widget ws, BOOLEAN do_beam, MGT_DSPCTRL *ctrl, |
---|
181 | CUT_PARAMS *par, char alignphase[], STATUS *status ); |
---|
182 | |
---|
183 | /* creates or deletes beam trace (toggle routine) |
---|
184 | * |
---|
185 | * parameters of routine |
---|
186 | * Widget wm; input; Widget ID of main window |
---|
187 | * Widget ws; input; Widget ID of single trace window |
---|
188 | * BOOLEAN do_beam; input; do beam (not align) |
---|
189 | * MGT_DSPCTRL *ctrl; input; display control |
---|
190 | * CUT_PARAMS *par; input; analysis parameters |
---|
191 | * char alignphase[]; input; name of phase to be aligned |
---|
192 | * STATUS *status; output; return status |
---|
193 | */ |
---|
194 | |
---|
195 | |
---|
196 | /*---------------------------------------------------------------------------*/ |
---|
197 | |
---|
198 | |
---|
199 | void mx_rotation( Widget wm, MGT_DSPCTRL *ctrl, float azimuth, float lat, |
---|
200 | float lon, STATUS *status ); |
---|
201 | |
---|
202 | /* Performs rotation of traces with given azimuth of, if 0.0, computing |
---|
203 | * azimuth by given location |
---|
204 | * |
---|
205 | * parameters of routine |
---|
206 | * Widget wm; input; widget ID of main window |
---|
207 | * MGT_DSPCTRL *ctrl; input; display control |
---|
208 | * float azimuth; input; rotation angle |
---|
209 | * float lat, lon; input; event location |
---|
210 | * STATUS *status; output; return status |
---|
211 | */ |
---|
212 | |
---|
213 | |
---|
214 | /*---------------------------------------------------------------------------*/ |
---|
215 | |
---|
216 | |
---|
217 | BOOLEAN mx_need_rotation( void ); |
---|
218 | |
---|
219 | /* returns whether rotation mode is switched on |
---|
220 | * |
---|
221 | * no input parameters |
---|
222 | */ |
---|
223 | |
---|
224 | |
---|
225 | /*---------------------------------------------------------------------------*/ |
---|
226 | |
---|
227 | |
---|
228 | void mx_trclist_command( Widget w, Widget ws, MGT_DSPCTRL *ctrl, char cmd[], |
---|
229 | STATUS *status ); |
---|
230 | |
---|
231 | /* executes SH command on trace list |
---|
232 | * |
---|
233 | * parameters of routine |
---|
234 | * Widget wm, ws; input; widget ID of drawing areas |
---|
235 | * MGT_DSPCTRL *ctrl; input; display control |
---|
236 | * char cmd[]; input; command to be executed |
---|
237 | * STATUS *status; output; return status |
---|
238 | */ |
---|
239 | |
---|
240 | |
---|
241 | /*----------------------------------------------------------------------------*/ |
---|
242 | |
---|
243 | |
---|
244 | void mx_trclist_refml( STATUS *status ); |
---|
245 | |
---|
246 | /* stores reference ml in parameter list |
---|
247 | * |
---|
248 | * parameters of routine |
---|
249 | * STATUS *status; output; return status |
---|
250 | */ |
---|
251 | |
---|
252 | |
---|
253 | /*----------------------------------------------------------------------------*/ |
---|
254 | |
---|
255 | |
---|
256 | void mx_analyst_name( Widget w[], MGT_DSPCTRL *ctrl, STATUS *status ); |
---|
257 | |
---|
258 | /* Reads analyst's initials from dialog box checks it and closes dialog |
---|
259 | * box if evereything is ok. |
---|
260 | * |
---|
261 | * parameters of routine |
---|
262 | * Widget w[]; input; widget array |
---|
263 | * STATUS *status; output; return status |
---|
264 | */ |
---|
265 | |
---|
266 | |
---|
267 | /*--------------------------------------------------------------------------*/ |
---|
268 | |
---|
269 | |
---|
270 | void mx_filter_box_defaults( Widget w[], MX_CMD_FILTER *fil ); |
---|
271 | |
---|
272 | /* resets filter box |
---|
273 | * |
---|
274 | * parameters of routine |
---|
275 | * Widget w[]; input; widget array |
---|
276 | * MX_CMD_FILTER *fil; input; filter parameters |
---|
277 | */ |
---|
278 | |
---|
279 | |
---|
280 | /*----------------------------------------------------------------------------*/ |
---|
281 | |
---|
282 | |
---|
283 | void mx_sh_external_routine( char cmd[], STATUS *status ); |
---|
284 | |
---|
285 | /* external routine for SH |
---|
286 | * |
---|
287 | * parameters of routine |
---|
288 | * char cmd[]; input; switch to subcommands |
---|
289 | * STATUS *status; output; return status |
---|
290 | */ |
---|
291 | |
---|
292 | |
---|
293 | /*----------------------------------------------------------------------------*/ |
---|
294 | |
---|
295 | |
---|
296 | void mx_clear_rotation( void ); |
---|
297 | |
---|
298 | /* resets roatation state |
---|
299 | * |
---|
300 | * no parameters |
---|
301 | */ |
---|
302 | |
---|
303 | |
---|
304 | /*----------------------------------------------------------------------------*/ |
---|
305 | |
---|
306 | |
---|
307 | void mx_get_chanlist( Widget w[], MX_CMD_READG *rg ); |
---|
308 | |
---|
309 | |
---|
310 | /* reads list of channels from dialog box into channel array |
---|
311 | * |
---|
312 | * parameters of routine |
---|
313 | * Widget w[]; input; widget array |
---|
314 | * MX_CMD_READG *rg; output; channel array (chanstr) |
---|
315 | */ |
---|
316 | |
---|
317 | |
---|
318 | /*----------------------------------------------------------------------------*/ |
---|
319 | |
---|
320 | |
---|
321 | void mx_name_read_buttons( Widget w[], int dialbox_num, TSyStatus *status ); |
---|
322 | |
---|
323 | /* reads in station list from parameter file. Original from mxh_read_statlist. |
---|
324 | * |
---|
325 | * parameters of routine |
---|
326 | * Widget w[]; input; widget array (widgets will be modified) |
---|
327 | * int dialbox_num; input; number of dialog box to be modified |
---|
328 | * MX_STATLIST *sl; output; station list for dialog box |
---|
329 | * TSyStatus *status; output; return status |
---|
330 | */ |
---|
331 | |
---|
332 | |
---|
333 | /*--------------------------------------------------------------------------*/ |
---|
334 | |
---|
335 | |
---|
336 | void mx_filter_from_autoevt( char autoevt[], char filtername[], |
---|
337 | float *autocut ); |
---|
338 | |
---|
339 | /* Determines filter using distance between autoevt location and reference |
---|
340 | * station |
---|
341 | * |
---|
342 | * parameters of routine |
---|
343 | * char autoevt[]; input; name of autoevt file |
---|
344 | * char filtername[]; output; name of filter to use |
---|
345 | * float *autocut; output; cut off that many seconds after filtering |
---|
346 | */ |
---|
347 | |
---|
348 | |
---|
349 | /*--------------------------------------------------------------------------*/ |
---|