|
|
|
@ -1144,7 +1144,7 @@ marker_position(int m, int t, int *x, int *y)
|
|
|
|
static int greater(int x, int y) { return x > y; }
|
|
|
|
static int greater(int x, int y) { return x > y; }
|
|
|
|
static int lesser(int x, int y) { return x < y; }
|
|
|
|
static int lesser(int x, int y) { return x < y; }
|
|
|
|
|
|
|
|
|
|
|
|
static int (*compare)(int x, int y) = lesser;
|
|
|
|
static int (*compare)(int x, int y) = greater;
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
int
|
|
|
|
marker_search(void)
|
|
|
|
marker_search(void)
|
|
|
|
@ -1157,9 +1157,9 @@ marker_search(void)
|
|
|
|
|
|
|
|
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][0]);
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][0]);
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
|
|
|
index_t index = trace_index[TRACE_ACTUAL][i];
|
|
|
|
int new_value = CELL_Y(trace_index[TRACE_ACTUAL][i]);
|
|
|
|
if ((*compare)(value, CELL_Y(index))) {
|
|
|
|
if ((*compare)(value, new_value)) {
|
|
|
|
value = CELL_Y(index);
|
|
|
|
value = new_value;
|
|
|
|
found = i;
|
|
|
|
found = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1173,30 +1173,36 @@ set_marker_search(int mode)
|
|
|
|
compare = (mode == 0) ? greater : lesser;
|
|
|
|
compare = (mode == 0) ? greater : lesser;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
|
|
search_is_greater(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return(compare == greater);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
int
|
|
|
|
marker_search_left(int from)
|
|
|
|
marker_search_left(int from)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
int found = -1;
|
|
|
|
int found = -1;
|
|
|
|
#define MINMAX_DELTA -10
|
|
|
|
#define MINMAX_DELTA -5
|
|
|
|
if (uistat.current_trace == -1)
|
|
|
|
if (uistat.current_trace == -1)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][from]);
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][from]);
|
|
|
|
for (i = from - 1; i >= 0; i--) {
|
|
|
|
for (i = from - 1; i >= 0; i--) {
|
|
|
|
index_t index = trace_index[TRACE_ACTUAL][i];
|
|
|
|
int new_value = CELL_Y(trace_index[TRACE_ACTUAL][i]);
|
|
|
|
if ((*compare)(value - MINMAX_DELTA, CELL_Y(index)))
|
|
|
|
if ((*compare)(value + MINMAX_DELTA, new_value))
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
value = CELL_Y(index);
|
|
|
|
value = new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (; i >= 0; i--) {
|
|
|
|
for (; i >= 0; i--) {
|
|
|
|
index_t index = trace_index[TRACE_ACTUAL][i];
|
|
|
|
int new_value = CELL_Y(trace_index[TRACE_ACTUAL][i]);
|
|
|
|
if ((*compare)(CELL_Y(index), value + MINMAX_DELTA)) {
|
|
|
|
if ((*compare)(new_value, value - MINMAX_DELTA)) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
found = i;
|
|
|
|
found = i;
|
|
|
|
value = CELL_Y(index);
|
|
|
|
value = new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1211,19 +1217,19 @@ marker_search_right(int from)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][from]);
|
|
|
|
int value = CELL_Y(trace_index[TRACE_ACTUAL][from]);
|
|
|
|
for (i = from + 1; i < sweep_points; i++) {
|
|
|
|
for (i = from + 1; i < sweep_points; i++) {
|
|
|
|
index_t index = trace_index[TRACE_ACTUAL][i];
|
|
|
|
int new_value = CELL_Y(trace_index[TRACE_ACTUAL][i]);
|
|
|
|
if ((*compare)(value, CELL_Y(index)))
|
|
|
|
if ((*compare)(value+MINMAX_DELTA, new_value))
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
value = CELL_Y(index);
|
|
|
|
value = new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (; i < sweep_points; i++) {
|
|
|
|
for (; i < sweep_points; i++) {
|
|
|
|
index_t index = trace_index[TRACE_ACTUAL][i];
|
|
|
|
int new_value = CELL_Y(trace_index[TRACE_ACTUAL][i]);
|
|
|
|
if ((*compare)(CELL_Y(index), value)) {
|
|
|
|
if ((*compare)(new_value, value-MINMAX_DELTA)) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
found = i;
|
|
|
|
found = i;
|
|
|
|
value = CELL_Y(index);
|
|
|
|
value = new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|