projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed centering prior to sweep operation
[pspp]
/
src
/
cartesian.c
diff --git
a/src/cartesian.c
b/src/cartesian.c
index cac18400a4e9e85c6b1dc78bc795b3323b76dd4c..9dceb304ebb75c33477d5989b9bac0b512ba5baf 100644
(file)
--- a/
src/cartesian.c
+++ b/
src/cartesian.c
@@
-14,8
+14,8
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
- 0211
1-1307
, USA. */
+ Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+ 0211
0-1301
, USA. */
#include <math.h>
#include <math.h>
@@
-53,6
+53,8
@@
write_legend(struct chart *chart, const char *heading, int n);
void
chart_write_xlabel(struct chart *ch, const char *label)
{
void
chart_write_xlabel(struct chart *ch, const char *label)
{
+ if ( ! ch )
+ return ;
pl_savestate_r(ch->lp);
pl_savestate_r(ch->lp);
@@
-69,6
+71,9
@@
chart_write_xlabel(struct chart *ch, const char *label)
void
chart_write_ylabel(struct chart *ch, const char *label)
{
void
chart_write_ylabel(struct chart *ch, const char *label)
{
+ if ( ! ch )
+ return ;
+
pl_savestate_r(ch->lp);
pl_move_r(ch->lp, ch->data_bottom, ch->ordinate_right);
pl_savestate_r(ch->lp);
pl_move_r(ch->lp, ch->data_bottom, ch->ordinate_right);
@@
-86,6
+91,10
@@
write_legend(struct chart *chart, const char *heading,
{
int ds;
{
int ds;
+ if ( ! chart )
+ return ;
+
+
pl_savestate_r(chart->lp);
pl_filltype_r(chart->lp,1);
pl_savestate_r(chart->lp);
pl_filltype_r(chart->lp,1);
@@
-124,19
+133,22
@@
write_legend(struct chart *chart, const char *heading,
void
chart_datum(struct chart *ch, int dataset UNUSED, double x, double y)
{
void
chart_datum(struct chart *ch, int dataset UNUSED, double x, double y)
{
- const double x_pos =
- (x - ch->x_min) * ch->abscissa_scale + ch->data_left ;
+ if ( ! ch )
+ return ;
- const double y_pos =
- (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ;
+ {
+ const double x_pos =
+ (x - ch->x_min) * ch->abscissa_scale + ch->data_left ;
+ const double y_pos =
+ (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ;
- pl_savestate_r(ch->lp);
+
pl_savestate_r(ch->lp);
- pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15);
-
- pl_restorestate_r(ch->lp);
+ pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15);
+ pl_restorestate_r(ch->lp);
+ }
}
/* Draw a line with slope SLOPE and intercept INTERCEPT.
}
/* Draw a line with slope SLOPE and intercept INTERCEPT.
@@
-151,6
+163,10
@@
chart_line(struct chart *ch, double slope, double intercept,
double x1, y1;
double x2, y2 ;
double x1, y1;
double x2, y2 ;
+ if ( ! ch )
+ return ;
+
+
if ( lim_dim == CHART_DIM_Y )
{
x1 = ( limit1 - intercept ) / slope ;
if ( lim_dim == CHART_DIM_Y )
{
x1 = ( limit1 - intercept ) / slope ;