Changeset 42389 for trunk/Ohana/src/opihi
- Timestamp:
- Feb 8, 2023, 12:17:35 PM (3 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 deleted
- 37 edited
- 4 copied
-
. (modified) (1 prop)
-
src/opihi/Makefile.Common (modified) (1 diff)
-
src/opihi/cmd.basic/list.c (modified) (16 diffs)
-
src/opihi/cmd.basic/memory.c (modified) (1 diff)
-
src/opihi/cmd.basic/run_while.c (modified) (2 diffs)
-
src/opihi/cmd.basic/test/stackmath.sh (deleted)
-
src/opihi/cmd.basic/test/stackmath.tp (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/test/stackmath.tp )
-
src/opihi/cmd.basic/test/tap.sh (deleted)
-
src/opihi/cmd.data/Makefile (modified) (2 diffs)
-
src/opihi/cmd.data/cursor.c (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (4 diffs)
-
src/opihi/cmd.data/limits.c (modified) (3 diffs)
-
src/opihi/cmd.data/opihi_size.c (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/opihi_size.c )
-
src/opihi/cmd.data/rdjpg.c (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/rdjpg.c )
-
src/opihi/cmd.data/read_vectors.c (modified) (1 diff)
-
src/opihi/cmd.data/reindex.c (modified) (1 diff)
-
src/opihi/cmd.data/subset.c (modified) (3 diffs)
-
src/opihi/cmd.data/svd.c (modified) (1 diff)
-
src/opihi/cmd.data/test/histogram.sh (modified) (2 diffs)
-
src/opihi/cmd.data/test/join.sh (modified) (1 diff)
-
src/opihi/cmd.data/threshold.c (modified) (6 diffs)
-
src/opihi/cmd.data/tvcolors.c (modified) (1 diff)
-
src/opihi/cmd.data/wd.c (modified) (2 diffs)
-
src/opihi/cmd.data/write_vectors.c (modified) (1 diff)
-
src/opihi/dvo/aregion.c (modified) (1 diff)
-
src/opihi/dvo/coordmosaic.c (modified) (2 diffs)
-
src/opihi/dvo/elixir.c (modified) (2 diffs)
-
src/opihi/dvo/find_regions.c (modified) (1 diff)
-
src/opihi/include/dvomath.h (modified) (1 diff)
-
src/opihi/include/pcontrol.h (modified) (1 diff)
-
src/opihi/lib.data/svdcmp.c (modified) (10 diffs)
-
src/opihi/lib.data/svdcmp_bond_new.c (modified) (1 diff)
-
src/opihi/lib.shell/VectorIO.c (modified) (1 diff)
-
src/opihi/lib.shell/evaluate_stack.c (modified) (1 diff)
-
src/opihi/lib.shell/expand_vectors.c (modified) (4 diffs)
-
src/opihi/lib.shell/stack_math.c (modified) (1 diff)
-
src/opihi/pantasks/controller_status.c (modified) (1 diff)
-
src/opihi/pantasks/pantasks_server.c.in (modified) (1 diff)
-
src/opihi/pcontrol/CheckSystem.c (modified) (2 diffs)
-
src/opihi/pcontrol/pcontrol.c.in (modified) (3 diffs)
-
src/opihi/pcontrol/test/linesize.sh (modified) (2 diffs)
-
src/opihi/test/tap.tp (copied) (copied from branches/eam_branches/ipp-20220316/Ohana/src/opihi/test/tap.tp )
-
src/opihi/test/tests.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
trunk/Ohana/src/opihi/Makefile.Common
r13615 r42389 42 42 @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi 43 43 rm -f $@ 44 gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc 44 # gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc 45 gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc -Wl,--allow-multiple-definition 45 46 46 47 $(DESTLIB)/%.so: $(LIB)/%.$(ARCH).so -
trunk/Ohana/src/opihi/cmd.basic/list.c
r42081 r42389 111 111 set_str_variable (line, argv[i+3]); 112 112 } 113 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);113 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 114 114 set_int_variable (line, i); 115 115 … … 133 133 int isFound; 134 134 135 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);135 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 136 136 int nList = get_int_variable (line, &isFound); 137 137 if (!isFound) { … … 145 145 146 146 for (i = start; i < nList; i++) { 147 snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);147 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i); 148 148 char *word = get_variable (line); 149 149 if (!word) break; 150 150 if (i > 0) { 151 snprintf (output, MAX_LINE_LENGTH, "%s %s", tmpline, word);151 snprintf_nowarn (output, MAX_LINE_LENGTH, "%s %s", tmpline, word); 152 152 } else { 153 snprintf (output, MAX_LINE_LENGTH, "%s", word);153 snprintf_nowarn (output, MAX_LINE_LENGTH, "%s", word); 154 154 } 155 155 strcpy (tmpline, output); … … 179 179 180 180 // old list must exist, or give an error 181 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[3]);181 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[3]); 182 182 N = get_int_variable (line, &found); 183 183 if (!found) { … … 188 188 189 189 190 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);190 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 191 191 set_int_variable (line, N); 192 192 for (i = 0; i < N; i++) { 193 snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[3], i);193 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[3], i); 194 194 value = get_variable (line); 195 // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);195 // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i); 196 196 set_list_varname (line, argv[1], i, EXCEL_STYLE); 197 197 set_str_variable (line, value); … … 207 207 } 208 208 209 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);209 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 210 210 N = get_int_variable (line, &found); 211 211 for (i = 0; i < argc - 3; i++) { 212 // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], N + i);212 // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], N + i); 213 213 set_list_varname (line, argv[1], N + i, EXCEL_STYLE); 214 214 set_str_variable (line, argv[i+3]); 215 215 } 216 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);216 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 217 217 set_int_variable (line, N + i); 218 218 … … 231 231 char line2[MAX_LINE_LENGTH]; 232 232 233 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n233 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n 234 234 N = get_int_variable (line, &found); 235 235 236 236 // loop over all list elements: 237 237 for (i = 0; i < N; i++) { 238 // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);238 // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i); 239 239 set_list_varname (line, argv[1], i, EXCEL_STYLE); // line = LIST:i 240 240 value = get_variable (line); … … 245 245 free (value); 246 246 for (j = i + 1; j < N; j++) { 247 // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], j);247 // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], j); 248 248 set_list_varname (line2, argv[1], j, EXCEL_STYLE); // line2 = LIST:j 249 249 next_value = get_variable (line2); … … 252 252 } 253 253 DeleteNamedScalar (line); // line = LIST:(N-1) 254 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n (new value of n)254 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n (new value of n) 255 255 set_int_variable (line, N - 1); 256 256 return (TRUE); … … 309 309 depth --; 310 310 if (depth < 0) { /* we hit the last "END", loop is done */ 311 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);311 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 312 312 set_int_variable (line, i); 313 313 free (input); … … 317 317 318 318 if (*input) { 319 // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);319 // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i); 320 320 set_list_varname (line, argv[1], i, EXCEL_STYLE); 321 321 set_str_variable (line, input); … … 381 381 free (val); 382 382 383 snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);383 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname); 384 384 set_int_variable (line, i); 385 385 return (TRUE); … … 399 399 // otherwise save all glob matches 400 400 if (globList.gl_pathc == 0) { 401 snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);401 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname); 402 402 set_int_variable (line, 0); 403 403 return TRUE; … … 409 409 set_str_variable (line, globList.gl_pathv[i]); 410 410 } 411 snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);411 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname); 412 412 set_int_variable (line, Nfile); 413 413 return (TRUE); … … 430 430 Nline ++; 431 431 } 432 snprintf (varname, MAX_LINE_LENGTH, "%s:n", listname);432 snprintf_nowarn (varname, MAX_LINE_LENGTH, "%s:n", listname); 433 433 set_int_variable (varname, Nline); 434 434 return TRUE; … … 463 463 FREE (new); 464 464 } 465 snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);465 snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); 466 466 set_int_variable (line, nWords); 467 467 -
trunk/Ohana/src/opihi/cmd.basic/memory.c
r41341 r42389 27 27 if (!strcasecmp (argv[1], "checkfree")) { 28 28 ohana_memcheck (1); 29 return (TRUE); 30 } 31 if (!strcasecmp (argv[1], "stats")) { 32 OhanaMemstats memstats = ohana_memstats (0); 33 set_variable ("memory:Ntotal", memstats.Ntotal); 34 set_variable ("memory:Nbytes", memstats.Nbytes); 35 set_variable ("memory:Ngood", memstats.Ngood); 36 set_variable ("memory:Nbad", memstats.Nbad); 29 37 return (TRUE); 30 38 } -
trunk/Ohana/src/opihi/cmd.basic/run_while.c
r31667 r42389 72 72 // test the logic once before running the loop 73 73 logic_line = strcreate (argv[1]); 74 logic_line = expand_vars (logic_line); 74 logic_line = expand_vars (logic_line); // recalculates scalar elements 75 logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[]) 75 76 val = dvomath (1, &logic_line, &size, 0); 76 77 free (logic_line); … … 90 91 91 92 logic_line = strcreate (argv[1]); 92 logic_line = expand_vars (logic_line); 93 logic_line = expand_vars (logic_line); // recalculates scalar elements 94 logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[]) 93 95 val = dvomath (1, &logic_line, &size, 0); 94 96 free (logic_line); -
trunk/Ohana/src/opihi/cmd.data/Makefile
r42128 r42389 140 140 $(SRC)/radial.$(ARCH).o \ 141 141 $(SRC)/rd.$(ARCH).o \ 142 $(SRC)/rdjpg.$(ARCH).o \ 142 143 $(SRC)/rdseg.$(ARCH).o \ 143 144 $(SRC)/read_vectors.$(ARCH).o \ … … 154 155 $(SRC)/set.$(ARCH).o \ 155 156 $(SRC)/shift.$(ARCH).o \ 157 $(SRC)/opihi_size.$(ARCH).o \ 156 158 $(SRC)/sort.$(ARCH).o \ 157 159 $(SRC)/spline.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r39457 r42389 42 42 KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key); 43 43 44 sprintf (string, "X%s", key); 45 set_variable (string, X); 46 sprintf (string, "Y%s", key); 47 set_variable (string, Y); 48 sprintf (string, "Z%s", key); 49 set_variable (string, Z); 50 sprintf (string, "R%s", key); 51 set_variable (string, R); 52 sprintf (string, "D%s", key); 53 set_variable (string, D); 44 snprintf_nowarn (string, 20, "X%s", key); set_variable (string, X); 45 snprintf_nowarn (string, 20, "Y%s", key); set_variable (string, Y); 46 snprintf_nowarn (string, 20, "Z%s", key); set_variable (string, Z); 47 snprintf_nowarn (string, 20, "R%s", key); set_variable (string, R); 48 snprintf_nowarn (string, 20, "D%s", key); set_variable (string, D); 54 49 55 50 set_str_variable ("KEY", key); -
trunk/Ohana/src/opihi/cmd.data/init.c
r42128 r42389 126 126 int queue2book PROTO((int, char **)); 127 127 int rd PROTO((int, char **)); 128 int rdjpg PROTO((int, char **)); 128 129 int rdseg PROTO((int, char **)); 129 130 int read_vectors PROTO((int, char **)); … … 160 161 int tvgrid PROTO((int, char **)); 161 162 int opihi_type PROTO((int, char **)); 163 int opihi_size PROTO((int, char **)); 162 164 int uniq PROTO((int, char **)); 163 165 int uniqpair PROTO((int, char **)); … … 336 338 {1, "ipptool2book", queue2book, "convert queue with ipptool output to book"}, 337 339 {1, "rd", rd, "load fits image"}, 340 {1, "rdjpg", rdjpg, "load jpeg image"}, 338 341 {1, "rdseg", rdseg, "read a segment of an image from a file"}, 339 342 {1, "read", read_vectors, "read vectors from datafile"}, … … 350 353 {1, "set", set, "image and vector math"}, 351 354 {1, "shift", shift, "shift data in an image"}, 355 {1, "size", opihi_size, "get vector/matrix dimension/size information"}, 352 356 {1, "sort", sort_vectors, "sort list of vectors"}, 353 357 {1, "spline", spline_command, "shift data in an image"}, -
trunk/Ohana/src/opihi/cmd.data/limits.c
r40291 r42389 61 61 APPLY = TRUE; 62 62 } 63 63 64 char *name = NULL; 64 65 if ((N = get_argument (argc, argv, "-n"))) { … … 67 68 remove_argument (N, &argc, argv); 68 69 } 69 70 70 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 71 71 FREE (name); 72 73 // this is not super intuitive 74 if ((N = get_argument (argc, argv, "-boxsize"))) { 75 remove_argument (N, &argc, argv); 76 float dx, dy; 77 // ask kapa for the size of the graph region in pixels 78 KapaGetLimits (kapa, &dx, &dy); 79 set_variable ("KAPA_XPIX", fabs(dx)); 80 set_variable ("KAPA_YPIX", fabs(dy)); 81 } 72 82 73 83 // XXX need an option to set the limits based on the current image bounds … … 169 179 return (TRUE); 170 180 } 181 182 /* -minX value : the minimum X axis value will be no higher than this value 183 -maxX value : the maximum X axis value will be no lower than this value 184 -delX value : the range of the X axis will be at least this value 185 186 These can be used to prevent the range from collapsing. 187 These are only used if the -a option is supplied, otherwise the supplied or auto-calculated 188 ranges are used (this seems like an poor choice) 189 190 */ 191 192 193 -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r42082 r42389 385 385 if (!lineStatus && VERBOSE) { 386 386 char temp[32]; 387 strncpy (temp, c0, 32); 388 temp[31] = 0; 387 strncpy_nowarn (temp, c0, 31); 389 388 gprint (GP_ERR, "skip line %s\n\n", temp); 390 389 } -
trunk/Ohana/src/opihi/cmd.data/reindex.c
r42082 r42389 72 72 } 73 73 } 74 if (ivec->type == OPIHI_STR) { 75 opihi_int *vx = xvec[0].elements.Int; 76 for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) { 77 if (Npts >= NPTS) { 78 NPTS += 2000; 79 REALLOCATE (ovec[0].elements.Str, char *, NPTS); 80 } 81 if (*vx < 0) { 82 if (KEEP_UNMATCH) { 83 ovec[0].elements.Str[Npts] = strcreate(""); // XXX use a different or a specified value? 84 Npts++; 85 } 86 continue; 87 } 88 if (*vx > Nmax) ESCAPE("unexpected value in index: "OPIHI_INT_FMT" (%d)\n", *vx, i); 89 ovec[0].elements.Str[Npts] = strcreate(ivec->elements.Str[*vx]); 90 Npts++; 91 } 92 } 74 93 75 94 // free up unused memory -
trunk/Ohana/src/opihi/cmd.data/subset.c
r42311 r42389 44 44 ResetVector (ovec, ivec->type, tvec[0].Nelements); 45 45 46 // we have four cases: (ivec == flt or int) and (tvec == flt or int)46 // we have size cases: (ivec == flt, int, str) and (tvec == flt or int) 47 47 if ((ivec->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) { 48 48 opihi_flt *vi = ivec[0].elements.Flt; … … 81 81 } 82 82 } 83 // XXX if ivec is an existing vector, this step will 84 // leak (existing elements need to be freed if they 85 // have been allocated). 83 86 if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_FLT)) { 84 87 opihi_flt *vt = tvec[0].elements.Flt; 85 88 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 86 89 if (!*vt) continue; 87 ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);90 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 88 91 Npts++; 89 92 } … … 93 96 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 94 97 if (!*vt) continue; 95 ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);98 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 96 99 Npts++; 97 100 } -
trunk/Ohana/src/opihi/cmd.data/svd.c
r29540 r42389 58 58 59 59 // try C.R. Bond's version -- requires matrices in the form A[row][col] not A[row*Ncol + col] 60 if ( 1) {60 if (0) { 61 61 int j; 62 62 double **a, **u, **v, *q; -
trunk/Ohana/src/opihi/cmd.data/test/histogram.sh
r20936 r42389 35 35 local i 36 36 37 list word -x "ps -p $PID -o rss" 38 $startmem = $word:1 37 create xhis 0 10 0.1 38 $i = 1 39 40 memory stats 41 $startmem = $memory:Ntotal 39 42 40 43 for i 0 1000 … … 42 45 end 43 46 44 list word -x "ps -p $PID -o rss"45 $endmem = $ word:147 memory stats 48 $endmem = $memory:Ntotal 46 49 47 50 $PASS = 1 -
trunk/Ohana/src/opihi/cmd.data/test/join.sh
r36084 r42389 21 21 22 22 join ID1 ID2 23 24 mana: for i 0 index1[]25 >> echo index1[$i] index2[$i]26 >> end27 0 228 2 129 4 030 5 331 mana: join ID1 ID2 -outer32 mana: vectors33 N name size34 0 ID1 6 (INT)35 1 val1 6 (FLT)36 2 ID2 4 (INT)37 3 val 4 (FLT)38 4 index1 6 (INT)39 5 index2 4 (INT)40 mana: for i 0 index1[]41 >> echo index1[$i]42 >> end43 244 -145 146 -147 048 349 mana: echo ID1[2]50 351 mana: echo ID1[0] ID2[2]52 1 153 mana: for i 0 index1[]54 >> if (index1[$i] == -1) continue55 >> $N = index1[$i]56 >> echo $i index1[$i] ID1[$i] ID2[$N]57 >> end58 0 2 1 159 2 1 3 360 4 0 5 561 5 3 6 662 mana: for i 0 index2[]63 >> if (index2[$i] == -1) continue64 >> $N = index2[$i]65 >> echo $i index2[$i] ID2[$i] ID1[$N]66 >> end67 0 4 5 568 1 2 3 369 2 0 1 170 3 5 6 671 mana:72 73 # if ((xvec[1024] != 17) || (yvec[1024] != 100))74 # $PASS = 075 # echo "Value mismatch: xvec[1024] yvec[1024] (should be 17,100)"76 # end77 #78 # imhist -q buff xvec yvec -region 40 0 25 10 -range 0 1079 #80 # if ((xvec[1024] != 10) || (yvec[1024] != 100))81 # $PASS = 082 # echo "Value mismatch: xvec[1024] yvec[1024] (should be 10,100)"83 # end84 23 85 24 end -
trunk/Ohana/src/opihi/cmd.data/threshold.c
r42277 r42389 3 3 int QUIET = FALSE; 4 4 5 void _threshold_set_values (double value, int Nbin, double level ) {5 void _threshold_set_values (double value, int Nbin, double level, int thresherr) { 6 6 7 7 set_variable ("threshval", value); 8 8 set_int_variable ("threshbin", Nbin); 9 9 set_variable ("threshold", level); 10 set_int_variable ("thresherr", thresherr); 10 11 11 12 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", level, Nbin, value); … … 117 118 if (vecy[0].elements.Flt[BinMin] > value) { 118 119 if (SATURATE) { 119 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin] );120 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 120 121 return TRUE; 121 122 } else { 122 123 gprint (GP_ERR, "ERROR: all values above threshold\n"); 123 _threshold_set_values (NAN, -1, NAN );124 _threshold_set_values (NAN, -1, NAN, 1); 124 125 return FALSE; 125 126 } … … 127 128 if (vecy[0].elements.Flt[BinMax] < value) { 128 129 if (SATURATE) { 129 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax] );130 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 130 131 return TRUE; 131 132 } else { 132 133 gprint (GP_ERR, "ERROR: all values below threshold\n"); 133 _threshold_set_values (NAN, -1, NAN );134 _threshold_set_values (NAN, -1, NAN, 1); 134 135 return FALSE; 135 136 } … … 156 157 if (vecy[0].elements.Flt[BinMin] < value) { 157 158 if (SATURATE) { 158 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin] );159 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 159 160 return TRUE; 160 161 } else { 161 162 gprint (GP_ERR, "ERROR: all values below threshold\n"); 162 _threshold_set_values (NAN, -1, NAN );163 _threshold_set_values (NAN, -1, NAN, 1); 163 164 return FALSE; 164 165 } … … 166 167 if (vecy[0].elements.Flt[BinMax] > value) { 167 168 if (SATURATE) { 168 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax] );169 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 169 170 return TRUE; 170 171 } else { 171 172 gprint (GP_ERR, "ERROR: all values above threshold\n"); 172 _threshold_set_values (NAN, -1, NAN );173 _threshold_set_values (NAN, -1, NAN, 1); 173 174 return FALSE; 174 175 } … … 219 220 } 220 221 221 _threshold_set_values (y1, Nhi, Xvalue );222 _threshold_set_values (y1, Nhi, Xvalue, 0); 222 223 return (TRUE); 223 224 } -
trunk/Ohana/src/opihi/cmd.data/tvcolors.c
r41341 r42389 41 41 gprint (GP_ERR, " f: 0 - 1 defines the scale value for the transition\n"); 42 42 gprint (GP_ERR, " R,G,B: 0 - 1 define the value of the color at the transition point\n"); 43 44 gprint (GP_ERR, " There are 5 colormap file format options:\n"); 45 gprint (GP_ERR, " * file:filename : index Red Green Blue\n"); 46 gprint (GP_ERR, " * lgcy:filename : index Red Blue Green\n"); 47 gprint (GP_ERR, " * csvf:filename : index,Red,Green,Blue\n"); 48 gprint (GP_ERR, " * cetf:filename : fRed,fGreen,fBlue \n"); 49 gprint (GP_ERR, " * cetr:filename : fRed,fGreen,fBlue \n\n"); 50 gprint (GP_ERR, " The index value goes from 0.0 to 1.0 and sets transitions (must be monotonic).\n"); 51 gprint (GP_ERR, " In the CET cases, the index is implicit, with 256 entries expected.\n"); 52 gprint (GP_ERR, " For cetr: the index is reversed.\n"); 53 43 54 return (FALSE); 44 55 } -
trunk/Ohana/src/opihi/cmd.data/wd.c
r41674 r42389 115 115 Ns = strlen (simple); 116 116 No = 80 - Ns; 117 strncpy (temp_header.buffer, simple, Ns);117 strncpy_nowarn (temp_header.buffer, simple, Ns); 118 118 memset (&temp_header.buffer[Ns], ' ', No); 119 119 } … … 275 275 return (f); 276 276 } 277 278 279 /// /* fix up header */280 /// {281 /// static char simple[] = "XTENSION= 'IMAGE ' / Image extension";282 /// int Ns, No;283 /// Ns = strlen (simple);284 /// No = 80 - Ns;285 /// strncpy (temp_header.buffer, simple, Ns);286 /// memset (&temp_header.buffer[Ns], ' ', No);287 /// }288 ///289 /// /* position to end of file to write new extend */290 /// fseeko (f, 0LL, SEEK_END);291 /// nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f);292 /// fclose (f);293 /// if (nbytes != temp_header.datasize) {294 /// gprint (GP_ERR, "failed to write file\n");295 /// status = FALSE;296 /// goto done1;297 /// }298 ///299 /// } -
trunk/Ohana/src/opihi/cmd.data/write_vectors.c
r42127 r42389 214 214 /* identify type (%NNNNd %NNNNf) */ 215 215 for (p2 = p1 + 1; (*p2 == '.') || (*p2 == '-') || (*p2 == '+') || (*p2 == ' ') || isdigit(*p2); p2++); 216 strncpy (fmtlist[j], p0, p2 - p0 + 1);216 strncpy_nowarn (fmtlist[j], p0, p2 - p0 + 1); 217 217 switch (*p2) { 218 218 case 'e': -
trunk/Ohana/src/opihi/dvo/aregion.c
r27435 r42389 49 49 fread (buffer, 1, 48*NDecLines[NBigDec], f); 50 50 for (i = 0; !done && (i < NDecLines[NBigDec]); i++) { 51 strncpy (temp, &buffer[i*48], 48); 52 temp[49] = 0; 51 strncpy_nowarn (temp, &buffer[i*48], 48); 53 52 hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]); 54 53 if (RA1 < RA0) RA1 += 360.0; -
trunk/Ohana/src/opihi/dvo/coordmosaic.c
r39233 r42389 311 311 312 312 memset (segment, 0, 16); memcpy (segment, &SEGMENT[i*Nsegment], 4); 313 snprintf (name, 16, "%s_L_CX%dY%d", segment, XORDER[i], YORDER[i]);313 snprintf_nowarn (name, 16, "%s_L_CX%dY%d", segment, XORDER[i], YORDER[i]); 314 314 double xvalue = get_double_variable (name, &found); 315 315 xmask = !found; 316 316 317 317 memset (segment, 0, 16); memcpy (segment, &SEGMENT[i*Nsegment], 4); 318 snprintf (name, 16, "%s_M_CX%dY%d", segment, XORDER[i], YORDER[i]);318 snprintf_nowarn (name, 16, "%s_M_CX%dY%d", segment, XORDER[i], YORDER[i]); 319 319 double yvalue = get_double_variable (name, &found); 320 320 ymask = !found; … … 437 437 438 438 int found, xmask, ymask; 439 snprintf (name, 16, "L_X%dY%d", ix, iy);439 snprintf_nowarn (name, 16, "L_X%dY%d", ix, iy); 440 440 double xvalue = get_double_variable (name, &found); 441 441 xmask = !found; 442 442 443 snprintf (name, 16, "M_X%dY%d", ix, iy);443 snprintf_nowarn (name, 16, "M_X%dY%d", ix, iy); 444 444 double yvalue = get_double_variable (name, &found); 445 445 ymask = !found; -
trunk/Ohana/src/opihi/dvo/elixir.c
r27611 r42389 4 4 int ReadMsg (char *fifo, char **message); 5 5 6 # define MY_MAX_PATH 256 7 6 8 int elixir (int argc, char **argv) { 7 9 8 char message[ 256], cmd[256], ElixirBase[256];9 char fifo[ 256], fifodir[256], msgfile[256];10 char message[MY_MAX_PATH], cmd[MY_MAX_PATH], ElixirBase[MY_MAX_PATH]; 11 char fifo[MY_MAX_PATH], fifodir[MY_MAX_PATH], msgfile[MY_MAX_PATH]; 10 12 char *answer; 11 13 int N; … … 38 40 return (FALSE); 39 41 } 40 s printf (fifo, "%s.msg", ElixirBase);42 snprintf_nowarn (fifo, MY_MAX_PATH, "%s.msg", ElixirBase); 41 43 if (!VarConfig ("FIFOS", "%s", fifodir)) { 42 44 gprint (GP_ERR, "FIFOS not in config, using local /tmp\n"); 43 45 strcpy (fifodir, "/tmp"); 44 46 } 45 s printf (fifo, "%s.msg", ElixirBase);47 snprintf_nowarn (fifo, MY_MAX_PATH, "%s.msg", ElixirBase); 46 48 47 s printf (msgfile, "%s/EMsg.XXXXXX", fifodir);49 snprintf_nowarn (msgfile, MY_MAX_PATH, "%s/EMsg.XXXXXX", fifodir); 48 50 if (mkstemp (msgfile) == -1) { 49 51 gprint (GP_ERR, "can't create fifo\n"); 50 52 return (FALSE); 51 53 } 52 s printf (message, "%s %s", cmd, msgfile);54 snprintf_nowarn (message, MY_MAX_PATH, "%s %s", cmd, msgfile); 53 55 unlink (msgfile); 54 56 -
trunk/Ohana/src/opihi/dvo/find_regions.c
r27435 r42389 100 100 fread (buffer, 48*NDecLines[NBigDec + j], 1, f); 101 101 for (i = 0; (i < NDecLines[NBigDec + j]); i++) { 102 strncpy (temp, &buffer[i*48], 48); 103 temp[49] = 0; 102 strncpy_nowarn (temp, &buffer[i*48], 48); 104 103 hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]); 105 104 if (RA1 < RA0) RA1 += 360.0; -
trunk/Ohana/src/opihi/include/dvomath.h
r42083 r42389 125 125 int M_unary PROTO((StackVar *OUT, StackVar *V1, char *op)); 126 126 int W_unary PROTO((StackVar *OUT, StackVar *V1, char *op)); 127 int L_unary PROTO((StackVar *OUT, StackVar *V1, char *op)); 127 128 128 129 /* variable handling */ -
trunk/Ohana/src/opihi/include/pcontrol.h
r36623 r42389 341 341 342 342 void pcontrol_exit (int n); 343 void QuitCheckSystemThread (void); 343 344 344 345 // Job *FindJobByID (IDtype JobID, int *StackID); -
trunk/Ohana/src/opihi/lib.data/svdcmp.c
r34088 r42389 23 23 l = nm = 0; 24 24 ALLOCATE (rv1, float, Nx); 25 25 26 for (i = 0; i < Nx; i++) { 26 27 l = i + 1; … … 29 30 if (i < Ny) { 30 31 for (k = i; k < Ny; k++) scale += fabs(a[k*Nx + i]); 31 if (scale ) {32 if (scale > 0.0) { 32 33 for (k = i; k < Ny; k++) { 33 34 a[k*Nx + i] /= scale; … … 35 36 } 36 37 f = a[i*Nx + i]; 37 g = -FSIGN(sqrt(s), f); 38 g = sqrt(s); 39 if (f > 0.0) { g = -g; } 38 40 h = f*g - s; 39 41 a[i*Nx + i] = f-g; 40 42 if (i != Nx - 1) { 41 43 for (j = l; j < Nx; j++) { 42 for (s = 0.0, k = i; k < Ny; k++) s += a[k*Nx + i]*a[k*Nx + j]; 44 s = 0.0; 45 for (k = i; k < Ny; k++) { s += a[k*Nx + i]*a[k*Nx + j]; } 43 46 f = s/h; 44 for (k = i; k < Ny; k++) a[k*Nx + j] += f*a[k*Nx + i];47 for (k = i; k < Ny; k++) { a[k*Nx + j] += f*a[k*Nx + i]; } 45 48 } 46 49 } 47 for (k = i; k < Ny; k++) a[k*Nx + i] *= scale;50 for (k = i; k < Ny; k++) { a[k*Nx + i] *= scale; } 48 51 } 49 52 } … … 51 54 g = s = scale = 0.0; 52 55 if ((i < Ny) && (i != (Nx - 1))) { 53 for (k = l; k < Nx; k++) scale += fabs(a[i*Nx + k]);54 if (scale ) {56 for (k = l; k < Nx; k++) { scale += fabs(a[i*Nx + k]); } 57 if (scale > 0.0) { 55 58 for (k = l; k < Nx; k++) { 56 59 a[i*Nx + k] /= scale; … … 58 61 } 59 62 f = a[i*Nx + l]; 60 g = -FSIGN(sqrt(s), f); 63 g = sqrt(s); 64 if (f > 0.0) { g = -g; } 61 65 h = f*g - s; 62 66 a[i*Nx + l] = f-g; 63 for (k = l; k < Nx; k++) rv1[k] = a[i*Nx + k]/h;67 for (k = l; k < Nx; k++) { rv1[k] = a[i*Nx + k]/h; } 64 68 if (i != Ny - 1) { 65 69 for (j = l; j < Ny; j++) { 66 for (s = 0.0, k = l; k < Nx; k++) s += a[j*Nx + k]*a[i*Nx + k]; 67 for (k = l; k < Nx; k++) a[j*Nx + k] += s*rv1[k]; 70 s = 0.0; 71 for (k = l; k < Nx; k++) { s += a[j*Nx + k]*a[i*Nx + k];} 72 for (k = l; k < Nx; k++) { a[j*Nx + k] += s*rv1[k]; } 68 73 } 69 74 } 70 for (k = l; k < Nx; k++) a[i*Nx + k] *= scale;75 for (k = l; k < Nx; k++) { a[i*Nx + k] *= scale; } 71 76 } 72 77 } … … 76 81 for (i = Nx - 1; i >= 0; i--) { 77 82 if (i < Nx - 1) { 78 if (g ) {83 if (g != 0.0) { 79 84 /* isn't l == n to start?? */ 80 85 for (j = l; j < Nx; j++) v[j*Nx + i] = (a[i*Nx + j]/a[i*Nx + l])/g; 81 86 for (j = l; j < Nx; j++) { 82 for (s = 0.0, k = l; k < Nx; k++) s += a[i*Nx + k]*v[k*Nx + j]; 87 s = 0.0; 88 for (k = l; k < Nx; k++) s += a[i*Nx + k]*v[k*Nx + j]; 83 89 for (k = l; k < Nx; k++) v[k*Nx + j] += s*v[k*Nx + i]; 84 90 } 85 91 } 86 for (j = l; j < Nx; j++) v[i*Nx + j] = v[j*Nx + i] = 0.0;92 for (j = l; j < Nx; j++) { v[i*Nx + j] = v[j*Nx + i] = 0.0; } 87 93 } 88 94 v[i*Nx + i] = 1.0; … … 93 99 l = i + 1; 94 100 g = w[i]; 95 if (i < Nx - 1) 96 for (j = l; j < Nx; j++) a[i*Nx + j] = 0.0; 97 if (g) { 101 if (i < Nx - 1) { for (j = l; j < Nx; j++) {a[i*Nx + j] = 0.0; }} 102 if (g != 0.0) { 98 103 g = 1.0/g; 99 104 if (i != Nx - 1) { 100 105 for (j = l; j < Nx; j++) { 101 for (s = 0.0, k = l; k < Ny; k++) s += a[k*Nx + i]*a[k*Nx + j]; 106 s = 0.0; 107 for (k = l; k < Ny; k++) { s += a[k*Nx + i]*a[k*Nx + j];} 102 108 f = (s/a[i*Nx + i])*g; 103 for (k = i; k < Ny; k++) a[k*Nx + j] += f*a[k*Nx + i];104 } 105 } 106 for (j = i; j < Ny; j++) a[j*Nx + i] *= g;109 for (k = i; k < Ny; k++) { a[k*Nx + j] += f*a[k*Nx + i]; } 110 } 111 } 112 for (j = i; j < Ny; j++) { a[j*Nx + i] *= g; } 107 113 } else { 108 for (j = i; j < Ny; j++) a[j*Nx + i] = 0.0;109 } 110 ++a[i*Nx + i];114 for (j = i; j < Ny; j++) { a[j*Nx + i] = 0.0; } 115 } 116 a[i*Nx + i] ++; 111 117 } 112 118 … … 126 132 c = 0.0; 127 133 s = 1.0; 128 for (i = l; i < k; i++) {134 for (i = l; i <= k; i++) { 129 135 f = s*rv1[i]; 130 136 if (fabs(f)+anorm != anorm) { … … 160 166 f = ((y-z)*(y+z) + (g-h)*(g+h))/(2.0*h*y); 161 167 g = hypot (f, 1.0); 162 f = ((x-z)*(x+z) + h*((y/(f+FSIGN(g, f)))-h))/x; 168 169 float tmp = g; 170 if (f < 0.0) { tmp = - tmp; } 171 172 f = ((x-z)*(x+z) + h*((y/(f+tmp))-h))/x; 173 163 174 c = s = 1.0; 164 for (j = l; j < nm; j++) {175 for (j = l; j <= nm; j++) { 165 176 i = j+1; 166 177 g = rv1[i]; … … 184 195 z = hypot(f, h); 185 196 w[j] = z; 186 if (z ) {197 if (z != 0.0) { 187 198 z = 1.0/z; 188 199 c = f*z; -
trunk/Ohana/src/opihi/lib.data/svdcmp_bond_new.c
r29540 r42389 63 63 g = 0.0; 64 64 else { 65 f = u[i][i+1];65 f = u[i][i+1]; // XXXX this line will overrun the memory of u[][i+1] : i+1 66 66 g = (f < 0) ? sqrt(s) : -sqrt(s); 67 67 h = f * g - s; -
trunk/Ohana/src/opihi/lib.shell/VectorIO.c
r42126 r42389 261 261 memset (endptr, ' ', FT_LINE_LENGTH); 262 262 263 strncpy (endptr, newline, 80);263 strncpy_nowarn (endptr, newline, 80); 264 264 endptr += FT_LINE_LENGTH; 265 265 -
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
r42080 r42389 67 67 if (stack[0].type == ST_VECTOR) { 68 68 /* need to make a copy so we set output value? */ 69 V_unary (&tmp_stack, &stack[0], "="); 69 if (stack->vector->type == OPIHI_STR) { 70 L_unary (&tmp_stack, &stack[0], "="); 71 } else { 72 V_unary (&tmp_stack, &stack[0], "="); 73 } 70 74 move_stack (&stack[0], &tmp_stack); 71 75 return (TRUE); -
trunk/Ohana/src/opihi/lib.shell/expand_vectors.c
r42080 r42389 28 28 ALLOCATE (newline, char, NLINE); 29 29 30 // special case: don't expand vectors in while () statement 31 char *V0 = thiscomm (line); 32 if (V0 && !strncmp ("while", V0, strlen(V0))) { 33 strcpy (newline, line); 34 free (line); 35 return (newline); 36 } 37 free (V0); 38 30 39 /* look for form fred[stuff] */ 31 /* skip first word (command) */ 32 L = nextword (line); 40 if (*line == '(') { 41 // if line is "(stuff)" then do not skip first word 42 L = line; 43 } else { 44 /* skip first word (command) */ 45 L = nextword (line); 46 } 33 47 if (L == NULL) { 34 48 free (newline); … … 37 51 38 52 n = L - line; 39 strncpy (newline, line, n);53 strncpy_nowarn (newline, line, n); 40 54 N = newline + n; 41 55 J = 0; … … 242 256 243 257 n = (int) (w - L); 244 strncpy (N, L, n);258 strncpy_nowarn (N, L, n); 245 259 N += n; 246 260 n = strlen (strValue); 247 strncpy (N, strValue, n);261 strncpy_nowarn (N, strValue, n); 248 262 N += n; 249 263 L = q + 1; … … 260 274 261 275 n = strlen (L); 262 strncpy (N, L, n); 263 N[n] = 0; 276 strncpy_nowarn (N, L, n); 264 277 free (line); 265 278 return (newline); -
trunk/Ohana/src/opihi/lib.shell/stack_math.c
r42311 r42389 1714 1714 char line[512]; // this is only used to report an error 1715 1715 snprintf (line, 512, "error: op %s not defined as unary vector op!", op); 1716 push_error (line); 1717 return (FALSE); 1718 1719 escape: 1720 1721 if (V1[0].type == ST_VECTOR_TMP) { 1722 free (V1[0].vector[0].elements.Ptr); 1723 free (V1[0].vector); 1724 V1[0].vector = NULL; 1725 } 1726 1727 clear_stack (V1); 1728 return (TRUE); 1729 1730 } 1731 1732 // vector string operations 1733 int L_unary (StackVar *OUT, StackVar *V1, char *op) { 1734 1735 int Nx = V1[0].vector[0].Nelements; 1736 1737 OUT[0].vector = InitVector (); 1738 OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/ 1739 1740 ResetVector (OUT[0].vector, OPIHI_STR, V1[0].vector[0].Nelements); 1741 char **Iv = V1[0].vector[0].elements.Str; 1742 char **Ov = OUT[0].vector[0].elements.Str; 1743 if (!strcmp (op, "=")) { 1744 for (int i = 0; i < Nx; i++) { 1745 Ov[i] = strcreate (Iv[i]); 1746 } 1747 goto escape; 1748 } 1749 1750 // free the temp vector if needed 1751 if (V1[0].type == ST_VECTOR_TMP) { 1752 // XXX this probably does not free the strings 1753 free (V1[0].vector[0].elements.Ptr); 1754 free (V1[0].vector); 1755 V1[0].vector = NULL; 1756 } 1757 1758 clear_stack (V1); 1759 1760 char line[512]; // this is only used to report an error 1761 snprintf (line, 512, "error: op %s not defined as unary string vector op!", op); 1716 1762 push_error (line); 1717 1763 return (FALSE); -
trunk/Ohana/src/opihi/pantasks/controller_status.c
r37807 r42389 26 26 } 27 27 28 snprintf (command, 1024, "status");28 snprintf_nowarn (command, 1024, "status"); 29 29 for (i = 1; i < argc; i++) { 30 snprintf (tmpline, 1024, "%s %s", command, argv[i]);30 snprintf_nowarn (tmpline, 1024, "%s %s", command, argv[i]); 31 31 strcpy (command, tmpline); 32 32 } -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c.in
r41483 r42389 138 138 ConfigFree (); 139 139 140 // XXX this function is currently called by the thread running ListenClients, but 141 // it should be called by the main above. have this function trigger the 142 // thread shutdown 143 140 144 QuitJobsAndTasksThread(); pthread_join (JobsAndTasksThread, NULL); 141 145 QuitControllerThread(); pthread_join (controllerThread, NULL); -
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
r39457 r42389 4 4 static struct timeval lastlive = {0, 0}; 5 5 static RunLevels RunLevel = PCONTROL_RUN_NONE; 6 7 static int CheckSystemThreadRuns = TRUE; 8 9 void QuitCheckSystemThread (void) { 10 CheckSystemThreadRuns = FALSE; 11 } 12 6 13 7 14 RunLevels SetRunLevel (RunLevels level) { … … 67 74 gprintInit (); 68 75 69 while ( 1) {76 while (CheckSystemThreadRuns) { 70 77 // stop here if the user-thread requests (no objects in flight) 71 78 TestCheckPoint (); -
trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in
r39457 r42389 9 9 # define opihi_rcfile ".pcontrolrc" 10 10 11 # ifdef THREADED 12 static pthread_t clientsThread; 13 # endif 14 11 15 /* program-dependent initialization */ 12 16 void program_init (int *argc, char **argv) { … … 14 18 OHANA_UNUSED_PARAM(argv); 15 19 16 # ifdef THREADED17 pthread_t clientsThread;18 # endif19 20 20 auto_break = TRUE; 21 21 … … 83 83 SetRunLevel (PCONTROL_RUN_HOSTS); 84 84 DownHosts (); 85 86 QuitCheckSystemThread(); pthread_join (clientsThread, NULL); 87 85 88 ConfigFree (); 86 87 89 FreeBasic (); 88 90 FreePcontrol (); -
trunk/Ohana/src/opihi/pcontrol/test/linesize.sh
r18114 r42389 27 27 28 28 for i 1 10 29 job echo $inline 729 job echo $inline6 30 30 end 31 31 … … 34 34 for i 1 10 35 35 stdout $i -var outline 36 strlen "$inline 7" Nin36 strlen "$inline6" Nin 37 37 strlen "$outline" Nout 38 38 -
trunk/Ohana/src/opihi/test/tests.sh
r41470 r42389 53 53 for Tj 0 $testscripts:n 54 54 if ($VERBOSE > 1) 55 echo " running $testscripts:$Tj"55 echo " ----- running $testscripts:$Tj -----" 56 56 end 57 57 runtests $testscripts:$Tj
Note:
See TracChangeset
for help on using the changeset viewer.
