=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/misc.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.1 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/misc.c 2000/01/09 17:00:54 1.1.1.1 +++ OpenXM_contrib/gnuplot/Attic/misc.c 2003/09/15 07:09:25 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: misc.c,v 1.1.1.1 2000/01/09 17:00:54 maekawa Exp $"; +static char *RCSid = "$Id: misc.c,v 1.1.1.3 2003/09/15 07:09:25 ohara Exp $"; #endif /* GNUPLOT - misc.c */ @@ -68,7 +68,7 @@ do{if (datatype[axis]==TIME) { \ }\ putc('"', fp);\ } else {\ - fprintf(fp,"%g",x);\ + fprintf(fp,"%#g",x);\ }} while(0) @@ -100,12 +100,12 @@ int num; { struct curve_points *cp; - cp = (struct curve_points *) gp_alloc((unsigned long) sizeof(struct curve_points), "curve"); + cp = (struct curve_points *) gp_alloc(sizeof(struct curve_points), "curve"); cp->p_max = (num >= 0 ? num : 0); if (num > 0) { cp->points = (struct coordinate GPHUGE *) - gp_alloc((unsigned long) num * sizeof(struct coordinate), "curve points"); + gp_alloc(num * sizeof(struct coordinate), "curve points"); } else cp->points = (struct coordinate GPHUGE *) NULL; cp->next_cp = NULL; @@ -138,7 +138,7 @@ int num; if (num > 0) { if (cp->points == NULL) { cp->points = (struct coordinate GPHUGE *) - gp_alloc((unsigned long) num * sizeof(struct coordinate), "curve points"); + gp_alloc(num * sizeof(struct coordinate), "curve points"); } else { cp->points = (struct coordinate GPHUGE *) gp_realloc(cp->points, (unsigned long) num * sizeof(struct coordinate), "expanding curve points"); @@ -178,11 +178,11 @@ struct iso_curve * int num; { struct iso_curve *ip; - ip = (struct iso_curve *) gp_alloc((unsigned long) sizeof(struct iso_curve), "iso curve"); + ip = (struct iso_curve *) gp_alloc(sizeof(struct iso_curve), "iso curve"); ip->p_max = (num >= 0 ? num : 0); if (num > 0) { ip->points = (struct coordinate GPHUGE *) - gp_alloc((unsigned long) num * sizeof(struct coordinate), "iso curve points"); + gp_alloc(num * sizeof(struct coordinate), "iso curve points"); } else ip->points = (struct coordinate GPHUGE *) NULL; ip->next = NULL; @@ -212,10 +212,10 @@ int num; if (num > 0) { if (ip->points == NULL) { ip->points = (struct coordinate GPHUGE *) - gp_alloc((unsigned long) num * sizeof(struct coordinate), "iso curve points"); + gp_alloc(num * sizeof(struct coordinate), "iso curve points"); } else { ip->points = (struct coordinate GPHUGE *) - gp_realloc(ip->points, (unsigned long) num * sizeof(struct coordinate), "expanding curve points"); + gp_realloc(ip->points, num * sizeof(struct coordinate), "expanding curve points"); } ip->p_max = num; } else { @@ -252,7 +252,7 @@ int num_samp_1, num_iso_1, num_samp_2, num_iso_2; { struct surface_points *sp; - sp = (struct surface_points *) gp_alloc((unsigned long) sizeof(struct surface_points), "surface"); + sp = (struct surface_points *) gp_alloc(sizeof(struct surface_points), "surface"); sp->next_sp = NULL; sp->title = NULL; sp->contours = NULL; @@ -449,7 +449,7 @@ FILE *fp; struct text_label *this_label; struct arrow_def *this_arrow; struct linestyle_def *this_linestyle; - char str[MAX_LINE_LEN + 1]; + char str[MAX_LINE_LEN+1]; /* opinions are split as to whether we save term and outfile * as a compromise, we output them as comments ! @@ -502,20 +502,13 @@ set y2data%s\n", dgrid3d_col_fineness, dgrid3d_norm_value); - fprintf(fp, "\ -set dummy %s,%s\n\ -set format x \"%s\"\n\ -set format y \"%s\"\n\ -set format x2 \"%s\"\n\ -set format y2 \"%s\"\n\ -set format z \"%s\"\n\ -set angles %s\n", - dummy_var[0], dummy_var[1], - conv_text(str, xformat), - conv_text(str, yformat), - conv_text(str, x2format), - conv_text(str, y2format), - conv_text(str, zformat), + fprintf(fp, "set dummy %s,%s\n",dummy_var[0], dummy_var[1]); + fprintf(fp, "set format x \"%s\"\n", conv_text(str, xformat)); + fprintf(fp, "set format y \"%s\"\n", conv_text(str, yformat)); + fprintf(fp, "set format x2 \"%s\"\n", conv_text(str, x2format)); + fprintf(fp, "set format y2 \"%s\"\n", conv_text(str, y2format)); + fprintf(fp, "set format z \"%s\"\n", conv_text(str, zformat)); + fprintf(fp, "set angles %s\n", (angles_format == ANGLES_RADIANS) ? "radians" : "degrees"); if (work_grid.l_type == 0) @@ -696,7 +689,7 @@ set %scontour", } if (missing_val != NULL) - fprintf(fp, "set missing %s\n", missing_val); + fprintf(fp, "set missing '%s'\n", missing_val); save_hidden3doptions(fp); fprintf(fp, "set cntrparam order %d\n", contour_order); @@ -1014,7 +1007,7 @@ FILE *fp; struct position *pos; { static char *msg[] = - {"first_axes ", "second axes ", "graph ", "screen "}; + {"first ", "second ", "graph ", "screen "}; assert(first_axes == 0 && second_axes == 1 && graph == 2 && screen == 3); @@ -1120,9 +1113,9 @@ TBOOLEAN can_do_args; if (can_do_args) { register int il = 0; register char *rl; - char *raw_line = rl = gp_alloc((unsigned long) strlen(input_line) + 1, "string"); + char *raw_line = gp_strdup(input_line); - strcpy(raw_line, input_line); + rl = raw_line; *input_line = '\0'; while (*rl) { register int aix; @@ -1154,7 +1147,8 @@ TBOOLEAN can_do_args; } screen_ok = FALSE; /* make sure command line is echoed on error */ - do_line(); + if (do_line()) + stop = TRUE; } } } @@ -1204,7 +1198,7 @@ FILE *fp; LFS *lf; int argindex; - lf = (LFS *) gp_alloc((unsigned long) sizeof(LFS), (char *) NULL); + lf = (LFS *) gp_alloc(sizeof(LFS), (char *) NULL); if (lf == (LFS *) NULL) { if (fp != (FILE *) NULL) (void) fclose(fp); /* it won't be otherwise */