version 1.1.1.2, 2000/01/22 14:15:59 |
version 1.1.1.3, 2003/09/15 07:09:25 |
Line 120 extern TBOOLEAN df_binary; |
|
Line 120 extern TBOOLEAN df_binary; |
|
* dont know we have to support ranges [10:-10] - lets reverse |
* dont know we have to support ranges [10:-10] - lets reverse |
* it for now, then fix it at the end. |
* it for now, then fix it at the end. |
*/ |
*/ |
#define INIT_ARRAYS(axis, min, max, auto, is_log, base, log_base, infinite) \ |
|
do{auto_array[axis] = auto; \ |
/* HBB 20021103: try to circumvent BC31 bug by turning this macro into |
min_array[axis] = (infinite && (auto&1)) ? VERYLARGE : min; \ |
* a function... */ |
max_array[axis] = (infinite && (auto&2)) ? -VERYLARGE : max; \ |
static GP_INLINE void |
log_array[axis] = is_log; base_array[axis] = base; log_base_array[axis] = log_base;\ |
init_arrays(int axis, double min, double max, int autosc, int is_log, double base, double log_base, TBOOLEAN infinite) |
}while(0) |
{ |
|
auto_array[axis] = autosc; |
|
min_array[axis] = (infinite && (autosc & 1)) ? VERYLARGE : min; |
|
max_array[axis] = (infinite && (autosc & 2)) ? -VERYLARGE : max; |
|
log_array[axis] = is_log; |
|
base_array[axis] = base; |
|
log_base_array[axis] = log_base; |
|
} |
|
#define INIT_ARRAYS init_arrays |
|
|
/* handle reversed ranges */ |
/* handle reversed ranges */ |
#define CHECK_REVERSE(axis) \ |
#define CHECK_REVERSE(axis) \ |
do{\ |
do{\ |
Line 248 void plotrequest() |
|
Line 257 void plotrequest() |
|
} /* first '[' */ |
} /* first '[' */ |
if (parametric || polar) /* set optional x ranges */ |
if (parametric || polar) /* set optional x ranges */ |
LOAD_RANGE(FIRST_X_AXIS); |
LOAD_RANGE(FIRST_X_AXIS); |
else { |
|
/* order of t doesn't matter, but x does */ |
|
CHECK_REVERSE(FIRST_X_AXIS); |
|
} |
|
|
|
|
/* order of x range does matter, even if we're in parametric mode */ |
|
CHECK_REVERSE(FIRST_X_AXIS); |
|
|
LOAD_RANGE(FIRST_Y_AXIS); |
LOAD_RANGE(FIRST_Y_AXIS); |
CHECK_REVERSE(FIRST_Y_AXIS); |
CHECK_REVERSE(FIRST_Y_AXIS); |
LOAD_RANGE(SECOND_X_AXIS); |
LOAD_RANGE(SECOND_X_AXIS); |
Line 325 struct curve_points *this_plot; |
|
Line 333 struct curve_points *this_plot; |
|
case BOXES: |
case BOXES: |
min_cols = 2; |
min_cols = 2; |
max_cols = 4; |
max_cols = 4; |
|
break; |
|
|
default: |
default: |
min_cols = 1; |
min_cols = 1; |
Line 718 struct curve_points *this_plot; |
|
Line 727 struct curve_points *this_plot; |
|
int plot_num; |
int plot_num; |
{ |
{ |
int i, curve; |
int i, curve; |
|
char *table_format = NULL; |
|
/* The data format is determined by the format of the axis labels. |
|
* See 'set format'. Patch by Don Taber |
|
*/ |
|
table_format = gp_alloc(strlen(xformat)+strlen(yformat)+5, "table format"); |
|
strcpy(table_format, xformat); |
|
strcat(table_format, " "); |
|
strcat(table_format, yformat); |
|
strcat(table_format, " %c\n"); |
|
|
|
/* Not sure whether the missing plot styles require special treatment. |
|
* They all fall under the "default" case right now. Lars |
|
*/ |
for (curve = 0; curve < plot_num; |
for (curve = 0; curve < plot_num; |
curve++, this_plot = this_plot->next_cp) { |
curve++, this_plot = this_plot->next_cp) { |
fprintf(gpoutfile, "#Curve %d, %d points\n#x y type\n", curve, this_plot->p_count); |
fprintf(gpoutfile, "#Curve %d, %d points\n#x y", curve, this_plot->p_count); |
|
switch (this_plot->plot_style) { |
|
case BOXES: |
|
case XERRORBARS: |
|
fprintf(gpoutfile, " xlow xhigh"); |
|
break; |
|
case BOXERROR: |
|
case YERRORBARS: |
|
fprintf(gpoutfile, " ylow yhigh"); |
|
break; |
|
case BOXXYERROR: |
|
case XYERRORBARS: |
|
fprintf(gpoutfile, " xlow xhigh ylow yhigh"); |
|
break; |
|
case FINANCEBARS: |
|
case CANDLESTICKS: |
|
default: |
|
/* ? */ |
|
break; |
|
} |
|
|
|
fprintf(gpoutfile, " type\n"); |
for (i = 0; i < this_plot->p_count; i++) { |
for (i = 0; i < this_plot->p_count; i++) { |
fprintf(gpoutfile, "%g %g %c\n", |
fprintf(gpoutfile, "%g %g", |
this_plot->points[i].x, |
this_plot->points[i].x, |
this_plot->points[i].y, |
this_plot->points[i].y); |
|
switch (this_plot->plot_style) { |
|
case BOXES: |
|
case XERRORBARS: |
|
fprintf(gpoutfile, " %g %g", |
|
this_plot->points[i].xlow, |
|
this_plot->points[i].xhigh); |
|
break; |
|
case BOXERROR: |
|
case YERRORBARS: |
|
fprintf(gpoutfile, " %g %g", |
|
this_plot->points[i].ylow, |
|
this_plot->points[i].yhigh); |
|
break; |
|
case BOXXYERROR: |
|
case XYERRORBARS: |
|
fprintf(gpoutfile, " %g %g %g %g", |
|
this_plot->points[i].xlow, |
|
this_plot->points[i].xhigh, |
|
this_plot->points[i].ylow, |
|
this_plot->points[i].yhigh); |
|
break; |
|
case FINANCEBARS: |
|
case CANDLESTICKS: |
|
default: |
|
/* ? */ |
|
break; |
|
} |
|
fprintf(gpoutfile, " %c\n", |
this_plot->points[i].type == INRANGE ? 'i' |
this_plot->points[i].type == INRANGE ? 'i' |
: this_plot->points[i].type == OUTRANGE ? 'o' |
: this_plot->points[i].type == OUTRANGE ? 'o' |
: 'u'); |
: 'u'); |
} |
} |
fputc('\n', gpoutfile); |
fputc('\n', gpoutfile); |
} |
} |
/* two blank lines between plots in table output */ |
|
|
/* two blank lines between plots in table output */ |
fputc('\n', gpoutfile); |
fputc('\n', gpoutfile); |
fflush(gpoutfile); |
fflush(gpoutfile); |
|
|
|
free(table_format); |
} |
} |
|
|
/* |
/* |
Line 1212 do{ assert(!polar && !parametric); \ |
|
Line 1285 do{ assert(!polar && !parametric); \ |
|
|
|
if (uses_axis[FIRST_X_AXIS]) { |
if (uses_axis[FIRST_X_AXIS]) { |
if (max_array[FIRST_X_AXIS] == -VERYLARGE || |
if (max_array[FIRST_X_AXIS] == -VERYLARGE || |
min_array[FIRST_X_AXIS] == VERYLARGE) |
min_array[FIRST_X_AXIS] == VERYLARGE) { |
|
cp_free(first_plot); |
|
first_plot = NULL; |
int_error("all points undefined!", NO_CARET); |
int_error("all points undefined!", NO_CARET); |
|
} |
FIXUP_RANGE_FOR_LOG(FIRST_X_AXIS, x); |
FIXUP_RANGE_FOR_LOG(FIRST_X_AXIS, x); |
} |
} |
if (uses_axis[SECOND_X_AXIS]) { |
if (uses_axis[SECOND_X_AXIS]) { |
if (max_array[SECOND_X_AXIS] == -VERYLARGE || |
if (max_array[SECOND_X_AXIS] == -VERYLARGE || |
min_array[SECOND_X_AXIS] == VERYLARGE) |
min_array[SECOND_X_AXIS] == VERYLARGE) { |
|
cp_free(first_plot); |
|
first_plot = NULL; |
int_error("all points undefined!", NO_CARET); |
int_error("all points undefined!", NO_CARET); |
|
} |
FIXUP_RANGE_FOR_LOG(SECOND_X_AXIS, x2); |
FIXUP_RANGE_FOR_LOG(SECOND_X_AXIS, x2); |
} else { |
} else { |
assert(uses_axis[FIRST_X_AXIS]); |
assert(uses_axis[FIRST_X_AXIS]); |
Line 1241 do{ assert(!polar && !parametric); \ |
|
Line 1320 do{ assert(!polar && !parametric); \ |
|
|
|
if (uses_axis[FIRST_Y_AXIS]) { |
if (uses_axis[FIRST_Y_AXIS]) { |
if (max_array[FIRST_Y_AXIS] == -VERYLARGE || |
if (max_array[FIRST_Y_AXIS] == -VERYLARGE || |
min_array[FIRST_Y_AXIS] == VERYLARGE) |
min_array[FIRST_Y_AXIS] == VERYLARGE) { |
|
cp_free(first_plot); |
|
first_plot = NULL; |
int_error("all points undefined!", NO_CARET); |
int_error("all points undefined!", NO_CARET); |
|
} |
fixup_range(FIRST_Y_AXIS, "y"); |
fixup_range(FIRST_Y_AXIS, "y"); |
FIXUP_RANGE_FOR_LOG(FIRST_Y_AXIS, y); |
FIXUP_RANGE_FOR_LOG(FIRST_Y_AXIS, y); |
} |
} |
if (uses_axis[SECOND_Y_AXIS]) { |
if (uses_axis[SECOND_Y_AXIS]) { |
if (max_array[SECOND_Y_AXIS] == -VERYLARGE || |
if (max_array[SECOND_Y_AXIS] == -VERYLARGE || |
min_array[SECOND_Y_AXIS] == VERYLARGE) |
min_array[SECOND_Y_AXIS] == VERYLARGE) { |
|
cp_free(first_plot); |
|
first_plot = NULL; |
int_error("all points undefined!", NO_CARET); |
int_error("all points undefined!", NO_CARET); |
|
} |
fixup_range(SECOND_Y_AXIS, "y2"); |
fixup_range(SECOND_Y_AXIS, "y2"); |
FIXUP_RANGE_FOR_LOG(SECOND_Y_AXIS, y2); |
FIXUP_RANGE_FOR_LOG(SECOND_Y_AXIS, y2); |
} else { |
} else { |
Line 1272 do{ assert(!polar && !parametric); \ |
|
Line 1357 do{ assert(!polar && !parametric); \ |
|
max_array[FIRST_Y_AXIS] = max_array[SECOND_Y_AXIS]; |
max_array[FIRST_Y_AXIS] = max_array[SECOND_Y_AXIS]; |
} |
} |
|
|
#define WRITEBACK(axis,min,max) \ |
|
if(range_flags[axis]&RANGE_WRITEBACK) \ |
|
{if (auto_array[axis]&1) min = min_array[axis]; \ |
|
if (auto_array[axis]&2) max = max_array[axis]; \ |
|
} |
|
|
|
WRITEBACK(FIRST_X_AXIS, xmin, xmax) |
|
WRITEBACK(FIRST_Y_AXIS, ymin, ymax) |
|
WRITEBACK(SECOND_X_AXIS, x2min, x2max) |
|
WRITEBACK(SECOND_Y_AXIS, y2min, y2max) |
|
|
|
if (strcmp(term->name, "table") == 0) |
if (strcmp(term->name, "table") == 0) |
print_table(first_plot, plot_num); |
print_table(first_plot, plot_num); |
else { |
else { |
Line 1292 if(range_flags[axis]&RANGE_WRITEBACK) \ |
|
Line 1366 if(range_flags[axis]&RANGE_WRITEBACK) \ |
|
do_plot(first_plot, plot_num); |
do_plot(first_plot, plot_num); |
|
|
END_LEAK_CHECK(); |
END_LEAK_CHECK(); |
|
|
|
/* after do_plot(), min_array[] and max_array[] |
|
contain the plotting range actually used (rounded |
|
to tic marks, not only the min/max data values) |
|
--> save them now for writeback if requested */ |
|
|
|
#define SAVE_WRITEBACK(axis) /* ULIG */ \ |
|
if(range_flags[axis]&RANGE_WRITEBACK) { \ |
|
set_writeback_min(axis,min_array[axis]); \ |
|
set_writeback_max(axis,max_array[axis]); \ |
|
} |
|
SAVE_WRITEBACK(FIRST_X_AXIS) |
|
SAVE_WRITEBACK(FIRST_Y_AXIS) |
|
SAVE_WRITEBACK(FIRST_Z_AXIS) |
|
SAVE_WRITEBACK(SECOND_X_AXIS) |
|
SAVE_WRITEBACK(SECOND_Y_AXIS) |
|
SAVE_WRITEBACK(SECOND_Z_AXIS) |
|
SAVE_WRITEBACK(T_AXIS) |
|
SAVE_WRITEBACK(R_AXIS) |
|
SAVE_WRITEBACK(U_AXIS) |
|
SAVE_WRITEBACK(V_AXIS) |
} |
} |
|
|
/* if we get here, all went well, so record this line for replot */ |
/* if we get here, all went well, so record this line for replot */ |
|
|
/* Ok, fix up the title to include both the xp and yp plots. */ |
/* Ok, fix up the title to include both the xp and yp plots. */ |
if (xp->title && xp->title[0] != '\0' && yp->title) { |
if (xp->title && xp->title[0] != '\0' && yp->title) { |
tlen = strlen(yp->title) + strlen(xp->title) + 3; |
tlen = strlen(yp->title) + strlen(xp->title) + 3; |
new_title = gp_alloc((unsigned long) tlen, "string"); |
new_title = gp_alloc(tlen, "string"); |
strcpy(new_title, xp->title); |
strcpy(new_title, xp->title); |
strcat(new_title, ", "); /* + 2 */ |
strcat(new_title, ", "); /* + 2 */ |
strcat(new_title, yp->title); /* + 1 = + 3 */ |
strcat(new_title, yp->title); /* + 1 = + 3 */ |