Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
linuxpops.c
Go to the documentation of this file.
1 /*
2 
3 Copyright 2021 Arizona Board of Regents on behalf of the University of Arizona.
4 
5 For commercial uses, to obtain a license to sell and or sublicense copies of
6 the Software please contact the University of Arizona at Tech Launch Arizona:
7 lewish@tla.arizona.edu.
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction for non-commercial use educational and
12 research purposes, including without limitation the rights to use, copy,
13 modify, merge, publish, distribute, and to permit persons to whom the Software
14 is furnished to do so, subject to the following conditions:
15 
16 The entire above copyright notice and this permission notice shall be included
17 in all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 SOFTWARE.
26 
27 1. Additional Required Provisions
28 
29 1.1. Arbitration. The parties agree that if a dispute arises between them
30 concerning this Agreement, the parties may be required to submit the matter to
31 arbitration pursuant to Arizona law.
32 
33 1.2. Applicable Law and Venue. This Agreement shall be interpreted pursuant
34 to the laws of the State of Arizona. Any arbitration or litigation between the
35 Parties shall be conducted in Pima County, ARIZONA, and LICENSEE hereby
36 submits to venue and jurisdiction in Pima County, ARIZONA.
37 
38 1.3. Non-Discrimination. The Parties agree to be bound by state and federal
39 laws and regulations governing equal opportunity and non-discrimination and
40 immigration.
41 
42 1.4. Appropriation of Funds. The Parties recognize that performance by
43 ARIZONA may depend upon appropriation of funds by the State Legislature of
44 ARIZONA. If the Legislature fails to appropriate the necessary funds, or if
45 ARIZONA’S appropriation is reduced during the fiscal year, ARIZONA may cancel
46 this Agreement without further duty or obligation. ARIZONA will notify
47 LICENSEE as soon as reasonably possible after it knows of the loss of funds.
48 
49 1.5. Conflict of Interest. This Agreement is subject to the provisions of
50 A.R.S. 38-511 and other conflict of interest regulations. Within three years
51 of the EFFECTIVE DATE, ARIZONA may cancel this Agreement if any person
52 significantly involved in initiating, negotiating, drafting, securing, or
53 creating this Agreement for or on behalf of ARIZONA becomes an employee or
54 consultant in any capacity of LICENSEE with respect to the subject matter of
55 this Agreement.
56 
57 */
58 
59 #include "extern.h"
60 
61 #define MAX_DATA_CHANNELS 8192
62 #include "ds_image_info.h"
63 
65 
66 tcflag_t old_lflag;
67 cc_t old_vtime;
68 struct termios term;
69 
70 FILE *fp, *errPrint_fp = NULL;
71 struct ENVIRONMENT *env;
72 struct HEADER *sa = NULL;
74 
76 
77 int logging = 0;
78 int last_valid = 0;
79 int onlineversion = 0;
80 int verboseLevel = 0;
83 int xfd = 0;
84 int hfd = 0;
85 int dfd = 0;
86 int printNsave = 0;
87 int site = 0;
88 int lp_logging = 0;
89 int lp_ppid = 0;
91 int no_terminal = 0;
92 
93 char savedCaptureName[256];
94 
95 
118 {
119  int v;
120 
121  if(strlen(args->secondArg))
122  {
123  v = atoi(args->secondArg);
124 
125  if(v >= 0 && v <= VERBOSE_FLAGS)
126  {
127  st_report("Setting Verbose Level to %d", v);
128 
129  verboseLevel = v;
130  }
131  else
132  {
133  st_fail("Verbose Level %d, out of Range: 0 - %d", v, VERBOSE_FLAGS);
134  }
135  }
136  else
137  {
138  st_report("Current Verbose Level: %d", verboseLevel);
139  st_report("Suggested Levels: 1 Verbose for Parsing Info");
140  st_report(" 2 Verbose for Auto Tau Calculations");
141  st_report(" 4 Verbose for Critiria Slection");
142  st_report(" 8 Verbose for Xgraphic Activity");
143  st_report(" 16 Verbose for FBOFFSET Routines");
144  st_report(" 32 Verbose for BASELINE Routines");
145  st_report(" 64 Verbose for STATS Routines");
146  st_report(" 128 Verbose for RECURSIVE Info");
147  st_report(" 256 Verbose for Batchfile Info");
148  st_report(" 512 Verbose for Alias Info");
149  st_report(" 1024 Verbose for Fileops Info");
150  st_report(" 2048 Verbose for Gridmap Routines");
151  st_report(" 4096 Verbose for Flag Checking");
152  st_report(" 8192 Verbose for Atm Routines");
153  }
154 
155  return(0);
156 }
157 
158 
164 int validate(which)
165 int which;
166 {
167  last_valid = which;
168 
169  return(0);
170 }
171 
172 
179 int replot(how)
180 int how;
181 {
182  switch(last_valid)
183  {
184  case 0:
185  if(notSet(PF_I_FLAG))
186  {
187  st_fail("No scans Loaded Yet");
188  }
189  break;
190  case CONTMAP: doMapPlot(how); break;
191  case CONT_MAP: cont_display_mapscan( h0, how); break;
192  case SEQUENCE: cont_display_sequence(h0, how); break;
193  case QK5: /*makeScanPlot(); */ break;
194  case FOCALIZE: cont_display_any_focus(h0, how, last_valid); break;
195  case EW_FOCALIZE: cont_display_any_focus(h0, how, last_valid); break;
196  case NS_FOCALIZE: cont_display_any_focus(h0, how, last_valid); break;
197  case SP_TIP: /*makeScanPlot(); */ break;
198  case VLBI: /*makeScanPlot(); */ break;
199 
200  case PS:
201  case BSP:
202  linePlot(h0);
203  break;
204 
205  case ACCUM_SCANS_MODE:
207  break;
208 
209  default:
210 // st_warn("Strange Last Plot: %d", last_valid);
211  break;
212  }
213 
214  return(0);
215 }
216 
217 
219 {
220  double w, h;
221 
222  if(args->ntokens == 2) /* "*" or "default" */
223  {
224  if(!strncmp(args->secondArg, "*", strlen(args->secondArg)))
225  {
226  env->paperw = 10.0;
227  env->paperh = 7.5;
228  }
229  else
230  if(!strncmp(args->secondArg, "0", strlen(args->secondArg)))
231  {
232  env->paperw = 0.0;
233  env->paperh = 0.0;
234  }
235  else
236  {
237  printH_FlagHelp("paper");
238 
239  return(1);
240  }
241  }
242  else
243  if(args->ntokens == 3) /* width height */
244  {
245  w = atof(args->secondArg);
246  h = atof(args->thirdArg);
247 
248  if(w > 0.0 && h > 0.0)
249  {
250  env->paperw = w;
251  env->paperh = h;
252  }
253  else
254  {
255  printH_FlagHelp("paper");
256 
257  return(1);
258  }
259  }
260  else
261  {
262  printH_FlagHelp("paper");
263 
264  return(1);
265  }
266 
267  st_report("Setting Plotter Paper Size to %.2f\" x %.2f\"", env->paperw, env->paperh);
268 
269  return(0);
270 }
271 
272 
273 int makeFileName(fname, pid)
274 char *fname;
275 int pid;
276 {
277  char obj[256], modeStr[256];
278 
279  switch(last_plot)
280  {
281  case LAST_PLOT_OTF_CUT:
282  sprintf(obj, "%16.16s", h0->head.object);
283  strcmprs(obj);
284  sprintf(fname, "OTF-%s-%.2f-%.2f", obj, h0->ainfo.bscan, h0->ainfo.escan);
285 
286  break;
288  sprintf(fname, "CF-%.2f-%.2f_%04dKHz_%d",
289  h0->ainfo.bscan,
290  h0->ainfo.escan,
291  (int)fabs(h0->head.freqres*1000.0),
292  (int)h0->head.noint);
293  break;
294 
295  case LAST_PLOT_SPEC_FFT:
296  sprintf(fname, "FFT-%.2f-%.2f_%04dKHz_%d",
297  h0->ainfo.bscan,
298  h0->ainfo.escan,
299  (int)fabs(h0->head.freqres*1000.0),
300  (int)h0->head.noint);
301  break;
302 
304  sprintf(fname, "HISTO-%.2f-%.2f_%04dKHz_%d",
305  h0->ainfo.bscan,
306  h0->ainfo.escan,
307  (int)fabs(h0->head.freqres*1000.0),
308  (int)h0->head.noint);
309  break;
310 
312  sprintf(obj, "%16.16s", accum_results_send.head[0].object);
313  strcmprs(obj);
314  sprintf(fname, "CONT_ACCUM-%.2f-%.2f-%s", accum_results_send.bscan,
316  obj);
317  break;
318 
320  sprintf(obj, "%16.16s", cont_plain_send.head.object);
321  strcmprs(obj);
322 
323  strncpy(modeStr, cont_plain_send.head.obsmode+4, 4);
324  modeStr[4] = '\0';
325  strcmprs(modeStr);
326 
327  sprintf(fname, "%s-%.2f-%s", modeStr, cont_plain_send.head.scan, obj);
328 
329  break;
330 
332  sprintf(fname, "SPTIP-%.2f-%.2f", cont_sptip_send.head1.scan,
334  break;
335 
337  sprintf(fname, "OBJECT-%.2f-%.2f-%s",
341  break;
342 
343  case LAST_PLOT_FLUX_INFO:
344  sprintf(fname, "FLUX-INFO-%.2f-%.2f-%s", flux_info.bfreq,
345  flux_info.efreq,
346  flux_info.name);
347  break;
348 
350  sprintf(fname, "FLUX-HISTORY-%s", flux_history.name);
351  break;
352 
353  default:
354  sprintf(fname, "CaptureFile-%d", pid);
355  break;
356  }
357 
358  return(0);
359 }
360 
361 
363 {
364  int pid;
365  char fname[256];
366 
367  pid = rand();
368  pid = pid%32767;
369 
370  makeFileName(fname, pid);
371 
372  st_report("Suggested Filename: %s", fname);
373 
374  return(0);
375 }
376 
377 
378 
379 
386 {
387  int pid, bpaper = 0, dops = 0, jpg=0;
388  char fname_out[600], fname[512], jname[600], pname[256], *prt;
389  double old_pw, old_ph;
390  static char sysbuf[2048];
391 
392  if(h0->head.scan == 0.0)
393  {
394  st_fail("printPlot(): No privious scan loaded");
395  return(1);
396  }
397 
398  prt = printer;
399 
400  if(isSet(PF_D_FLAG))
401  {
402  old_pw = env->paperw;
403  old_ph = env->paperh;
404 
405  env->paperw = 10.7;
406  env->paperh = 7.5;
407  }
408 
409  if(isSet(PF_X_FLAG))
410  {
411  xx(); /* Force a replot */
412  }
413 
414  if(isSet(PF_B_FLAG))
415  {
416  bpaper = 1;
417  }
418 
420  {
421  dops = 1;
422  jpg = 0;
423  }
424  else
426  {
427  jpg = 1;
428  dops = 0;
429  }
430  else
431  if(isSet(PF_P_FLAG) && isSet(PF_J_FLAG))
432  {
433  st_fail("printPlot(): /j flag AND /p flag not allowed");
434 
435  if(isSet(PF_D_FLAG))
436  {
437  env->paperw = old_pw;
438  env->paperh = old_ph;
439  }
440 
441  return(1);
442  }
443 
444  if(xgraphic)
445  {
446  sock_send(xgraphic, "make");
447 
448  sleep(1); /* Give xgraphic time to plot */
449 
450  if(isSet(PF_C_FLAG))
451  {
452  pid = rand();
453  pid = pid%32767;
454 
455  if(h0->ainfo.bscan == 0.0 || h0->ainfo.escan == 0.0)
456  {
457  h0->ainfo.bscan = h0->head.scan;
458  h0->ainfo.escan = h0->head.scan;
459  }
460 
461  makeFileName(fname, pid);
462 
463  strcpy(savedCaptureName, fname);
464 
465  if(!dops)
466  {
467  sprintf(fname_out, "%s.pdf", fname);
468  st_report("printPlot(): Converting plotfile /tmp/%s/ccal_plot.ps to %s", session, fname_out);
469  sprintf(sysbuf, "cat /tmp/%s/ccal_plot.ps | /usr/bin/epstopdf -f --outfile=%s", session, fname_out);
470  }
471  else
472  {
473  sprintf(fname_out, "%s.ps", fname);
474  st_report("printPlot(): Coping plotfile /tmp/%s/ccal_plot.ps to %s", session, fname_out);
475  sprintf(sysbuf, "mv /tmp/%s/ccal_plot.ps %s", session, fname_out);
476  }
477 
479  {
480  st_report("printPlot(): Executing Command: %s", sysbuf);
481  }
482 
483  system(sysbuf);
484 
485  if(jpg)
486  {
487  sprintf(jname, "%s.jpg", fname);
488  st_report("printPlot(): Converting plotfile %s to %s", fname_out, jname);
489  sprintf(sysbuf, "/usr/bin/pdftoppm -jpeg %s > /tmp/tmp.jpg", fname_out);
490  system(sysbuf);
491 
492  if(isSet(PF_D_FLAG)) /* Prepare for doxygen publication */
493  {
494  st_report("printPlot(): Converting image for Publication");
495  sprintf(sysbuf, "/usr/bin/convert -resize 1280x1024 -rotate 90 /tmp/tmp.jpg %s", pname);
496  }
497  else
498  {
499  sprintf(sysbuf, "/usr/bin/convert -rotate 90 /tmp/tmp.jpg %s", pname);
500  }
501  system(sysbuf);
502  }
503 
504  if(!jpg && isSet(PF_G_FLAG))
505  {
506  sprintf(pname, "%s.png", fname);
507  st_report("printPlot(): Converting plotfile %s to %s", fname_out, pname);
508  sprintf(sysbuf, "/usr/bin/pdftoppm -png %s > /tmp/tmp.png", fname_out);
509  system(sysbuf);
510 
511  if(isSet(PF_D_FLAG)) /* Prepare for doxygen publication */
512  {
513  st_report("printPlot(): Converting image for Publication");
514  sprintf(sysbuf, "/usr/bin/convert -resize 1280x1024 -rotate 90 /tmp/tmp.png %s", pname);
515  }
516  else
517  {
518  sprintf(sysbuf, "/usr/bin/convert -rotate 90 /tmp/tmp.png %s", pname);
519  }
520 
521  system(sysbuf);
522  }
523 
524  if(isSet(PF_V_FLAG))
525  {
526  sprintf(sysbuf, "evince %s 1>> /dev/null 2>&1 &", fname_out);
527  system(sysbuf);
528  }
529 
530  if(args->ntokens > 1)
531  {
532  if(strlen(args->secondArg))
533  {
534  st_report("printPlot(): Moving Capture file: %s to %s", fname_out, args->secondArg);
535 
536  if(strstr(args->secondArg, "png"))
537  {
538  sprintf(sysbuf, "mv %s %s", pname, args->secondArg);
539  }
540  else
541  {
542  sprintf(sysbuf, "mv %s %s", fname_out, args->secondArg);
543  }
544 
545  system(sysbuf);
546  }
547  }
548 
549  if(isSet(PF_D_FLAG))
550  {
551  env->paperw = old_pw;
552  env->paperh = old_ph;
553  }
554 
555  return(0);
556  }
557  else /* Assume any args are a printer definition */
558  {
559  if(strlen(args->secondArg))
560  {
561  prt = args->secondArg;
562  }
563  }
564 
565  st_report("printPlot(): Printing file /tmp/%s/ccal_plot.ps to %s", session, prt);
566 
567  if(bpaper)
568  {
569  sprintf(sysbuf, "lpr -o media=11x17 -o fitplot /tmp/%s/ccal_plot.ps", session);
570  }
571  else
572  {
573  sprintf(sysbuf, "lpr -P%s /tmp/%s/ccal_plot.ps", prt, session);
574  }
575 
577  {
578  st_report("printPlot(): Executing Command: %s", sysbuf);
579  }
580 
581  system(sysbuf);
582  }
583 
584  sleep(1);
585 
586  if(isSet(PF_R_FLAG))
587  {
588  refreshPlot();
589  }
590 
591  if(isSet(PF_D_FLAG))
592  {
593  env->paperw = old_pw;
594  env->paperh = old_ph;
595  }
596 
597  return(0);
598 }
599 
600 
605 int xx()
606 {
607  replot(GNUPLOT);
608 
609  return(0);
610 }
611 
612 
618 {
619  int i;
620  struct HEADER *p;
621 
622  p = &sa[0];
623  for(i=0;i<env->numofscans;i++,p++)
624  {
625  if(!(i%7))
626  {
627  st_print("\n%4d: ", i+1);
628  }
629  st_print("%8.2f", p->scan);
630  }
631 
632  st_print("\n");
633 
634  return(0);
635 }
636 
637 
642 int doSysCmd()
643 {
644  int ret;
645  char sysbuf[256];
646 
647  /* ignore the 'system' keyword in the firstArg */
648  sprintf(sysbuf, "%s %s %s %s %s", args->secondArg,
651 
653  {
654  st_report("Executing Command: %s", sysbuf);
655  }
656 
657  ret = system(sysbuf);
658 
659  return(ret);
660 }
661 
662 
663 
668 int quitProg()
669 {
670  char cmdBuf[256];
671 
672  if(isSet(PF_Y_FLAG))
673  {
674  st_report("Exiting Program");
675 
676  exit(0);
677  }
678 
679  if(getYesNoQuit("Exit Program: y/N ?"))
680  {
681  if(doingOTF)
682  {
683  sock_send(dataserv, "q");
684  doingOTF = 0;
685  }
686 
688  {
690 
691  /* Save any predefined formulas */
692  sprintf(cmdBuf, "formula /w .lp.formulas");
693  parseCmd(cmdBuf);
694 
696  }
697 
698  st_report("Exiting Program");
699 
700  exit(0);
701  }
702 
703  return(0);
704 }
705 
706 
712 {
713  st_warn("plotAccum() Not implemented yet");
714 
715  return(0);
716 }
717 
718 
725 int printScan(p, nsave)
726 struct HEADER *p;
727 int nsave;
728 {
729  int ns, feed, oc = -1;
730  double ttime, freq, tsys, tcal, scan_or_nsave;
731  double xoff, yoff, roff, doff, az;
732  char sbname[80], backend[80];
733 
734  if(env->mode == MODE_CONT)
735  {
736  freq = restFreq(p) / 1000.0;
737  ns = (int)(p->noint / p->nophase);
738  ttime = p->noint * p->samprat;
739  }
740  else
741  if(env->mode == MODE_SPEC)
742  {
743  freq = p->restfreq / 1000.0;
744  ns = (int)(p->inttime / p->samprat);
745  ttime = p->samprat;
746  }
747  else
748  if(env->mode == MODE_OTF)
749  {
750  freq = p->restfreq / 1000.0;
751  ns = (int)(p->inttime / p->samprat);
752  ttime = p->inttime;
753  }
754 
755 // 0 1 2 3
756 // { "H-LSB", "H-USB", "V-LSB", "V-USB" };
757  if(env->issmt)
758  {
759  feed = 0;
760 
761  if(strstr(p->backend, "DIGITAL")) /* It's a continuum scan; determine backend from scan-num */
762  {
763  feed = getFeed(p->scan);
764  feed--;
765  }
766  else
767  {
768  if(strstr(p->backend, "HU"))
769  {
770  feed = 1;
771  }
772  else
773  if(strstr(p->backend, "VU"))
774  {
775  feed = 3;
776  }
777  else
778  if(strstr(p->backend, "HL"))
779  {
780  feed = 0;
781  }
782  else
783  if(strstr(p->backend, "VL"))
784  {
785  feed = 2;
786  }
787  }
788 
789  strcpy(sbname, mg_sideband[feed]);
790 
791  }
792  else
793  {
794  strcpy(sbname, kp_sideband[(int)p->sideband]);
795  }
796 
797  if(manual_tcal > 0.0 && fabs(p->tcal-400.0) < 1.0)
798  {
799  tsys = p->stsys * manual_tcal / p->tcal;
800  tcal = manual_tcal;
801  }
802  else
803  {
804  tsys = p->stsys;
805  tcal = p->tcal;
806  }
807 
808  strncpy(backend, p->backend, 8);
809  backend[8] = '\0';
810  strcmprs(backend);
811 
812  if(nsave)
813  {
814  scan_or_nsave = p->align3[0]+1;
815  }
816  else
817  {
818  scan_or_nsave = p->scan;
819  }
820 
821 // st_print("printScan(): nsave = %d, scan_or_nsave = %.2f\n", nsave, scan_or_nsave);
822 
823  if(p->openpar[5] == 5555.5)
824  {
825  oc = oldColor;
826  setColor(GREEN);
827  }
828 
829  if(p->openpar[8] == 9999.5 || p->openpar[8] == 9998.5)
830  {
831  oc = oldColor;
832  setColor(MAGENTA);
833  }
834 
835  if(p->az < 0.0)
836  {
837  az = p->az + 360.0;
838  }
839  else
840  if(p->az > 360.0)
841  {
842  az = p->az - 360.0;
843  }
844  else
845  {
846  az = p->az;
847  }
848 
849  st_print(" %10.10s %10.6f %10.4f %6.2f %8.2f %5d %4.0f %5.1f %5.1f %8.8s %5.5s %8.8s %4.0f %4.0f ",
850  p->object, freq, p->utdate, p->ut, scan_or_nsave, ns, ttime, az, p->el, p->obsmode, sbname,
851  backend, tsys, tcal);
852 
853  if(!strncmp(p->obsmode, "CONTMAP", 7))
854  {
855  st_print(" %3.0f %3.0f %3.0f %3.0f %3.0f %6.2f",
856  p->noxpts, p->noypts,
857  p->xcell0, p->ycell0,
858  p->scanang, p->focusr);
859  }
860  else
861  if(!strncmp(p->obsmode, "LINEOTF", 7))
862  {
863  st_print(" %5.2f %2d %2d %2d %2d", fabs(p->freqres),
864  (int)p->xcell0, (int)p->noxpts,
865  (int)p->ycell0, (int)p->noypts);
866  }
867  else
868  if(!strncmp(p->obsmode, "LINE", 4))
869  {
870  xoff = p->az_offset * 3600.0;
871  yoff = p->el_offset * 3600.0;
872 
873  roff = (p->epocra - p->xsource) * 3600.0 * cos(p->epocdec*CTR);
874  doff = (p->epocdec - p->ysource) * 3600.0;
875 
876  if(roff || doff)
877  {
878  st_print(" %5.2f %5.1f %5.1f", fabs(p->freqres), roff, doff);
879  }
880  else
881  if(xoff || yoff)
882  {
883  st_print(" %5.2f %5.1f %5.1f", fabs(p->freqres), xoff, yoff);
884  }
885  else
886  {
887  st_print(" %5.2f %5.1f %5.1f", fabs(p->freqres), 0.0, 0.0);
888  }
889  }
890 
891  if(oc != -1)
892  {
893  setColor(oc);
894  }
895 
896  st_print("\n");
897 
898  return(0);
899 }
900 
901 
902 
907 int tellAll()
908 {
909  int i, j;
910  char source[32], backend[32], mode[32];
911  struct HEADER *p;
912 
913  p = &sa[0];
914  j = 1;
915 
916  st_print("%s\n", listHeader);
917 
918  for(i=0;i<env->numofscans;i++,p++)
919  {
920  if(!(j%24))
921  {
922  st_print("%s\n", listHeader);
923  }
924 
925  if(args->ntokens > 1)
926  {
927  sprintf(source, "%16.16s", p->object);
928  sprintf(backend, "%8.8s", p->backend);
929  sprintf(mode, "%8.8s", p->obsmode);
930 
931  if(strcasestr(source, args->secondArg) ||
932  strcasestr(backend, args->secondArg) ||
933  strcasestr(mode, args->secondArg))
934  {
935  printScan(p, printNsave);
936  }
937  else
938  {
939  continue;
940  }
941  }
942  else
943  {
944  printScan(p, printNsave);
945  }
946 
947  j++;
948  }
949 
950  st_warn("Found %d Scans Matching Criteria", j-1);
951 
952  return(0);
953 }
954 
955 
961 {
962  int i, j;
963  struct HEADER *p;
964 
965  p = &sa[0];
966  j = 1;
967 
968  st_print("%s\n", listHeader);
969 
970  for(i=0;i<env->numofscans;i++,p++)
971  {
972  if(!(j%24))
973  {
974  st_print("%s\n", listHeader);
975  }
976 
977  if(p->openpar[5] == 5555.5)
978  {
979  printScan(p, printNsave);
980 
981  j++;
982  }
983  }
984 
985  st_warn("Found %d Scans Matching Criteria", j-1);
986 
987  return(0);
988 }
989 
990 
996 {
997  int i, j;
998  struct HEADER *p;
999 
1000  p = &sa[0];
1001  j = 1;
1002 
1003  st_print("%s\n", listHeader);
1004 
1005  for(i=0;i<env->numofscans;i++,p++)
1006  {
1007  if(!(j%24))
1008  {
1009  st_print("%s\n", listHeader);
1010  }
1011 
1012  if(p->openpar[8] == 9999.5 || p->openpar[8] == 9998.5)
1013  {
1014  printScan(p, printNsave);
1015 
1016  j++;
1017  }
1018  }
1019 
1020  st_warn("Found %d Scans Matching Criteria", j-1);
1021 
1022  return(0);
1023 }
1024 
1025 
1026 
1034 struct HEADER *h;
1035 {
1036  int ret, ok = 0;
1037  char backend[32];
1038 
1039  switch(env->bkmatch)
1040  {
1041  case BKMATCH_FEED:
1042  if(env->if_feed == 0.0)
1043  {
1044  return(1);
1045  }
1046  else
1047  if(lp_fcmp((h->scan-(int)h->scan), env->if_feed, 0.0001))
1048  {
1049  return(0);
1050  }
1051  else
1052  {
1053  return(1);
1054  }
1055  break;
1056 
1057  case BKMATCH_RESOLUTION:
1058  if(env->bkres == 0.0)
1059  {
1060  return(1);
1061  }
1062  else
1063  if(lp_fcmp(fabs(h->freqres), env->bkres, 0.01))
1064  {
1065  return(0);
1066  }
1067  else
1068  {
1069  return(1);
1070  }
1071  break;
1072 
1073  case BKMATCH_NAME:
1074  strncpy(backend, h->backend, 8);
1075  backend[8] = '\0';
1076  strcmprs(backend);
1077 
1078  ret = fnmatch(env->backend, backend, FNM_CASEFOLD);
1079 
1080  return(ret == 0);
1081 
1082  break;
1083 
1084  case BKMATCH_NAMERES:
1085  /* Fist check the name */
1086  strncpy(backend, h->backend, 8);
1087  backend[8] = '\0';
1088  strcmprs(backend);
1089 
1090  /* Return 0 if a match else 1 */
1091  ret = fnmatch(env->backend, backend, FNM_CASEFOLD);
1092 
1093  /* Now check resolution */
1094  if(env->bkres == 0.0)
1095  {
1096  ok = 1;
1097  }
1098  else
1099  {
1100  ok = lp_fcmp(fabs(h->freqres), env->bkres, 0.01); /* Match = 0 */
1101  }
1102 
1103  if(!ret && !ok)
1104  {
1105  return(1);
1106  }
1107  else
1108  {
1109  return(0);
1110  }
1111 
1112  break;
1113  }
1114 
1115  return(1);
1116 }
1117 
1118 
1125 {
1126  int i, len, n=0, tip=0, feed;
1127  struct HEADER *p;
1128  double freq;
1129  char source[80];
1130 
1131  if(isSet(PF_T_FLAG))
1132  {
1133  doSummary();
1134 
1135  return(0);
1136  }
1137 
1138  if(isSet(PF_S_FLAG))
1139  {
1140  listSaves();
1141 
1142  return(0);
1143  }
1144 
1145  resetRejections(); /* List rejections, not Receiver rejections */
1146 
1147  verifyParams();
1148 
1149  len = strlen(args->secondArg);
1150 
1151  if(isSet(PF_N_FLAG))
1152  {
1153  printNsave = 1;
1154  }
1155  else
1156  {
1157  printNsave = 0;
1158  }
1159 
1160  if(isSet(PF_E_FLAG) || (len && !strncasecmp(args->secondArg, "envr", len)))
1161  {
1162  tellEnv();
1163 
1164  return(0);
1165  }
1166 
1167 /* Can't go beyond here without a data file */
1168  if(!env->numofscans)
1169  {
1170  st_warn("No data file loaded");
1171 
1172  return(1);
1173  }
1174 
1175  if((len && !strncasecmp(args->secondArg, "sfocus", len)))
1176  {
1177  tellAllSfocus();
1178 
1179  return(0);
1180  }
1181 
1182  if((len && !strncasecmp(args->secondArg, "spec5", len)))
1183  {
1184  tellAllSpec5();
1185 
1186  return(0);
1187  }
1188 
1189  if(isSet(PF_A_FLAG) || (len && !strncasecmp(args->secondArg, "all", len)))
1190  {
1191  tellAll();
1192 
1193  return(0);
1194  }
1195 
1196  if(isSet(PF_O_FLAG) || (len && !strncasecmp(args->secondArg, "ondata", len)))
1197  {
1198  tellOndata();
1199 
1200  return(0);
1201  }
1202 
1203  if(isSet(PF_I_FLAG) || (len && !strncasecmp(args->secondArg, "ignored", len)))
1204  {
1205  tellIgnored();
1206 
1207  return(0);
1208  }
1209 
1210  if(isSet(PF_W_FLAG) || (len && !strncasecmp(args->secondArg, "weather", len)))
1211  {
1212  tellWeather();
1213 
1214  return(0);
1215  }
1216 
1217  if(isSet(PF_S_FLAG) || (len && !strncasecmp(args->secondArg, "sources", len)))
1218  {
1219  showSourceList();
1220 
1221  return(0);
1222  }
1223 
1224  if(isSet(PF_G_FLAG) || (len && !strncasecmp(args->secondArg, "gdata", len)) ||
1225  (len && !strncasecmp(args->secondArg, "gains", len)))
1226  {
1227  st_report("Dumping Gains");
1228  doDumpGains();
1229 
1230  return(0);
1231  }
1232 
1233  if(env->mode == MODE_CONT)
1234  {
1235  if(!strcasecmp(args->secondArg, "map"))
1236  {
1237  st_print("%s Xpts Ypts Col Row\n", listHeader);
1238  }
1239  else
1240  {
1241  st_print("%s\n", listHeader);
1242  }
1243  }
1244  else
1245  if(env->mode == MODE_SPEC)
1246  {
1247  st_print("%s Res Offset Offset\n", listHeader);
1248  }
1249  else
1250  if(env->mode == MODE_OTF)
1251  {
1252  st_print("%s Res MapY Cols MapY Rows\n", listHeader);
1253  }
1254  else
1255  {
1256  st_print("%s Res\n", listHeader);
1257  }
1258 
1259  if(len && !strncasecmp(args->secondArg, "tips", len))
1260  {
1261  tip = 1;
1262  }
1263 
1264  p = &sa[0];
1265 
1266  for(i=0;i<env->numofscans;i++,p++)
1267  {
1268  /* If user requests only planets, then list all reqardless of source */
1269  if(notSet(PF_P_FLAG))
1270  {
1271  if(!tip) /* SPTIP sometimes have erronious source names */
1272  {
1273  strncpy(source, p->object, 16);
1274  source[16] = '\0';
1275  strcmprs(source);
1276 
1277  if(env->check_source && strcasecmp(source, env->source))
1278  {
1280  continue; /* Skip */
1281  }
1282  }
1283  }
1284 
1285  if(env->mode == MODE_CONT)
1286  {
1287  freq = restFreq(p) / 1000.0;
1288  }
1289  else
1290  {
1291  freq = p->restfreq / 1000.0;
1292  }
1293 
1294  if(env->freq > 0.0 && fabs(freq - env->freq) > env->dfreq) /* Within 1 GHz */
1295  {
1296  incrementRejFreq();
1297  continue; /* No good */
1298  }
1299 
1300  if(p->scan > (env->escan+0.99) || p->scan < env->bscan)
1301  {
1303  continue;
1304  }
1305 
1306  if(env->check_date && fabs(p->utdate - env->date) > 0.000098)
1307  {
1309  continue;
1310  }
1311 
1312  /* Check for matching backend */
1313  if(!backendMatch(p))
1314  {
1316  continue;
1317  }
1318 
1319  /* Has user supplied an upper limit on acceptable tsys? */
1320  if((env->tsyslimit > 0.0 && p->stsys > env->tsyslimit) || isnan(p->stsys))
1321  {
1323  continue;
1324  }
1325 
1326  if(tip)
1327  {
1328  if(strcmp(p->obsmode, "CONTSTIP"))
1329  {
1330  incrementRejMode();
1331  continue;
1332  }
1333  }
1334 
1335  if(args->secondArg && !strcasecmp(args->secondArg, "foc"))
1336  {
1337  if(strncmp(p->obsmode, "CONTFOC", 7))
1338  {
1339  incrementRejMode();
1340  continue;
1341  }
1342  }
1343 
1344  if(args->secondArg && !strcasecmp(args->secondArg, "ewf"))
1345  {
1346  if(strncmp(p->obsmode, "CONTEWFC", 8))
1347  {
1348  incrementRejMode();
1349  continue;
1350  }
1351  }
1352 
1353  if(args->secondArg && !strcasecmp(args->secondArg, "nsf"))
1354  {
1355  if(strncmp(p->obsmode, "CONTNSFC", 8))
1356  {
1357  incrementRejMode();
1358  continue;
1359  }
1360  }
1361 
1362  if(args->secondArg && (!strcasecmp(args->secondArg, "seq") || !strcasecmp(args->secondArg, "acc")))
1363  {
1364  if(strncmp(p->obsmode, "CONTSEQ", 7))
1365  {
1366  incrementRejMode();
1367  continue;
1368  }
1369  }
1370 
1371  if(args->secondArg && !strcasecmp(args->secondArg, "map"))
1372  {
1373  if(strncmp(p->obsmode, "CONTMAP", 7))
1374  {
1375  incrementRejMode();
1376  continue;
1377  }
1378  }
1379 
1380  if(args->secondArg && !strcasecmp(args->secondArg, "qk5"))
1381  {
1382  if(strncmp(p->obsmode, "CONTFIVE", 8) && strncmp(p->obsmode, "CONTQK5", 7))
1383  {
1384  incrementRejMode();
1385  continue;
1386  }
1387  }
1388 
1389  if(isScanIgnored(p->scan))
1390  {
1392  continue;
1393  }
1394 
1395  if(env->mode == MODE_SPEC)
1396  {
1397  if(env->bkres > 0.0 && fabs(fabs(p->freqres) - env->bkres) > 0.01)
1398  {
1400  continue; /* No good; backend resolution doesn't match */
1401  }
1402  }
1403 
1404  if(env->issmt && env->strictsb)
1405  {
1406  feed = getFeed(p->scan); /* 1, 2, 3, 4 */
1407 
1408  if(p->sideband == LSB)
1409  {
1410  if(feed == 2 || feed == 4)
1411  {
1412  incrementRejSb();
1413  continue;
1414  }
1415  }
1416  else
1417  if((int)p->sideband == USB)
1418  {
1419  if(feed == 1 || feed == 3)
1420  {
1421  incrementRejSb();
1422  continue;
1423  }
1424  }
1425  }
1426 
1427  if(isSet(PF_P_FLAG))
1428  {
1429  strncpy(source, p->object, 16);
1430  source[16] = '\0';
1431  strcmprs(source);
1432 
1433  if(isPlanet(source) == 0)
1434  {
1435  continue;
1436  }
1437  }
1438 
1439  printScan(p, printNsave);
1440 
1441  n++;
1442  }
1443 
1444  env->last_scan_count = n;
1445 
1446  if(n)
1447  {
1448  if(env->tsyslimit > 0.0)
1449  {
1450  st_warn("Found %d Scans Matching Criteria & Tsys < %.1f", n, env->tsyslimit);
1451  }
1452  else
1453  {
1454  st_warn("Found %d Scans Matching Criteria", n);
1455  }
1456  }
1457  else
1458  {
1459  st_fail("No Scans Matched Criteria");
1460 
1461  printRejections();
1462  }
1463 
1464  return(0);
1465 }
1466 
1467 
1468 
1473 int usage(name)
1474 char *name;
1475 {
1476  st_report(" ");
1477  st_report("Usage: %s [-hklrsvx] [-i init_file] [-g global_memory_file]", name);
1478  st_report("Where: -g Use named global_memory_file instead of default.");
1479  st_report(" -h Show this help and exit.");
1480  st_report(" -i Load init_file upon starting.");
1481  st_report(" -k Ignore LOCKFILE altogether.");
1482  st_report(" -l Turn on logging. Logfile will be named: linuxpops.$(PID).log");
1483  st_report(" -q Be quiet upon starting.");
1484  st_report(" -r Remove stale LOCKFILE before starting.");
1485  st_report(" -s Turn on Socket Communication to Monitor.");
1486  st_report(" -v Show version info and exit.");
1487  st_report(" -x Run init script and exit.");
1488  st_report(" ");
1489 
1490  exit(1);
1491 }
1492 
1493 
1499 {
1500  st_report("Current Date: %s", getcTime(0));
1501 
1502  return(0);
1503 }
1504 
1505 
1510 int about()
1511 {
1512  st_report("****************************************************************");
1513  st_report("* *");
1514  st_report("* Linuxpops *");
1515  st_report("* *");
1516  st_report("* Version: %s *", versionStr);
1517  st_report("* *");
1518  st_report("* Build Date: %32.32s *", dateStr);
1519  st_report("* Build Kernal: %32.32s *", machStr);
1520  st_report("* *");
1521  st_report("****************************************************************");
1522 
1523  return(0);
1524 }
1525 
1526 
1533 {
1534  if(env->mode == MODE_CONT)
1535  {
1536  sprintf(prompt, "Linuxpops(C) >> ");
1537  }
1538  else
1539  if(env->mode == MODE_SPEC)
1540  {
1541  sprintf(prompt, "Linuxpops(%s) >> ", h0->name);
1542  }
1543  else
1544  if(env->mode == MODE_OTF)
1545  {
1546  sprintf(prompt, "Linuxpops(O) >> ");
1547  }
1548  else
1549  {
1550  sprintf(prompt, "Linuxpops >> ");
1551  }
1552 
1553  rl_set_prompt(prompt);
1554 
1555  return(0);
1556 }
1557 
1558 
1559 
1565 int main(argc, argv)
1566 int argc;
1567 char *argv[];
1568 {
1569  int opt, manGlobal=0, read_config=0, remove_lockfile=0, ignore_lockfile=0, sockets=0, runandexit=0;
1570  char *cp, configName[256], cmdBuf[256];
1571  fd_set fds;
1572  int sel, len, nfds;
1573  static char message[4096*16];
1574 
1575 #ifdef TOMMIE
1576  int indx=0;
1577  time_t now, then;
1578 #endif
1579 
1580  sprintf(prompt, "Linuxpops(C) >> ");
1581 
1583 
1584  initParseArgs(); /* initialize the command stack args */
1585 
1586  srand(time(NULL)); /* Initalize the random number generator */
1587 
1588  cp = getenv("TERM");
1589 
1590  if(!cp)
1591  {
1592  no_terminal = 1;
1593  }
1594 
1595 
1596  /* Adjust the terminal slightly before the handler is installed. Disable
1597  * canonical mode processing and set the input character time flag to be
1598  * non-blocking.
1599  */
1600  if(!no_terminal)
1601  {
1602  if( tcgetattr(fileno(stdin), &term) < 0)
1603  {
1604  perror("tcgetattr");
1605  exit(1);
1606  }
1607  else
1608  {
1609  old_lflag = term.c_lflag;
1610  old_vtime = term.c_cc[VTIME];
1611  term.c_lflag &= ~ICANON;
1612  term.c_cc[VTIME] = 1;
1613 
1614  /* COMMENT LINE BELOW - see above */
1615  if( tcsetattr(fileno(stdin), TCSANOW, &term) < 0)
1616  {
1617  perror("tcsetattr");
1618  exit(1);
1619  }
1620  }
1621  }
1622 
1623  rl_catch_signals = 0; /* Tell the readline library to ignore signals */
1624 
1625  rl_callback_handler_install(prompt, process_line);
1626 /* The above function prints out the prompt, so newline it here */
1627  st_print("\n");
1628 
1629  while ((opt = getopt(argc, argv, "i:hg:krlvqsx")) != -1)
1630  {
1631  switch (opt)
1632  {
1633  case 'i':
1634  st_report("Setting Configuration File: %s", optarg);
1635  strcpy(configName, optarg);
1636  read_config = 1;
1637  break;
1638 
1639  case 'g':
1640  st_report("Using Global Memory %s", optarg);
1641  strcpy(globalName, optarg);
1642  sprintf(objGlobalName, "OBJ-%s", globalName);
1643  manGlobal = 1;
1644  break;
1645 
1646  case 'h':
1647  usage(argv[0]);
1648  break;
1649 
1650  case 'q':
1651  stquiet = 1;
1652  break;
1653 
1654  case 'r':
1655  remove_lockfile = 1;
1656  break;
1657 
1658  case 'k':
1659  ignore_lockfile = 1;
1660  doNotRemoveLockFile = 1;
1661  break;
1662 
1663  case 'l':
1664  logging = 1;
1665  break;
1666 
1667  case 's':
1668  sockets = 1;
1669  break;
1670 
1671  case 'v':
1672  about();
1673  usage(argv[0]);
1674  exit(0);
1675 
1676  break;
1677 
1678  case 'x':
1679  runandexit = 1;
1680  break;
1681 
1682  default: /* '?' */
1683  usage(argv[0]);
1684  break;
1685 
1686  }
1687  }
1688 
1689  if(logging)
1690  {
1691  sprintf(logfilename, "linuxpops.%d.log", getpid());
1692 
1693  if((errPrint_fp = fopen(logfilename, "w") ) <= (FILE *)0)
1694  {
1695  st_fail("main(): Unable to open logfile %s", logfilename);
1696  exit(1);
1697  }
1698 
1699  st_report("Using logging file: %s", logfilename);
1700  }
1701 
1702  initDvars();
1703 
1704  getEnvironment();
1705 
1706  init_readline();
1707 
1708  using_history(); /* Initiate the history library functions */
1709 
1710  stifle_history(256); /* Only remember the last 256 history entries */
1711 
1712  rwHistory(READ_HISTORY); /* Load in the previous session */
1713 
1714 
1715  if(!manGlobal)
1716  {
1717  sprintf(globalName, "LPMEMORY-64");
1718  sprintf(objGlobalName, "LPMEMORY-OBJ-64");
1719  }
1720 
1721  st_report("Using Global Memory File: %s", globalName);
1722 
1723  sprintf(lockFileName, "%s.LOCKFILE", globalName);
1724 
1725  if(remove_lockfile)
1726  {
1727  removeLockFile();
1728  }
1729 
1730  if(!ignore_lockfile)
1731  {
1732  if(!checkLockFile())
1733  {
1734  st_fail("main(): Unable to lock Global Memory %s", globalName);
1735  exit(1);
1736  }
1737  }
1738  else
1739  {
1740  st_report("Ignoring Lockfile altogether");
1741  }
1742 
1743  /* Remove that pesky reply for input buffer */
1744  fflush(stdin);
1745  rl_set_prompt(prompt);
1746 
1747  if(!gm_map(globalName, 1))
1748  {
1749  st_fail("main(): Unable to map global memory");
1750  exit(1);
1751  }
1752 
1753  correctBadChans();
1754 
1755  if(!obj_map(objGlobalName, 1))
1756  {
1757  st_fail("main(): Unable to map global memory");
1758  exit(1);
1759  }
1760 
1761  /* Check that object array has already been initialized */
1762  checkObjArray();
1763 
1764  about();
1765 
1766  initOnlineEnv();
1767 
1768  loadInitFile();
1769 
1770  tellEnv();
1771 
1772  loadCalibrators(NULL); /* Load the default alma calibrators */
1773 
1774  ffb_load();
1775 
1776  if(runandexit)
1777  {
1778  sockets = 0;
1779  }
1780 
1781  if(sockets)
1782  {
1783  st_report("Turning on Socket Communication");
1784 
1785  sock_bind("LINUXPOPS_MASTER");
1786  xgraphic = sock_connect("LINUXPOPS_XGRAPHIC");
1787  helper = sock_connect("LINUXPOPS_HELPER");
1788  dataserv = sock_connect("LINUXPOPS_DATASERV");
1789  monitorSock = sock_connect("MONITOR");
1790 
1791  sock_send(xgraphic, "page");
1792  sock_send(helper, "master");
1793 
1794  sock_bufct(sizeof(struct LP_IMAGE_INFO)+256);
1795 
1796  xfd = sock_fd(xgraphic);
1797  hfd = sock_fd(helper);
1798 
1799  st_report("Slave Socket fd = %d", xfd);
1800  st_report("Helper Socket fd = %d", hfd);
1801 
1802  if(xfd < 2)
1803  {
1804  st_fail("Slave Task not Present");
1805  exit(1);
1806  }
1807 
1808  if(hfd < 2)
1809  {
1810  st_fail("Helper Task not Present");
1811  exit(1);
1812  }
1813  }
1814 
1815  strcpy(H0.name, "H0");
1816  strcpy(H1.name, "H1");
1817  strcpy(H2.name, "H2");
1818  strcpy(H3.name, "H3");
1819  strcpy(H4.name, "H4");
1820  strcpy(H5.name, "H5");
1821  strcpy(H6.name, "H6");
1822  strcpy(H7.name, "H7");
1823  strcpy(H8.name, "H8");
1824  strcpy(H9.name, "H9");
1825 
1826  stquiet = 0;
1827 
1828  env->mode = MODE_CONT;
1829 
1830  stackEmpty(); /* reset the stack */
1831 
1832  setPrompt();
1833 
1834  initLetterHelp();
1835 
1836  initSignals();
1837 
1839 
1840  loadProto();
1841 
1842  lp_ppid = getppid();
1843  st_report("LinuxPops PID: %d", lp_ppid);
1844 
1845  if(read_config)
1846  {
1847  subArgs(2, configName);
1848  readConfig();
1849  }
1850 
1851  /* Quitely Load any predefined formulas */
1852  sprintf(cmdBuf, "formula /r /i /q .lp.formulas");
1853  parseCmd(cmdBuf);
1854 
1855 #ifdef TOMMIE
1856  now = then = time(NULL);
1857 #endif
1858 
1859  /* Main loop */
1860  while(1)
1861  {
1862  if(logging && errPrint_fp)
1863  {
1864  fflush(errPrint_fp);
1865  }
1866 
1867  rl_refresh_line(0, 0);
1868 
1869  FD_ZERO(&fds);
1870  nfds = 0;
1871 
1872  FD_SET(fileno(stdin), &fds);
1873  nfds++;
1874 
1875  if(xgraphic)
1876  {
1877  FD_SET(xfd, &fds);
1878  nfds++;
1879  }
1880 
1881  if(helper)
1882  {
1883  FD_SET(hfd, &fds);
1884  nfds++;
1885  }
1886 
1887  if(select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0)
1888  {
1889  /* Events like window resize; Ignore these for now */
1890  continue;
1891  }
1892 
1893  if(FD_ISSET(fileno(stdin), &fds))
1894  {
1895  rl_callback_read_char();
1896  }
1897 
1898 #ifdef TOMMIE
1899  /* Attempt to trap infinite loops cause by broken stdin */
1900 
1901  now = time(NULL);
1902 
1903  if(now != then)
1904  {
1905  if(indx > 100)
1906  {
1907  st_fail("Too many loops, %d, per second; exiting", indx);
1908 
1909  exit(1);
1910  }
1911 
1912  then = now;
1913  }
1914 
1915  indx++;
1916 #endif
1917 
1918  if(xgraphic) /* Check if any messages from xgraphic */
1919  {
1920  if(FD_ISSET(xfd, &fds))
1921  {
1922  sel = sock_sel(message, &len, NULL, 0, 1, 0);
1923 
1924  if(sel >0)
1925  {
1927  {
1928  printf("From Xgraphics Program: %s\n", message);
1929  }
1930 
1931  if(!strncmp(message, "XGRAPHIC", 8) && len == sizeof(xsend))
1932  {
1933  bcopy(message, (char *)&xsend, len);
1934 
1935  if(xsend.plot_used)
1936  {
1937  env->yplotmin = xsend.yplotmin;
1938  env->yplotmax = xsend.yplotmax;
1939  env->xplotmin = xsend.xplotmin;
1940  env->xplotmax = xsend.xplotmax;
1941  }
1942 
1943  if(xsend.map_angle_used)
1944  {
1945  env->map_angle[0] = xsend.map_angle_1;
1946  env->map_angle[1] = xsend.map_angle_2;
1947  }
1948  }
1949  }
1950  else
1951  if(sel == -1)
1952  {
1953  st_fail("Timeout waiting on read from xgraphic");
1954  }
1955  else
1956  {
1957  st_fail("Got strange sock_sel from xgraphic ret: %d", sel);
1958  }
1959 
1960  FD_CLR(xfd, &fds);
1961  }
1962  }
1963 
1964  if(helper) /* Check if any messages from helper */
1965  {
1966  if(FD_ISSET(hfd, &fds))
1967  {
1968  sel = sock_sel(message, &len, NULL, 0, 1, 0);
1969 
1970  if(sel >0)
1971  {
1972  if(strlen(message) > 2)
1973  {
1974  deNewLineIt(message);
1975 
1976  if(!strstr(message, "/q")) /* Ignore 'quite' messsages */
1977  {
1978  st_report("Attached: %s", message);
1979  }
1980 
1981  //add_history(message);
1982 
1983  parseCmd(message);
1984  }
1985  }
1986  else
1987  if(sel == -1)
1988  {
1989  st_fail("Timeout waiting on read from Helper");
1990  }
1991  else
1992  {
1993  st_fail("Got strange sock_sel from Helper ret: %d", sel);
1994  }
1995 
1996  FD_CLR(hfd, &fds);
1997  }
1998  }
1999 
2000 #ifdef TOMMIE
2001  if(dataserv && dfd > 1) /* Check if any messages from dataserv */
2002  {
2003  if(FD_ISSET(dfd, &fds))
2004  {
2005  sel = sock_sel(message, &len, NULL, 0, 1, 0);
2006 
2007  if(sel > 0)
2008  {
2009  st_print("Got message from Dataserv: %d bytes", len);
2010 
2012  {
2013  }
2014 
2015  if(strlen(message) > 2)
2016  {
2017  st_print("From Dataser: %s", message);
2018  }
2019  }
2020  else
2021  if(sel == -1)
2022  {
2023  st_fail("Timeout waiting on read from Dataserv");
2024  }
2025  else
2026  {
2027  st_fail("Got strange sock_sel from Dataserv ret: %d", sel);
2028  }
2029 
2030  FD_CLR(dfd, &fds);
2031  }
2032  }
2033 #endif
2034  }
2035 
2036  return(0);
2037 }
2038 
2039 
2046 {
2047  int i, len, n=0, remove = 0, iret;
2048  struct HEADER *p;
2049  char sysBuf[1024], *outFile;
2050  double ret;
2051 
2052  outFile = args->secondArg;
2053 
2054  len = strlen(outFile);
2055 
2056  remove = isSet(PF_R_FLAG);
2057 
2058  if(!len)
2059  {
2060  st_fail("Usage: prune output_file_name");
2061  return(1);
2062  }
2063 
2064 /* Can't go beyond here without a data file */
2065  if(!env->numofscans)
2066  {
2067  st_warn("No data file loaded");
2068 
2069  return(1);
2070  }
2071 
2072  if(remove)
2073  {
2074  st_report("Removing output file: %s", outFile);
2075 
2076  sprintf(sysBuf, "rm -f %s", outFile);
2077  system(sysBuf);
2078  }
2079 
2080  lp_new_sdd(outFile);
2081 
2082  p = &sa[0];
2083 
2084  for(i=0;i<env->numofscans;i++,p++)
2085  {
2086  if(!meetsCritiria(p, CHECK_ALL))
2087  {
2088  continue;
2089  }
2090 
2091  ret = read_scan(p->scan, env->filename, h0->yplot1, &h0->head, 0);
2092  env->curScan = p->scan;
2093 
2094  if(ret > 0.0)
2095  {
2096  iret = lp_write_sdd(outFile, &h0->head, (char *)&h0->yplot1);
2097 
2099  {
2100  st_report("lp_write_sdd() returned: %d", iret);
2101  }
2102  }
2103 
2104  printScan(p, printNsave);
2105  n++;
2106  }
2107 
2108  if(n)
2109  {
2110  st_warn("Wrote %d Scans Matching Criteria to %s", n, outFile);
2111  }
2112  else
2113  {
2114  st_fail("No Scans Matched Criteria");
2115  }
2116 
2117  return(0);
2118 }
2119 
2120 
2126 {
2127  if(strlen(args->secondArg))
2128  {
2129  if(!strcmp(args->secondArg, "1"))
2130  {
2131  st_report("Turning ON Socket Communication");
2132 
2133  sock_bind("ANONYMOUS");
2134  xgraphic = sock_connect("LINUXPOPS_XGRAPHIC");
2135 
2136  sock_send(xgraphic, "Hello");
2137  }
2138  else
2139  {
2140  st_report("Turning OFF Socket Communication");
2141  monitorSock = 0;
2142  }
2143  }
2144 
2145  return(0);
2146 }
2147 
2148 
2154 int parseMouseValues(x1, x2, y1, y2)
2155 double x1, x2, y1, y2;
2156 {
2157  double startVel, startRes;
2158  struct HEADER *h;
2159  struct LP_IMAGE_INFO *image = h0;
2160 
2161  last_mouse_x = x1;
2162  last_mouse_x2 = x2;
2163  last_mouse_y = y1;
2164  last_mouse_y2 = y2;
2165 
2166  if(env->mode == MODE_CONT)
2167  {
2168  return(0);
2169  }
2170 
2171  env->ccur = 0.0;
2172  env->fcur = 0.0;
2173  env->vcur = 0.0;
2174 
2175  h = &image->head;
2176 
2177  /* FIXME: trap unrealistic values here */
2178 
2179  switch(env->x1mode)
2180  {
2181  case XMODE_CHAN:
2182  env->ccur = x1;
2183  break;
2184 
2185  case XMODE_FREQ:
2186  env->fcur = x1;
2187  break;
2188 
2189  case XMODE_VEL:
2190  env->vcur = x1;
2191  break;
2192  }
2193 
2194  switch(env->x2mode)
2195  {
2196  case XMODE_CHAN:
2197  env->ccur = x2;
2198  break;
2199 
2200  case XMODE_FREQ:
2201  env->fcur = x2;
2202  break;
2203 
2204  case XMODE_VEL:
2205  env->vcur = x2;
2206  break;
2207  }
2208 
2209  /* By now, one or more of the 3 X-axis will still be 0.0, fix those */
2210 
2211  /* Compute the current channel so it can be used next */
2212  if(env->ccur == 0.0)
2213  {
2214  if(env->fcur != 0.0) /* One of these two should be non-zero */
2215  {
2216  env->ccur = mapFtoChan(env->fcur);
2217  }
2218  else
2219  if(env->vcur != 0.0)
2220  {
2221  env->ccur = mapVtoChan(env->vcur);
2222  }
2223  }
2224 
2225  /* The following can be directly computed */
2226  if(env->fcur == 0.0)
2227  {
2228  if(env->ccur != 0.0) /* Use the current channel number to computer Freq offset */
2229  {
2230  startRes = (float)h->refpt * h->freqres;
2231 
2232  if(h->sideband == 2.0)
2233  {
2234  env->fcur = startRes - (env->ccur * h->freqres);
2235  }
2236  else
2237  {
2238  env->fcur = -startRes + (env->ccur * h->freqres);
2239  }
2240  }
2241  else
2242  {
2243  st_fail("Should not get here: CCUR is still 0.0; Error #1");
2244  }
2245  }
2246 
2247  if(env->vcur == 0.0)
2248  {
2249  if(env->ccur != 0.0) /* Use the current channel number to computer vel */
2250  {
2251  startVel = h->refpt_vel - h->refpt * h->deltax;
2252 
2253  if( h->sideband == 2.0)
2254  {
2255  env->vcur = startVel + (env->ccur * h->deltax);
2256  }
2257  else
2258  {
2259  env->vcur = startVel - (env->ccur * h->deltax);
2260  }
2261  }
2262  else
2263  {
2264  st_fail("Should not get here: CCUR is still 0.0; Error #2");
2265  }
2266  }
2267 
2268  env->tcur = y1; /* For now all y-plotting uses only a single y axis */
2269 
2271  {
2272  st_report("Mouse Variables: ccur fcur vcur tcur");
2273  st_report("Set to: %7.3f, %7.3f, %7.3f, %7.3f", env->ccur, env->fcur, env->vcur, env->tcur);
2274  }
2275 
2276  return(0);
2277 }
2278 
2279 
2280 
2287 int getResponse(which)
2288 int which;
2289 {
2290  int sel, delay, len, ret;
2291  char message[4096];
2292 
2294  {
2295  st_report("Slave = %d, xfd = %d", xgraphic, xfd);
2296  st_report("getResponse(%d): Waiting on xgraphic response", which);
2297  }
2298 
2299  if(which == WAIT_FOR_MOUSE)
2300  {
2301  delay = 15;
2302  }
2303  else
2304  {
2305  delay = 3;
2306  }
2307 
2308  while(1)
2309  {
2310  sel = sock_sel(message, &len, NULL, 0, delay, 1);
2311 
2312  if(verboseLevel & VERBOSE_COMM)
2313  {
2314  st_report("sock_sel returned %d", sel);
2315  }
2316 
2317  if(sel == xfd)
2318  {
2319  if(verboseLevel & VERBOSE_COMM)
2320  {
2321  printf("%s\n", message);
2322  }
2323 
2324  if(!strncmp(message, "XGRAPHICS", 9) && len == sizeof(xsend))
2325  {
2326  bcopy(message, (char *)&xsend, sizeof(xsend));
2327 
2328  if(which == WAIT_FOR_MOUSE && xsend.mouse_used)
2329  {
2334 
2335  return(ret);
2336  }
2337  else
2338  if(which == WAIT_FOR_PLOT && xsend.plot_used)
2339  {
2340  env->yplotmin = xsend.yplotmin;
2341  env->yplotmax = xsend.yplotmax;
2342  env->xplotmin = xsend.xplotmin;
2343  env->xplotmax = xsend.xplotmax;
2344 
2345  return(0);
2346  }
2347  else
2348  if(which == WAIT_FOR_MAP_ANGLE && xsend.map_angle_used)
2349  {
2350  env->map_angle[0] = xsend.map_angle_1;
2351  env->map_angle[1] = xsend.map_angle_2;
2352 
2353  return(0);
2354  }
2355  }
2356  }
2357  else
2358  if(sel == 0)
2359  {
2360  st_report("Keyboard Hit");
2361  sendCancel();
2362 
2363  return(1);
2364  }
2365  else
2366  if(sel == -1)
2367  {
2368  st_fail("Timeout waiting on read from xgraphic");
2369  sendCancel();
2370 
2371  return(1);
2372  }
2373  else
2374  {
2375  st_fail("Got strange sock_sel ret: %d", sel);
2376  sendCancel();
2377 
2378  return(1);
2379  }
2380  }
2381 
2382  return(1);
2383 }
2384 
2385 
2387 {
2388  sock_send(xgraphic, "cancel");
2389 
2390  return(0);
2391 }
2392 
2393 
2398 int doCCur()
2399 {
2400  _doCCur("");
2401 
2402  return(0);
2403 }
2404 
2405 
2411 int _doCCur(msg)
2412 char *msg;
2413 {
2414  if(xgraphic)
2415  {
2416  env->ccur = 0; /* reset first */
2417 
2418  if(strlen(msg) > 3)
2419  {
2420  st_report(msg);
2421  }
2422 
2423  sock_send(xgraphic, "ccur");
2424 
2426  {
2427  st_report("ccur set to %d", (int)round(env->ccur));
2428  }
2429  else
2430  {
2431  return(1);
2432  }
2433  }
2434 
2435  return(0);
2436 }
2437 
2438 
2449 {
2450  if(gnuplotLevel < 4.4) /* Must be this level to support query of map angle */
2451  {
2452  return(0);
2453  }
2454 
2455  if(xgraphic)
2456  {
2457  sock_send(xgraphic, "show_view");
2458 
2460  {
2461  if(isSet(PF_V_FLAG))
2462  {
2463  st_report("doGetMapAngle(): map angle set to %.1f %.1f", env->map_angle[0], env->map_angle[1]);
2464  }
2465  }
2466  else
2467  {
2468  return(1);
2469  }
2470  }
2471 
2472  return(0);
2473 }
2474 
2475 
2480 int doFCur()
2481 {
2482  _doFCur("");
2483 
2484  return(0);
2485 }
2486 
2487 
2493 int _doFCur(msg)
2494 char *msg;
2495 {
2496  if(xgraphic)
2497  {
2498  if(strlen(msg) > 3)
2499  {
2500  st_report(msg);
2501  }
2502 
2503  sock_send(xgraphic, "ccur");
2504 
2506  {
2507  st_report("fcur set to %e", env->fcur);
2508  }
2509  else
2510  {
2511  return(1);
2512  }
2513  }
2514 
2515  return(0);
2516 }
2517 
2518 
2519 
2524 int doVCur()
2525 {
2526  _doVCur("");
2527 
2528  return(0);
2529 }
2530 
2531 
2537 int _doVCur(msg)
2538 char *msg;
2539 {
2540  if(xgraphic)
2541  {
2542  if(strlen(msg) > 3)
2543  {
2544  st_report(msg);
2545  }
2546 
2547  sock_send(xgraphic, "ccur");
2548 
2550  {
2551  st_report("vcur set to %e", env->vcur);
2552  }
2553  else
2554  {
2555  return(1);
2556  }
2557  }
2558 
2559  return(0);
2560 }
2561 
2562 
2567 int doTCur()
2568 {
2569  _doTCur("");
2570 
2571  return(0);
2572 }
2573 
2574 
2580 int _doTCur(msg)
2581 char *msg;
2582 {
2583  if(xgraphic)
2584  {
2585  if(strlen(msg) > 3)
2586  {
2587  st_report(msg);
2588  }
2589 
2590  sock_send(xgraphic, "tcur");
2591 
2593  {
2594  st_report("tcur set to %e", env->tcur);
2595  }
2596  else
2597  {
2598  return(1);
2599  }
2600  }
2601 
2602  return(0);
2603 }
2604 
2605 
2606 
2612 {
2613  if(xgraphic)
2614  {
2615  st_report("Clearing Plot Window");
2616 
2617  sock_send(xgraphic, "page");
2618  }
2619 
2620  return(0);
2621 }
2622 
2623 
2629 {
2630  char sysBuf[1024];
2631 
2632  if(strlen(env->filename))
2633  {
2634  sprintf(sysBuf, "dumpscans %s %s %s %s %s %s %s", env->filename,
2636 
2637 // st_report(sysBuf);
2638 
2639  system(sysBuf);
2640  }
2641  else
2642  {
2643  st_fail("Data File Name not set");
2644  }
2645 
2646 
2647  return(0);
2648 }
2649 
2650 
2656 {
2657  char sbuf[256], fbuf[256], sysBuf[1024];
2658 
2659  if(isSet(PF_G_FLAG))
2660  {
2661  if(env->check_source)
2662  {
2663  sprintf(sbuf, " | grep -i %s", env->source);
2664  }
2665  else
2666  {
2667  strcpy(sbuf, " ");
2668  }
2669 
2670  if(env->check_freq)
2671  {
2672  sprintf(fbuf, " | grep %.6f", env->freq);
2673  }
2674  else
2675  {
2676  strcpy(fbuf, " ");
2677  }
2678 
2679  sprintf(sysBuf, "dumpscans %s %s %s", env->gfilename, sbuf, fbuf);
2680 
2681  if(isSet(PF_P_FLAG))
2682  {
2683  strcat(sysBuf, " | less");
2684  }
2685 
2686  system(sysBuf);
2687  }
2688  else
2689  if(isSet(PF_C_FLAG))
2690  {
2691  sprintf(sysBuf, "dumpscans -c %s ", env->gfilename);
2692  system(sysBuf);
2693  }
2694  else
2695  if(strlen(env->gfilename))
2696  {
2697  sprintf(sysBuf, "dumpscans %s %s %s %s %s %s %s", env->gfilename,
2699 
2700  st_report(sysBuf);
2701 
2702  if(isSet(PF_P_FLAG))
2703  {
2704  strcat(sysBuf, " | less");
2705  }
2706 
2707  system(sysBuf);
2708  }
2709  else
2710  {
2711  st_fail("Gains File Name not set");
2712  }
2713 
2714  return(0);
2715 }
2716 
2717 
2723 {
2724  char sysBuf[256], *cp;
2725 
2726  if(isSet(PF_S_FLAG))
2727  {
2728  cp = env->savefile;
2729  }
2730  else
2731  {
2732  cp = env->filename;
2733  }
2734 
2735  sprintf(sysBuf, "checkfile %s %s %s %s %s %s %s", cp,
2737 
2738  st_report(sysBuf);
2739 
2740  system(sysBuf);
2741 
2742  return(0);
2743 }
2744 
2745 
2751 {
2752  char sysBuf[512];
2753 
2754  sprintf(sysBuf, "check_sdd %s %s %s %s %s %s", env->filename,
2756 
2757  system(sysBuf);
2758 
2759  return(0);
2760 }
2761 
2762 
2768 int lp_fcmp(first, second, delta)
2769 double first, second, delta;
2770 {
2771  double fdiff;
2772 
2773  fdiff = fabs(first-second);
2774 
2775  if(fdiff < delta)
2776  {
2777  return(0);
2778  }
2779 
2780  return(1);
2781 }
2782 
2783 
2789 {
2790  st_report("Setting X & Y axis to Autoscale");
2791  freeX();
2792  freeY();
2793 
2794  return(0);
2795 }
2796 
2797 
2803 {
2804  if(env->mode == MODE_CONT)
2805  {
2806  env->yaxis_scale = LOG_PLOT;
2807  }
2808  else
2809  {
2811  }
2812 
2813  return(0);
2814 }
2815 
2816 
2822 {
2823  env->yaxis_scale = LINEAR_PLOT;
2824 
2825  return(0);
2826 }
2827 
2828 
2837 double restFreq(h)
2838 struct HEADER *h;
2839 {
2840  double freq;
2841 
2842  if(env->issmt)
2843  {
2844  if(env->mode == MODE_CONT)
2845  {
2846  if(h->burn_time > 1455213600.0)
2847  {
2848  freq = (h->restfreq);
2849  }
2850  else
2851  {
2852  freq = (h->obsfreq);
2853  }
2854  }
2855  }
2856  else
2857  {
2858  if(env->mode == MODE_CONT)
2859  {
2860  freq = (h->obsfreq);
2861  }
2862  else
2863  {
2864  freq = (h->restfreq);
2865  }
2866  }
2867 
2868 /* Trap the stupid DSF / restfreq BS */
2869  if(freq == 10000.0)
2870  {
2871  freq = h->obsfreq;
2872  }
2873 
2874  return(freq);
2875 }
2876 
2877 
2883 {
2884  if(xgraphic)
2885  {
2886  sock_send(xgraphic, "refresh");
2887  }
2888 
2889  return(0);
2890 }
2891 
2897 {
2898  if(isSet(PF_C_FLAG))
2899  {
2900  env->xplotmin = 0.0;
2901  env->xplotmax = 0.0;
2902  env->yplotmin = 0.0;
2903  env->yplotmax = 0.0;
2904 
2905  return(0);
2906  }
2907 
2908  if(xgraphic)
2909  {
2910  sock_send(xgraphic, "get_range");
2911  }
2912 
2913  return(0);
2914 }
2915 
2916 
2918 {
2919  int i;
2920  char bigBuf[512], tbuf[512];
2921 
2922  if(isSet(PF_X_FLAG))
2923  {
2924  bigBuf[0] = '\0';
2925  }
2926  else
2927  {
2928  strcpy(bigBuf, "xgraphic ");
2929  }
2930 
2931  if(args->ntokens > 1)
2932  {
2933  for(i=1;i<args->ntokens;i++)
2934  {
2935  sprintf(tbuf, "%s ", args->tok[i]);
2936  strcat(bigBuf, tbuf);
2937  }
2938 
2939  if(xgraphic)
2940  {
2942  {
2943  st_report("Sending: %s to xgraphic", bigBuf);
2944  }
2945 
2946  sock_send(xgraphic, bigBuf);
2947  }
2948  }
2949  else
2950  {
2951  printH_FlagHelp("xgraphic");
2952  }
2953 
2954  return(0);
2955 }
2956 
2957 
2958 
2960 {
2961  int i, t, len;
2962  char response[256];
2963  char message[1024];
2964  double start, end;
2965 
2966  if(args->ntokens < 3)
2967  {
2968  printH_FlagHelp("helperWait");
2969 
2970  return(1);
2971  }
2972 
2973  strcpy(response, args->secondArg);
2974  t = atoi(args->thirdArg);
2975 
2976  start = getmJulDate(0);
2977 
2978  if(t > 1)
2979  {
2980  clearInterrupt();
2981 
2982  st_report("helperWait(): Waiting for '%s', for %d Secs", response, t);
2983 
2984  for(i=0;i<t;i++)
2985  {
2986  len = sock_only(helper, message, 1);
2987 
2988  if(len > 0)
2989  {
2990  if(!strncmp(message, response, strlen(response)))
2991  {
2992  end = getmJulDate(0);
2993 
2994  st_report("Got %s, from helper in %.2f sec(s)", message, (end-start)*86400.0);
2995 
2996  return(0);
2997  }
2998  }
2999 
3000  if(isInterrupt()) /* Check for Control-C input */
3001  {
3002  end = getmJulDate(0);
3003 
3004  st_report("Got Control-C input in %.2f sec(s)", (end-start)*86400.0);
3005 
3006  return(0);
3007  }
3008  }
3009  }
3010 
3011  end = getmJulDate(0);
3012 
3013  st_report("Timeout in %.2f sec(s)", (end-start)*86400.0);
3014 
3015  return(1);
3016 }
3017 
3018 
3019 /* Wait on a binary reply */
3021 {
3022  int i, t, len;
3023  char message[sizeof(struct DS_IMAGE_INFO)+256];
3024 
3025  if(args->ntokens < 2)
3026  {
3027  printH_FlagHelp("helperWait");
3028 
3029  return(1);
3030  }
3031 
3032  t = atoi(args->secondArg);
3033 
3034  if(t > 1)
3035  {
3036  clearInterrupt();
3037 
3038  st_report("helperWait(): Waiting for DS_IMAGE_INFO, for %d Secs", t);
3039 
3040  for(i=0;i<t;i++)
3041  {
3042  len = sock_only(helper, message, 1);
3043 
3044  if(len == sizeof(struct DS_IMAGE_INFO))
3045  {
3046  st_report("Got DS_IMAGE_INFO, from helper in %d sec(s)", i+1);
3047 
3048  bcopy(message, (char *)&ds_image_info, sizeof(ds_image_info));
3049 
3050  return(0);
3051  }
3052 
3053  if(isInterrupt()) /* Check for Control-C input */
3054  {
3055  return(0);
3056  }
3057  }
3058  }
3059 
3060  st_fail("Timeout in helperWait(); or 0 timeout");
3061 
3062  return(1);
3063 }
3064 
3069 int doSleep()
3070 {
3071  long uSec;
3072 
3073  if(strlen(args->secondArg))
3074  {
3075  uSec = atol(args->secondArg);
3076 
3077  if(uSec > 0)
3078  {
3079  usleep(uSec);
3080 
3081  return(0);
3082  }
3083  }
3084 
3085  return(0);
3086 }
3087 
3088 
3093 int doPause()
3094 {
3095  int ret;
3096 
3097  ret = getYesNoQuit("Press Any Key to Continue");
3098 
3099  return(ret);
3100 }
3101 
3102 
3107 int showID()
3108 {
3109  st_report("Session: /tmp/%s", session);
3110  st_report("scan.dem: /tmp/%s/scan.dem", session);
3111  st_report("setenv MAILBOXDEFS %s", getenv("MAILBOXDEFS"));
3112 
3113  return(0);
3114 }
3115 
3116 
3118 {
3119  int ret;
3120  char sysBuf[256];
3121 
3122  if(strlen(args->secondArg))
3123  {
3124  sprintf(sysBuf, "%s %s %s &", args->secondArg, getenv("MAILBOXDEFS"), globalName);
3125  }
3126  else
3127  {
3128  st_fail("Missing arg for attach");
3129  return(1);
3130  }
3131 
3132  ret = system(sysBuf);
3133 
3134  return(ret);
3135 }
3136 
3137 
3139 {
3140  subArgs(2, "greview");
3141 
3142  doAttach();
3143 
3144  return(0);
3145 }
3146 
3147 
3148 int doPGUI()
3149 {
3150  subArgs(2, "paramgui");
3151 
3152  doAttach();
3153 
3154  return(0);
3155 }
3156 
3157 
3159 {
3160  int i, j=0;
3161  struct SOURCES *p=0;
3162  FILE *fp;
3163 
3164  if(strlen(args->secondArg) < 2)
3165  {
3166  st_fail("Missing arg for writeirc");
3167  return(0);
3168  }
3169 
3170  p = findSourceInList("IRC+10216");
3171 
3172  if(!p)
3173  {
3174 
3175  st_fail("IRC+10216 not found in %s", env->filename);
3176  return(1);
3177  }
3178 
3179  if((fp = fopen(args->secondArg, "a") ) <= (FILE *)0)
3180  {
3181  st_fail("writeIRC_Record(): Unable to open file %s", args->secondArg);
3182  return(1);
3183  }
3184 
3185  fprintf(fp, "%64.64s", env->filename);
3186 
3187  for(i=0;i<MAX_FREQS;i++)
3188  {
3189  if(p->freqs[i].used)
3190  {
3191  fprintf(fp, " %7.3f %5d", p->freqs[i].freq / 1000.0, p->freqs[i].count);
3192  j++;
3193 
3194  if(j > 1 && !(j%10))
3195  {
3196  fprintf(fp, "\n ");
3197  }
3198  }
3199  }
3200 
3201  fprintf(fp, "\n");
3202 
3203  st_report("Wrote (1) record to %s", args->secondArg);
3204 
3205  fclose(fp);
3206 
3207  return(0);
3208 }
3209 
3210 
3211 /* Orphaned Function */
3213 {
3214  char tbuf[1024];
3215  FILE *fp;
3216 
3217  if(strlen(args->secondArg))
3218  {
3219  if((fp = fopen(args->secondArg, "a") ) <= (FILE *)0)
3220  {
3221  st_fail("recordTests(): Unable to open file %s", args->secondArg);
3222  return(1);
3223  }
3224 
3225  sprintf(tbuf, "%4d, %8.8s, %5d, %8.8s, %16.16s, %4d - %4d, http://aro.as.arizona.edu/~tfolkers/ftp/12m_filter_tests2/%s",
3226  (int)fabs(h0->head.freqres*1000.0),
3227  env->backend,
3228  (int)(h0->head.noint),
3229  h0->head.obsmode,
3230  h0->head.object,
3231  (int)env->bscan,
3232  (int)env->escan,
3234 
3235  st_print("Recording: %s\n", tbuf);
3236  fprintf(fp, "%s\n", tbuf);
3237 
3238  fclose(fp);
3239  }
3240  else
3241  {
3242  st_fail("Missing arg for recordtests");
3243  return(1);
3244  }
3245 
3246  return(0);
3247 }
3248 
3249 
3250 int doSay()
3251 {
3252  int i;
3253  char outBuf[1024], tbuf[512], *cp;
3254 
3255  outBuf[0] = '\0';
3256  for(i=1;i<args->ntokens;i++)
3257  {
3258  sprintf(tbuf, "%s ", args->tok[i]);
3259  strcat(outBuf, tbuf);
3260  }
3261 
3262  for(cp=outBuf;*cp;cp++)
3263  {
3264  if(*cp == '\"')
3265  {
3266  *cp = ' ';
3267  }
3268 
3269  if(*cp == '\'')
3270  {
3271  *cp = ' ';
3272  }
3273  }
3274 
3275  strcmprs(outBuf);
3276 
3277  st_print("%s\n", outBuf);
3278 
3279  return(0);
3280 }
3281 
3282 
3284 {
3285  int n;
3286  char sysbuf[1024], lbuf[256], sbuf[256], cbuf[256];
3287 
3288  bzero(lbuf, sizeof(lbuf));
3289  bzero(sbuf, sizeof(sbuf));
3290  bzero(cbuf, sizeof(cbuf));
3291 
3292  if(isSet(PF_L_FLAG))
3293  {
3294  sprintf(lbuf, "-o landscape");
3295  }
3296 
3297  if(isSet(PF_B_FLAG))
3298  {
3299  sprintf(sbuf, "-o media=11x17");
3300  }
3301 
3302  n = strlen(args->secondArg);
3303  if(n && !strncmp(args->secondArg, "cpi", 3))
3304  {
3305  sprintf(cbuf, "-o cpi=%s", args->secondArg+3);
3306  }
3307 
3308  n = strlen(args->thirdArg);
3309  if(n && !strncmp(args->thirdArg, "cpi", 3))
3310  {
3311  sprintf(cbuf, "-o cpi=%s", args->thirdArg+3);
3312  }
3313 
3314  n = strlen(args->fourthArg);
3315  if(n && !strncmp(args->fourthArg, "cpi", 3))
3316  {
3317  sprintf(cbuf, "-o cpi=%s", args->fourthArg+3);
3318  }
3319 
3320  sprintf(sysbuf, "xclip -o | lpr %s %s %s", lbuf, sbuf, cbuf);
3321 
3322  st_report(sysbuf);
3323 
3324  system(sysbuf);
3325 
3326  st_report("Job sent to %s", printer);
3327 
3328  return(0);
3329 }
3330 
3331 
3333 {
3334  int len;
3335  char sysBuf[512], file[256];
3336  struct COMMANDS *p;
3337 
3338  p = &commands[0];
3339  len = strlen(args->secondArg);
3340 
3341  if(len)
3342  {
3343  for(;p->cmd;p++)
3344  {
3345  if(!strncasecmp(p->cmd, args->secondArg, len))
3346  {
3347  if(!findFunction(p->fctnStr, file))
3348  {
3349  sprintf(sysBuf, "vim +/%s %s/linuxpops/%s", p->fctnStr, pkg_home, file);
3350 
3351  if(isSet(PF_N_FLAG)) /* Just print it */
3352  {
3353  st_report("Exec: %s", sysBuf);
3354  }
3355  else /* Else, Actually edit file */
3356  {
3357  system(sysBuf);
3358  }
3359  }
3360 
3361  return(0);
3362  }
3363  }
3364  }
3365  else
3366  {
3367  printH_FlagHelp("codeview");
3368  }
3369 
3370  return(1);
3371 }
3372 
3373 
3374 int doTCSH()
3375 {
3376  system("/bin/tcsh");
3377 
3378  return(0);
3379 }
3380 
3381 
3383 {
3384  char *cp, sysBuf[256], pid[80];
3385 
3386  cp = strchr(session, '-');
3387 
3388  if(cp)
3389  {
3390  cp++;
3391 
3392  strcpy(pid, cp);
3393 
3394  st_report("Starting XGraphic log watcher");
3395 
3396  sprintf(sysBuf, "xterm -tn %s -geometry 142x45+1210+22 -e tail -f /tmp/%s/xgraphic.log /tmp/%s/xgraphic.stdout.log &", pid, session, session);
3397 
3398  system(sysBuf);
3399  }
3400 
3401  return(0);
3402 }
3403 
3404 
3406 {
3407  char *cp, sysBuf[256], pid[80];
3408 
3409  cp = strchr(session, '-');
3410 
3411  if(cp)
3412  {
3413  cp++;
3414 
3415  strcpy(pid, cp);
3416 
3417  st_report("Starting Logger watcher");
3418 
3419  sprintf(sysBuf, "startlogwatch.csh %s %s &", pid, session);
3420 // "xterm -tn %s -geometry 165x36+450+530 -e tail -f /tmp/%s/logger.log /tmp/%s/logger.stdout.log /tmp/%s/xgraphic.stdout.log &",
3421 // pid, session, session, session);
3422 
3423  system(sysBuf);
3424  }
3425 
3426  return(0);
3427 }
3428 
3429 
3430 int doDone()
3431 {
3432 
3433  st_report("Got random 'done' command");
3434 
3435  return(0);
3436 }
3437 
3438 
3439 int doStop()
3440 {
3441  if(doingOTF)
3442  {
3443  to_dataserv("stop");
3444  to_dataserv("done");
3445  }
3446 
3447  return(0);
3448 }
3449 
3450 
3451 int doVi()
3452 {
3453  char tbuf[256];
3454 
3455  if(args->ntokens > 1)
3456  {
3457  sprintf(tbuf, "vim %s", args->secondArg);
3458 
3459  system(tbuf);
3460  }
3461  else
3462  {
3464  return(1);
3465  }
3466 
3467  return(0);
3468 }
3469 
3470 
3471 int doMv()
3472 {
3473  char tbuf[256];
3474 
3475  if(args->ntokens > 2)
3476  {
3477  sprintf(tbuf, "mv %s %s %s %s %s", args->secondArg,
3478  args->thirdArg,
3479  args->fourthArg,
3480  args->fifthArg,
3481  args->sixthArg);
3482 
3483  strcmprs(tbuf);
3484 
3485  system(tbuf);
3486  }
3487  else
3488  {
3490  return(1);
3491  }
3492 
3493  return(0);
3494 }
3495 
3496 
3497 int doCP()
3498 {
3499  char tbuf[256];
3500 
3501  if(args->ntokens > 2)
3502  {
3503  sprintf(tbuf, "cp %s %s %s %s %s", args->secondArg,
3504  args->thirdArg,
3505  args->fourthArg,
3506  args->fifthArg,
3507  args->sixthArg);
3508 
3509  strcmprs(tbuf);
3510 
3511  system(tbuf);
3512  }
3513  else
3514  {
3516  return(1);
3517  }
3518 
3519  return(0);
3520 }
3521 
3522 
3524 {
3525  int pid;
3526  char tbuf[256];
3527  char fname[256];
3528 
3529 
3530  if(isSet(PF_A_FLAG))
3531  {
3532  pid = rand();
3533  pid = pid%32767;
3534 
3535  makeFileName(fname, pid);
3536 
3537  sprintf(tbuf, "cp /tmp/%s/scan.dat %s.raw", session, fname);
3538  }
3539  else
3540  if(args->ntokens > 1)
3541  {
3542  sprintf(tbuf, "cp /tmp/%s/scan.dat %s", session, args->secondArg);
3543  }
3544  else
3545  {
3547  return(1);
3548  }
3549 
3550  strcmprs(tbuf);
3551  st_report(tbuf);
3552 
3553  system(tbuf);
3554 
3555  return(0);
3556 }
3557 
3558 
3559 int xdelay(d)
3560 int d;
3561 {
3562  if(env->xdelay)
3563  {
3564  st_report("xdelay(): Delaying: %.0f mSec", (double)env->xdelay / 1e3);
3565  usleep(env->xdelay);
3566  }
3567  else
3568  {
3569  st_report("xdelay(): Delaying: %.0f mSec", (double)d / 1e3);
3570  usleep(d);
3571  }
3572 
3573  return(0);
3574 }
struct SOCK * dataserv
Definition: linuxpops.c:75
struct SOCK * xgraphic
Definition: linuxpops.c:75
double last_mouse_x
Definition: global.h:49
int cont_display_sequence(struct LP_IMAGE_INFO *image, int plot)
Definition: cont.c:1868
float yplot1[MAX_CHANS]
Definition: image.h:110
struct LP_IMAGE_INFO * h0
Definition: image.c:74
#define LSB
int removeLockFile()
Definition: io.c:362
int plot_used
Definition: global.h:39
int xx()
Definition: linuxpops.c:605
int getFeed()
double az
Definition: header.h:82
double scan
Definition: header.h:35
#define BKMATCH_RESOLUTION
Definition: defines.h:122
double tcur
Definition: env.h:271
struct MEASUREMENT measurements[MAX_MEASUREMENTS]
Definition: object.h:102
int history_already_written
Definition: linuxpops.c:90
int doMv()
Definition: linuxpops.c:3471
int main(void)
Definition: gsl_try_2.c:176
double curScan
Definition: env.h:178
#define BSP
Definition: observing_par.h:30
struct LP_IMAGE_INFO H7
Definition: image.c:70
char * mg_sideband[]
Definition: strings.c:78
#define LOG_PLOT
Definition: defines.h:111
int setLogPlot()
Definition: linuxpops.c:2802
double dfreq
Definition: env.h:183
int loadInitFile()
Definition: config.c:288
int doTCSH()
Definition: linuxpops.c:3374
struct LP_IMAGE_INFO H1
Definition: image.c:64
#define NS_FOCALIZE
Definition: observing_par.h:47
float efreq
Definition: flux.h:23
int tellWeather()
Definition: observe.c:1142
int findFunction(char *func, char *file)
Definition: parseProto.c:153
char pkg_home[256]
Definition: makemem.c:97
char * strcmprs(char *str)
char * prompt
Definition: makemem.c:101
double yplotmax
Definition: env.h:286
int incrementBogusTsys(void)
Definition: reject.c:217
#define MODE_OTF
Definition: defines.h:88
struct FLUX_HISTORY flux_history
Definition: alma.c:73
#define LAST_PLOT_CONT_SPTIP
Definition: defines.h:162
int first
Definition: dbase.c:106
#define LAST_PLOT_SPEC_HISTO
Definition: defines.h:158
int checkObjArray()
Definition: object.c:82
#define MAX_FREQS
Definition: global.h:11
struct PARSE_STACK * args
Definition: parse.h:196
struct COMMANDS commands[]
Definition: commands.c:76
int listSaves()
Definition: io.c:1273
int x1mode
Definition: env.h:145
struct ACCUM_RESULTS_SEND accum_results_send
Definition: cont.c:62
int numMeas
Definition: object.h:75
int deNewLineIt(char *buf)
int doCheckFile()
Definition: linuxpops.c:2722
double last_mouse_y2
Definition: global.h:52
int doPause()
Definition: linuxpops.c:3093
double noint
Definition: header.h:211
double utdate
Definition: header.h:61
Definition: parse.h:8
int correctBadChans()
Definition: badchan.c:688
int dfd
Definition: linuxpops.c:85
char * kp_sideband[]
Definition: strings.c:72
char source[32]
Definition: object.h:72
double last_mouse_x
Definition: env.c:82
double gnuplotLevel
Definition: env.c:87
int suggestFileName()
Definition: linuxpops.c:362
struct OBJECT_GLOBAL_MEMORY * obj_map()
struct LP_IMAGE_INFO H2
Definition: image.c:65
struct LP_IMAGE_INFO H0
Definition: image.c:63
int doLogWatch()
Definition: linuxpops.c:3405
struct GLOBAL_MEMORY * gm_map()
double xplotmin
Definition: global.h:46
double yplotmin
Definition: global.h:44
char * seventhArg
Definition: parse.h:186
int rwHistory(int rw)
Definition: history.c:114
int lp_fcmp(double first, double second, double delta)
Definition: linuxpops.c:2768
int getEnvironment()
Definition: env.c:477
char source[SRCLEN+1]
Definition: dataserv.c:52
char * cmd
Definition: commands.h:5
int initGnuplotBackground()
Definition: display.c:100
int doSysCmd()
Definition: linuxpops.c:642
float escan
Definition: image.h:53
#define CTR
Definition: defines.h:26
int xdelay(int d)
Definition: linuxpops.c:3559
char name[80]
Definition: flux.h:31
int doSleep()
Definition: linuxpops.c:3069
double ccur
Definition: env.h:176
int read_scan()
int helperBinaryWait()
Definition: linuxpops.c:3020
char name[32]
Definition: image.h:73
int getPlotExtents()
Definition: linuxpops.c:2896
int tellAllSpec5()
Definition: linuxpops.c:995
struct termios term
Definition: linuxpops.c:68
#define MODE_CONT
Definition: defines.h:86
struct SOURCES * findSourceInList()
#define WAIT_FOR_MAP_ANGLE
Definition: global.h:34
struct DS_IMAGE_INFO ds_image_info
Definition: linuxpops.c:64
FILE * fp
Definition: linuxpops.c:70
int sock_only(struct SOCK *handle, char *message, int tim)
Definition: header.h:13
int isInterrupt()
Definition: interrupt.c:152
int linePlot(struct LP_IMAGE_INFO *image)
Definition: line.c:799
char * fifthArg
Definition: parse.h:184
int printH_FlagHelp(char *cmd)
Definition: help.c:430
struct LP_IMAGE_INFO H5
Definition: image.c:68
int doGReview()
Definition: linuxpops.c:3138
int initOnlineEnv()
Definition: env.c:621
char gfilename[256]
Definition: env.h:10
double tcal
Definition: header.h:202
int incrementRejSb(void)
Definition: reject.c:138
#define ACCUM_SCANS_MODE
Definition: extended_pars.h:4
#define LAST_PLOT_FLUX_HISTORY
Definition: defines.h:166
int xdelay
Definition: env.h:144
struct LP_IMAGE_INFO H9
Definition: image.c:72
int about()
Definition: linuxpops.c:1510
int sendCancel()
Definition: linuxpops.c:2386
#define SP_TIP
Definition: observing_par.h:49
int stquiet
Definition: env.c:90
struct HEADER * sa
Definition: linuxpops.c:72
int doStop()
Definition: linuxpops.c:3439
#define WRITE_HISTORY
Definition: makemem.c:85
int showID()
Definition: linuxpops.c:3107
#define BKMATCH_NAME
Definition: defines.h:123
int setPrompt()
Definition: linuxpops.c:1532
int issmt
Definition: env.h:63
int tellEnv()
Definition: env.c:360
float bscan
Definition: image.h:52
int doSelPrint()
Definition: linuxpops.c:3283
int last_valid
Definition: linuxpops.c:78
int doDumpGains()
Definition: linuxpops.c:2655
int check_freq
Definition: env.h:42
char * versionStr
Definition: build.c:3
char name[80]
Definition: flux.h:15
double openpar[10]
Definition: header.h:155
int setSockets()
Definition: linuxpops.c:2125
#define LAST_PLOT_FLUX_INFO
Definition: defines.h:165
int getResponse(int which)
Definition: linuxpops.c:2287
Definition: global.h:21
#define LAST_PLOT_OTF_CUT
Definition: defines.h:168
int doCodeView()
Definition: linuxpops.c:3332
double sideband
Definition: header.h:143
int incrementRejIgnored(void)
Definition: reject.c:169
char tok[MAX_TOKENS][MAX_TOKENS]
Definition: parse.h:176
double date
Definition: env.h:182
double restFreq(struct HEADER *h)
Definition: linuxpops.c:2837
char * dateStr
Definition: build.c:4
int writeIRC_Record()
Definition: linuxpops.c:3158
int doSay()
Definition: linuxpops.c:3250
int clearInterrupt()
Definition: interrupt.c:144
int notSet(int flag)
Definition: parse.c:669
int sock_fd(struct SOCK *handle)
struct HEADER head
Definition: accum.h:115
int helperWait()
Definition: linuxpops.c:2959
int doXwatch()
Definition: linuxpops.c:3382
#define VERBOSE_FILEOPS
Definition: defines.h:76
#define LAST_PLOT_CONT_ACCUM
Definition: defines.h:160
int last_scan_count
Definition: env.h:66
char savedCaptureName[256]
Definition: linuxpops.c:93
int strictsb
Definition: env.h:139
struct CONTINUUM_SPTIP cont_sptip_send
Definition: cont.c:64
int getYesNoQuit()
#define XMODE_CHAN
Definition: defines.h:97
struct ENVIRONMENT * env
Definition: linuxpops.c:71
int _doCCur(char *msg)
Definition: linuxpops.c:2411
int readConfig()
Definition: config.c:66
int sock_bufct(int bufct)
int pruneFile()
Definition: linuxpops.c:2045
double last_mouse_y
Definition: global.h:50
double escan
Definition: object.h:57
struct SOCK * helper
Definition: linuxpops.c:75
int _doVCur(char *msg)
Definition: linuxpops.c:2537
int initLetterHelp()
Definition: help.c:66
int isPlanet(char *name)
Definition: planets.c:1527
char * thirdArg
Definition: parse.h:182
char source[64]
Definition: env.h:11
int _doFCur(char *msg)
Definition: linuxpops.c:2493
#define BKMATCH_NAMERES
Definition: defines.h:124
Definition: sock.h:30
int quitProg()
Definition: linuxpops.c:668
int doDumpScans()
Definition: linuxpops.c:2628
int showSourceList()
Definition: sdd.c:308
int check_source
Definition: env.h:44
struct FREQS freqs[MAX_FREQS]
Definition: global.h:28
int isSet(int flag)
Definition: parse.c:646
#define LAST_PLOT_SPEC_FFT
Definition: defines.h:157
struct HEADER head
Definition: image.h:104
char globalName[256]
Definition: makemem.c:97
char printer[256]
Definition: makemem.c:97
double last_mouse_y
Definition: env.c:84
int doCCur()
Definition: linuxpops.c:2398
int sock_send(struct SOCK *s, char *message)
int incrementRejDates(void)
Definition: reject.c:193
int resetRejections(void)
Definition: reject.c:233
int doCheckSdd()
Definition: linuxpops.c:2750
char * listHeader
Definition: strings.c:130
int lp_new_sdd()
int doPaperSize()
Definition: linuxpops.c:218
double refpt_vel
Definition: header.h:175
#define LAST_PLOT_CONT_PLAIN
Definition: defines.h:161
#define WAIT_FOR_MOUSE
Definition: global.h:32
struct SOCK * monitorSock
Definition: linuxpops.c:75
#define EW_FOCALIZE
Definition: observing_par.h:53
double indx
Definition: header.h:84
double bscan
Definition: object.h:56
double last_mouse_x2
Definition: env.c:83
#define VLBI
Definition: observing_par.h:69
int no_terminal
Definition: linuxpops.c:91
#define FOCALIZE
Definition: observing_par.h:46
struct OBJECT objects[MAX_OBJECTS]
Definition: object.h:112
void st_warn()
#define PS
Definition: observing_par.h:27
int doSummary()
Definition: sdd.c:369
char obsmode[8]
Definition: header.h:41
double paperh
Definition: env.h:257
int printRejections(void)
Definition: reject.c:257
double bkres
Definition: env.h:170
int tellAllSfocus()
Definition: linuxpops.c:960
int cont_display_mapscan(struct LP_IMAGE_INFO *image, int plot)
Definition: cont.c:1924
double obsfreq
Definition: header.h:197
char backend[8]
Definition: header.h:43
void st_fail()
int tellOndata()
Definition: linuxpops.c:617
int sendXgraphic()
Definition: linuxpops.c:2917
int cont_display_any_focus(struct LP_IMAGE_INFO *image, int plot, int type)
Definition: cont.c:2327
double getmJulDate(int offset)
int freeX()
Definition: paxis.c:476
tcflag_t old_lflag
Definition: linuxpops.c:66
char savefile[256]
Definition: env.h:13
int strcmp()
int meetsCritiria(struct HEADER *p, int mask)
Definition: observe.c:90
struct ACCUM_INFO ainfo
Definition: image.h:100
struct FLUX_INFO flux_info
Definition: planets.c:86
int doPageCmd()
Definition: linuxpops.c:2611
int onlineversion
Definition: linuxpops.c:79
int feed
Definition: stats.c:66
int init_readline(void)
Definition: parse.c:2631
double map_angle_2
Definition: global.h:55
int stackEmpty(void)
Definition: stack.c:232
char * getcTime(int offset)
int max_calibrators
Definition: alma.c:68
#define READ_HISTORY
Definition: makemem.c:84
int ffb_load()
Definition: ffb.c:137
double xplotmin
Definition: env.h:282
int doVi()
Definition: linuxpops.c:3451
int setLinPlot()
Definition: linuxpops.c:2821
#define LAST_PLOT_CONT_OBJECT
Definition: defines.h:163
int doCP()
Definition: linuxpops.c:3497
#define VERBOSE_FLAGS
Definition: defines.h:78
int sock_sel(char *message, int *l, int *p, int n, int tim, int rd_in)
int printNsave
Definition: linuxpops.c:86
double stsys
Definition: header.h:203
int doTCur()
Definition: linuxpops.c:2567
int isScanIgnored(double scan)
Definition: ignore.c:181
int oldColor
Definition: parse.c:82
int plotAccum()
Definition: linuxpops.c:711
char session[80]
Definition: strings.c:67
float bfreq
Definition: flux.h:22
struct OBJECT_GLOBAL_MEMORY * OGM
Definition: object.h:115
int usage(char *name)
Definition: linuxpops.c:1473
struct CONTINUUM_PLAIN cont_plain_send
Definition: cont.c:63
int initDvars()
Definition: parse.c:967
int mode
Definition: env.h:75
int parseMouseValues(double x1, double x2, double y1, double y2)
Definition: linuxpops.c:2154
double xplotmax
Definition: env.h:283
#define XMODE_FREQ
Definition: defines.h:95
#define MODE_SPEC
Definition: defines.h:87
int setColor(int c)
Definition: parse.c:2644
double mapFtoChan(double f)
Definition: paxis.c:528
int used
Definition: global.h:15
double paperw
Definition: env.h:256
int logging
Definition: linuxpops.c:77
int incrementRejMode(void)
Definition: reject.c:162
double mapVtoChan(double v)
Definition: paxis.c:568
double refpt
Definition: header.h:207
int lp_ppid
Definition: linuxpops.c:89
int xfd
Definition: linuxpops.c:83
char * sixthArg
Definition: parse.h:185
void st_report()
char logfilename[256]
Definition: strings.c:67
#define QK5
Definition: observing_par.h:66
int tellAll()
Definition: linuxpops.c:907
int last_plot
Definition: env.c:93
cc_t old_vtime
Definition: linuxpops.c:67
int site
Definition: linuxpops.c:87
int doAttach()
Definition: linuxpops.c:3117
double vcur
Definition: env.h:279
int printScan(struct HEADER *p, int nsave)
Definition: linuxpops.c:725
char lockFileName[256]
Definition: makemem.c:97
#define WAIT_FOR_PLOT
Definition: global.h:33
#define BKMATCH_FEED
Definition: defines.h:121
int recordTests()
Definition: linuxpops.c:3212
Definition: parse.h:9
struct LP_IMAGE_INFO H6
Definition: image.c:69
double deltax
Definition: header.h:209
double if_feed
Definition: env.h:208
struct HEADER head[MAX_IFS]
Definition: accum.h:87
int doDone()
Definition: linuxpops.c:3430
struct LP_IMAGE_INFO H4
Definition: image.c:67
double map_angle_1
Definition: global.h:54
struct HEADER head2
Definition: accum.h:142
int numofscans
Definition: env.h:85
char * fourthArg
Definition: parse.h:183
#define CONTMAP
Definition: defines.h:32
int initParseArgs()
Definition: parse.c:352
struct XGRAPHIC_SEND xsend
Definition: linuxpops.c:73
int hfd
Definition: linuxpops.c:84
int doNotRemoveLockFile
Definition: linuxpops.c:81
#define SEQUENCE
Definition: observing_par.h:43
#define USB
struct HEADER head1
Definition: accum.h:141
double bscan
Definition: env.h:173
int sendAccumResults()
Definition: cont.c:452
int verifyParams()
Definition: observe.c:63
char backend[16]
Definition: env.h:12
double freq
Definition: env.h:197
int doAutoScale()
Definition: linuxpops.c:2788
int bkmatch
Definition: env.h:32
void subArgs(int wt, const char *fmt,...)
Definition: parse.c:430
int initSignals()
Definition: interrupt.c:237
char * machStr
Definition: build.c:5
struct BOUND * sock_bind(char *mbname)
int yaxis_scale
Definition: env.h:148
int count
Definition: global.h:16
int incrementRejSource(void)
Definition: reject.c:177
double last_mouse_x2
Definition: global.h:51
#define CHECK_ALL
Definition: defines.h:64
struct LP_IMAGE_INFO H3
Definition: image.c:66
double manual_tcal
Definition: env.c:86
struct SOCK * sock_connect(char *mbname)
int incrementRejScans(void)
Definition: reject.c:185
#define LAST_PLOT_SPEC_ACCUM
Definition: defines.h:156
char * fctnStr
Definition: commands.h:9
double yplotmin
Definition: env.h:285
int lp_logging
Definition: linuxpops.c:88
double xplotmax
Definition: global.h:47
int validate(int which)
Definition: linuxpops.c:164
#define LINEAR_PLOT
Definition: defines.h:110
char * secondArg
Definition: parse.h:181
int setCactusEnvironment(void)
int _doTCur(char *msg)
Definition: linuxpops.c:2580
void st_print()
int listScans()
Definition: linuxpops.c:1124
int ntokens
Definition: parse.h:173
double map_angle[2]
Definition: env.h:225
int replot(int how)
Definition: linuxpops.c:179
double escan
Definition: env.h:186
int doPGUI()
Definition: linuxpops.c:3148
double yplotmax
Definition: global.h:45
int check_date
Definition: env.h:40
int doGetMapAngle()
Definition: linuxpops.c:2448
int doMapPlot(int how)
Definition: gridmap.c:2203
int doVCur()
Definition: linuxpops.c:2524
int incrementRejFreq(void)
Definition: reject.c:146
int backendMatch(struct HEADER *h)
Definition: linuxpops.c:1033
int mouse_used
Definition: global.h:40
char object[16]
Definition: header.h:40
char * firstArg
Definition: parse.h:180
double restfreq
Definition: header.h:198
int lp_write_sdd()
int loadProto()
Definition: parseProto.c:73
int parseCmd(char *buf)
Definition: parse.c:2090
#define CONT_MAP
Definition: observing_par.h:45
int delay(double dc)
#define XMODE_VEL
Definition: defines.h:96
int incrementRejBackend(void)
Definition: reject.c:201
int incrementRejFreqres(void)
Definition: reject.c:114
int map_angle_used
Definition: global.h:41
int x2mode
Definition: env.h:146
#define VERBOSE_COMM
Definition: defines.h:69
int doFCur()
Definition: linuxpops.c:2480
double fcur
Definition: env.h:190
int loadCalibrators(char *name)
Definition: alma.c:218
double freqres
Definition: header.h:199
int makeFileName(char *fname, int pid)
Definition: linuxpops.c:273
char objGlobalName[256]
Definition: strings.c:67
void process_line(char *line)
Definition: parse.c:2452
double freq
Definition: global.h:14
int checkLockFile()
Definition: io.c:287
int refreshPlot()
Definition: linuxpops.c:2882
int setVerbose()
Definition: linuxpops.c:117
double last_mouse_y2
Definition: env.c:85
int printTimeStamp()
Definition: linuxpops.c:1498
char filename[256]
Definition: env.h:9
int lineConvert2LogPlot()
Definition: line.c:1971
int doingOTF
Definition: otf.c:64
#define VERBOSE_PARSE
Definition: makemem.c:90
double tsyslimit
Definition: env.h:275
#define MAGENTA
Definition: colors.h:9
struct LP_IMAGE_INFO H8
Definition: image.c:71
#define GNUPLOT
Definition: defines.h:29
FILE * errPrint_fp
Definition: linuxpops.c:70
float startRes
Definition: specplot.c:22
int freeY()
Definition: paxis.c:488
int to_dataserv(char *buf)
Definition: otf.c:82
int printPlot()
Definition: linuxpops.c:385
int tellIgnored()
Definition: ignore.c:156
Definition: env.h:7
int verboseLevel
Definition: linuxpops.c:80
#define GREEN
Definition: colors.h:6
int doCopyRaw()
Definition: linuxpops.c:3523