2 static char *RCSid() { return RCSid("$Id: unset.c,v 1.99.2.7 2008/12/15 03:44:22 sfeam Exp $"); }
5 /* GNUPLOT - unset.c */
8 * Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
10 * Permission to use, copy, and distribute this software and its
11 * documentation for any purpose with or without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and
13 * that both that copyright notice and this permission notice appear
14 * in supporting documentation.
16 * Permission to modify the software is granted, but not the right to
17 * distribute the complete modified source code. Modifications are to
18 * be distributed as patches to the released version. Permission to
19 * distribute binaries produced by compiling modified sources is granted,
21 * 1. distribute the corresponding source modifications from the
22 * released version in the form of a patch file along with the binaries,
23 * 2. add special version identification to distinguish your version
24 * in addition to the base release version number,
25 * 3. provide your name and address as the primary contact for the
26 * support of your modified version, and
27 * 4. retain our contact information in regard to use of the base
29 * Permission to distribute the released version of the source code along
30 * with corresponding source modifications in the form of a patch file is
31 * granted with same provisions 2 through 4 for binary distributions.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
56 #ifdef BINARY_DATA_FILE
57 # include "datafile.h"
60 static void unset_angles __PROTO((void));
61 static void unset_arrow __PROTO((void));
62 static void unset_arrowstyles __PROTO((void));
63 static void free_arrowstyle __PROTO((struct arrowstyle_def *));
64 static void delete_arrow __PROTO((struct arrow_def *, struct arrow_def *));
65 static void unset_autoscale __PROTO((void));
66 static void unset_bars __PROTO((void));
67 static void unset_border __PROTO((void));
69 static void unset_boxwidth __PROTO((void));
70 static void unset_fillstyle __PROTO((void));
71 static void unset_clabel __PROTO((void));
72 static void unset_clip __PROTO((void));
73 static void unset_cntrparam __PROTO((void));
74 static void unset_contour __PROTO((void));
75 static void unset_dgrid3d __PROTO((void));
76 static void unset_dummy __PROTO((void));
77 static void unset_encoding __PROTO((void));
78 static void unset_decimalsign __PROTO((void));
79 static void unset_fit __PROTO((void));
80 static void unset_format __PROTO((void));
81 static void unset_grid __PROTO((void));
82 static void unset_hidden3d __PROTO((void));
84 static void unset_histogram __PROTO((void));
86 static void unset_historysize __PROTO((void));
87 static void unset_isosamples __PROTO((void));
88 static void unset_key __PROTO((void));
89 static void unset_keytitle __PROTO((void));
90 static void unset_label __PROTO((void));
91 static void delete_label __PROTO((struct text_label * prev, struct text_label * this));
93 static void unset_object __PROTO((void));
94 static void delete_object __PROTO((struct object * prev, struct object * this));
95 static void unset_style_rectangle __PROTO(());
97 static void unset_loadpath __PROTO((void));
98 static void unset_locale __PROTO((void));
99 static void reset_logscale __PROTO((AXIS_INDEX));
100 static void unset_logscale __PROTO((void));
102 static void unset_macros __PROTO((void));
104 static void unset_mapping __PROTO((void));
105 static void unset_margin __PROTO((t_position *));
106 static void unset_missing __PROTO((void));
108 static void unset_mouse __PROTO((void));
111 static void unset_multiplot __PROTO((void));
114 static void unset_month_day_tics __PROTO((AXIS_INDEX));
115 static void unset_minitics __PROTO((AXIS_INDEX));
117 static void unset_tics_in __PROTO((void));
118 #endif /* OLDUNSETTICS */
120 static void unset_offsets __PROTO((void));
121 static void unset_origin __PROTO((void));
122 static void unset_output __PROTO((void));
123 static void unset_parametric __PROTO((void));
124 static void unset_pm3d __PROTO((void));
125 static void unset_palette __PROTO((void));
126 static void reset_colorbox __PROTO((void));
127 static void unset_colorbox __PROTO((void));
128 static void unset_pointsize __PROTO((void));
129 static void unset_polar __PROTO((void));
130 static void unset_print __PROTO((void));
131 static void unset_samples __PROTO((void));
132 static void unset_size __PROTO((void));
133 static void unset_style __PROTO((void));
134 static void unset_surface __PROTO((void));
135 static void unset_table __PROTO((void));
136 static void unset_terminal __PROTO((void));
137 static void unset_tics __PROTO((AXIS_INDEX));
138 static void unset_ticscale __PROTO((void));
139 static void unset_ticslevel __PROTO((void));
140 static void unset_timefmt __PROTO((void));
141 static void unset_timestamp __PROTO((void));
142 static void unset_view __PROTO((void));
143 static void unset_zero __PROTO((void));
144 static void unset_timedata __PROTO((AXIS_INDEX));
145 static void unset_range __PROTO((AXIS_INDEX));
146 static void unset_zeroaxis __PROTO((AXIS_INDEX));
147 static void unset_all_zeroaxes __PROTO((void));
149 static void unset_axislabel_or_title __PROTO((text_label *));
150 static void unset_axislabel __PROTO((AXIS_INDEX));
152 /******** The 'unset' command ********/
156 static char GPFAR unsetmess[] =
157 "valid unset options: [] = choose one, {} means optional\n\n\
158 \t'angles', 'arrow', 'autoscale', 'bar', 'border', 'boxwidth', 'clabel',\n\
159 \t'clip', 'cntrparam', 'colorbox', 'contour', 'dgrid3d', 'decimalsign',\n\
160 \t'dummy', 'encoding', 'fit', 'format', 'grid', 'hidden3d', 'historysize',\n\
161 \t'isosamples', 'key', 'label', 'loadpath', 'locale', 'logscale',\n\
162 \t'[blrt]margin', 'mapping', 'missing', 'mouse', 'multiplot', 'offsets',\n\
163 \t'origin', 'output', 'palette', 'parametric', 'pm3d', 'pointsize',\n\
164 \t'polar', 'print', '[rtuv]range', 'samples', 'size', 'style', 'surface',\n\
165 \t'terminal', 'tics', 'ticscale', 'ticslevel', 'timestamp', 'timefmt',\n\
166 \t'title', 'view', '[xyz,cb]{2}data', '[xyz,cb]{2}label',\n\
167 \t'[xyz,cb]{2}range', '{m}[xyz,cb]{2}tics', '[xyz,cb]{2}[md]tics',\n\
168 \t'{[xyz]{2}}zeroaxis', 'zero'";
174 found_token = lookup_table(&set_tbl[0],c_token);
176 /* HBB 20000506: rationalize occurences of c_token++ ... */
177 if (found_token != S_INVALID)
180 switch(found_token) {
268 unset_margin(&bmargin);
271 unset_margin(&lmargin);
274 unset_margin(&rmargin);
277 unset_margin(&tmargin);
280 if (almost_equals(c_token,"fort$ran")) {
281 df_fortran_constants = FALSE;
285 df_fortran_constants = FALSE;
288 free(df_commentschars);
289 df_commentschars = gp_strdup(DEFAULT_COMMENTS_CHARS);
290 #ifdef BINARY_DATA_FILE
291 df_unset_datafile_binary();
300 /* unset_multiplot(); */
301 term_end_multiplot();
360 unset_tics(AXIS_ARRAY_SIZE);
361 #endif /* OLDUNSETTICS */
376 unset_axislabel_or_title(&title);
384 /* FIXME - are the tics correct? */
386 unset_minitics(FIRST_X_AXIS);
389 unset_tics(FIRST_X_AXIS);
393 unset_month_day_tics(FIRST_X_AXIS);
396 unset_minitics(FIRST_Y_AXIS);
399 unset_tics(FIRST_Y_AXIS);
403 unset_month_day_tics(FIRST_X_AXIS);
406 unset_minitics(SECOND_X_AXIS);
409 unset_tics(SECOND_X_AXIS);
413 unset_month_day_tics(FIRST_X_AXIS);
416 unset_minitics(SECOND_Y_AXIS);
419 unset_tics(SECOND_Y_AXIS);
423 unset_month_day_tics(FIRST_X_AXIS);
426 unset_minitics(FIRST_Z_AXIS);
429 unset_tics(FIRST_Z_AXIS);
433 unset_month_day_tics(FIRST_X_AXIS);
436 unset_minitics(COLOR_AXIS);
439 unset_tics(COLOR_AXIS);
443 unset_month_day_tics(FIRST_X_AXIS);
446 unset_timedata(FIRST_X_AXIS);
447 /* FIXME HBB 20000506: does unsetting these axes make *any*
448 * sense? After all, their content is never displayed, so
449 * what would they need a corrected format for? */
450 unset_timedata(T_AXIS);
451 unset_timedata(U_AXIS);
454 unset_timedata(FIRST_Y_AXIS);
455 /* FIXME: see above */
456 unset_timedata(V_AXIS);
459 unset_timedata(FIRST_Z_AXIS);
462 unset_timedata(COLOR_AXIS);
465 unset_timedata(SECOND_X_AXIS);
468 unset_timedata(SECOND_Y_AXIS);
471 unset_axislabel(FIRST_X_AXIS);
474 unset_axislabel(FIRST_Y_AXIS);
477 unset_axislabel(FIRST_Z_AXIS);
480 unset_axislabel(COLOR_AXIS);
483 unset_axislabel(SECOND_X_AXIS);
486 unset_axislabel(SECOND_Y_AXIS);
489 unset_range(FIRST_X_AXIS);
492 unset_range(SECOND_X_AXIS);
495 unset_range(FIRST_Y_AXIS);
498 unset_range(SECOND_Y_AXIS);
501 unset_range(FIRST_Z_AXIS);
504 unset_range(COLOR_AXIS);
519 unset_zeroaxis(FIRST_X_AXIS);
522 unset_zeroaxis(FIRST_Y_AXIS);
525 unset_zeroaxis(FIRST_Z_AXIS);
528 unset_zeroaxis(SECOND_X_AXIS);
531 unset_zeroaxis(SECOND_Y_AXIS);
534 unset_all_zeroaxes();
538 int_error(c_token, unsetmess);
541 update_gpval_variables(0); /* update GPVAL_ inner variables */
545 /* process 'unset angles' command */
553 /* process 'unset arrow' command */
558 struct arrow_def *this_arrow;
559 struct arrow_def *prev_arrow;
562 if (END_OF_COMMAND) {
563 /* delete all arrows */
564 while (first_arrow != NULL)
565 delete_arrow((struct arrow_def *) NULL, first_arrow);
568 tag = (int) real(const_express(&a));
570 int_error(c_token, "extraneous arguments to unset arrow");
571 for (this_arrow = first_arrow, prev_arrow = NULL;
573 prev_arrow = this_arrow, this_arrow = this_arrow->next) {
574 if (this_arrow->tag == tag) {
575 delete_arrow(prev_arrow, this_arrow);
576 return; /* exit, our job is done */
579 int_error(c_token, "arrow not found");
584 /* delete arrow from linked list started by first_arrow.
585 * called with pointers to the previous arrow (prev) and the
586 * arrow to delete (this).
587 * If there is no previous arrow (the arrow to delete is
588 * first_arrow) then call with prev = NULL.
591 delete_arrow(struct arrow_def *prev, struct arrow_def *this)
593 if (this != NULL) { /* there really is something to delete */
594 if (prev != NULL) /* there is a previous arrow */
595 prev->next = this->next;
596 else /* this = first_arrow so change first_arrow */
597 first_arrow = this->next;
602 /* delete the whole list of arrow styles */
606 free_arrowstyle(first_arrowstyle);
607 first_arrowstyle = NULL;
611 free_arrowstyle(struct arrowstyle_def *arrowstyle)
614 free_arrowstyle(arrowstyle->next);
619 /* process 'unset autoscale' command */
623 if (END_OF_COMMAND) {
624 INIT_AXIS_ARRAY(set_autoscale, FALSE);
625 } else if (equals(c_token, "xy") || equals(c_token, "tyx")) {
626 axis_array[FIRST_X_AXIS].set_autoscale
627 = axis_array[FIRST_Y_AXIS].set_autoscale = AUTOSCALE_NONE;
630 /* HBB 20000506: parse axis name, and unset the right element
632 int axis = lookup_table(axisname_tbl, c_token);
634 axis_array[axis].set_autoscale = AUTOSCALE_NONE;
641 /* process 'unset bars' command */
649 /* process 'unset border' command */
653 /* this is not the effect as with reset, as the border is enabled,
659 /* process 'unset boxwidth' command */
664 boxwidth_is_absolute = TRUE;
668 /* process 'unset fill' command */
672 default_fillstyle.fillstyle = FS_EMPTY;
673 default_fillstyle.filldensity = 100;
674 default_fillstyle.fillpattern = 0;
675 default_fillstyle.border_linetype = LT_UNDEFINED;
679 /* process 'unset clabel' command */
683 /* FIXME? reset_command() uses TRUE */
684 label_contours = FALSE;
688 /* process 'unset clip' command */
692 if (END_OF_COMMAND) {
693 /* same as all three */
697 } else if (almost_equals(c_token, "p$oints"))
699 else if (almost_equals(c_token, "o$ne"))
701 else if (almost_equals(c_token, "t$wo"))
704 int_error(c_token, "expecting 'points', 'one', or 'two'");
709 /* process 'unset cntrparam' command */
713 contour_pts = DEFAULT_NUM_APPROX_PTS;
714 contour_kind = CONTOUR_KIND_LINEAR;
715 contour_order = DEFAULT_CONTOUR_ORDER;
716 contour_levels = DEFAULT_CONTOUR_LEVELS;
717 contour_levels_kind = LEVELS_AUTO;
721 /* process 'unset contour' command */
725 draw_contour = CONTOUR_NONE;
729 /* process 'unset dgrid3d' command */
733 dgrid3d_row_fineness = 10;
734 dgrid3d_col_fineness = 10;
735 dgrid3d_norm_value = 1;
740 /* process 'unset dummy' command */
744 strcpy(set_dummy_var[0], "x");
745 strcpy(set_dummy_var[1], "y");
749 /* process 'unset encoding' command */
753 encoding = S_ENC_DEFAULT;
757 /* process 'unset decimalsign' command */
761 if (decimalsign != NULL)
765 setlocale(LC_NUMERIC,"C");
770 /* process 'unset fit' command */
774 if (fitlogfile != NULL)
778 fit_errorvariables = FALSE;
779 #endif /* GP_FIT_ERRVARS */
783 /* process 'unset format' command */
784 /* FIXME: compare and merge with set.c::set_format */
788 TBOOLEAN set_for_axis[AXIS_ARRAY_SIZE] = AXIS_ARRAY_INITIALIZER(FALSE);
791 if ((axis = lookup_table(axisname_tbl, c_token)) >= 0) {
792 set_for_axis[axis] = TRUE;
793 } else if (equals(c_token,"xy") || equals(c_token,"yx")) {
794 set_for_axis[FIRST_X_AXIS]
795 = set_for_axis[FIRST_Y_AXIS]
798 } else if (isstring(c_token) || END_OF_COMMAND) {
799 /* Assume he wants all */
800 for (axis = 0; axis < AXIS_ARRAY_SIZE; axis++)
801 set_for_axis[axis] = TRUE;
804 if (END_OF_COMMAND) {
805 SET_DEFFORMAT(FIRST_X_AXIS , set_for_axis);
806 SET_DEFFORMAT(FIRST_Y_AXIS , set_for_axis);
807 SET_DEFFORMAT(FIRST_Z_AXIS , set_for_axis);
808 SET_DEFFORMAT(SECOND_X_AXIS, set_for_axis);
809 SET_DEFFORMAT(SECOND_Y_AXIS, set_for_axis);
810 SET_DEFFORMAT(COLOR_AXIS , set_for_axis);
815 /* process 'unset grid' command */
819 /* FIXME HBB 20000506: there is no command to explicitly reset the
820 * linetypes for major and minor gridlines. This function should
821 * do that, maybe... */
824 /* grid_selection = GRID_OFF; */
825 for (; i < AXIS_ARRAY_SIZE; i++) {
826 axis_array[i].gridmajor = FALSE;
827 axis_array[i].gridminor = FALSE;
832 /* process 'unset hidden3d' command */
837 printf(" Hidden Line Removal Not Supported in LITE version\n");
843 #ifdef EAM_HISTOGRAMS
847 histogram_opts.type = HT_CLUSTERED;
848 histogram_opts.gap = 2;
852 /* process 'unset historysize' command */
856 #ifdef GNUPLOT_HISTORY
857 gnuplot_history_size = -1; /* don't ever truncate the history. */
859 int_error(c_token, "Command 'unset historysize' requires history support.");
864 /* process 'unset isosamples' command */
868 /* HBB 20000506: was freeing 2D data structures although
869 * isosamples are only used by 3D plots. */
871 sp_free(first_3dplot);
874 iso_samples_1 = ISO_SAMPLES;
875 iso_samples_2 = ISO_SAMPLES;
882 legend_key temp_key = DEFAULT_KEY_PROPS;
883 memcpy(&keyT, &temp_key, sizeof(keyT));
886 /* process 'unset key' command */
890 legend_key *key = &keyT;
891 key->visible = FALSE;
895 /* process 'unset keytitle' command */
899 legend_key *key = &keyT;
900 key->title[0] = '\0'; /* empty string */
904 /* process 'unset label' command */
909 struct text_label *this_label;
910 struct text_label *prev_label;
913 if (END_OF_COMMAND) {
914 /* delete all labels */
915 while (first_label != NULL)
916 delete_label((struct text_label *) NULL, first_label);
919 tag = (int) real(const_express(&a));
921 int_error(c_token, "extraneous arguments to unset label");
922 for (this_label = first_label, prev_label = NULL;
924 prev_label = this_label, this_label = this_label->next) {
925 if (this_label->tag == tag) {
926 delete_label(prev_label, this_label);
927 return; /* exit, our job is done */
930 /* int_warn(c_token, "label not found"); */
935 /* delete label from linked list started by first_label.
936 * called with pointers to the previous label (prev) and the
937 * label to delete (this).
938 * If there is no previous label (the label to delete is
939 * first_label) then call with prev = NULL.
942 delete_label(struct text_label *prev, struct text_label *this)
944 if (this != NULL) { /* there really is something to delete */
945 if (prev != NULL) /* there is a previous label */
946 prev->next = this->next;
947 else /* this = first_label so change first_label */
948 first_label = this->next;
949 if (this->text) free (this->text);
950 if (this->font) free (this->font);
956 /* process 'unset rectangle' command */
961 struct object *this_object;
962 struct object *prev_object;
965 if (END_OF_COMMAND) {
966 /* delete all objects */
967 while (first_object != NULL)
968 delete_object((struct object *) NULL, first_object);
971 tag = (int) real(const_express(&a));
973 int_error(c_token, "extraneous arguments to unset rectangle");
974 for (this_object = first_object, prev_object = NULL;
976 prev_object = this_object, this_object = this_object->next) {
977 if (this_object->tag == tag) {
978 delete_object(prev_object, this_object);
979 return; /* exit, our job is done */
982 int_error(c_token, "object not found");
987 /* delete object from linked list started by first_object.
988 * called with pointers to the previous object (prev) and the
989 * object to delete (this).
990 * If there is no previous object (the object to delete is
991 * first_object) then call with prev = NULL.
994 delete_object(struct object *prev, struct object *this)
996 if (this != NULL) { /* there really is something to delete */
997 if (prev != NULL) /* there is a previous rectangle */
998 prev->next = this->next;
999 else /* this = first_object so change first_object */
1000 first_object = this->next;
1001 /* FIXME: Must free contents as well */
1008 /* process 'unset loadpath' command */
1016 /* process 'unset locale' command */
1024 reset_logscale(AXIS_INDEX axis)
1026 axis_array[axis].log = FALSE;
1027 axis_array[axis].base = 0.0;
1030 /* process 'unset logscale' command */
1036 if (END_OF_COMMAND) {
1037 /* clean all the islog flags. This will hit some currently
1038 * unused ones, too, but that's actually a good thing, IMHO */
1039 for(axis = 0; axis < AXIS_ARRAY_SIZE; axis++)
1040 reset_logscale(axis);
1044 /* do reverse search because of "x", "x1", "x2" sequence in
1046 while (i < token[c_token].length) {
1047 axis = lookup_table_nth_reverse(axisname_tbl, AXIS_ARRAY_SIZE,
1048 gp_input_line + token[c_token].start_index + i);
1050 token[c_token].start_index += i;
1051 int_error(c_token, "unknown axis");
1053 reset_logscale(axisname_tbl[axis].value);
1054 i += strlen(axisname_tbl[axis].key);
1061 /* process 'unset macros' command */
1065 expand_macros = FALSE;
1069 /* process 'unset mapping3d' command */
1073 /* assuming same as points */
1074 mapping3d = MAP3D_CARTESIAN;
1077 /* process 'unset {blrt}margin' command */
1079 unset_margin(t_position *margin)
1081 margin->scalex = character;
1085 /* process 'unset datafile' command */
1094 /* process 'unset mouse' command */
1098 mouse_setting.on = 0;
1100 PM_update_menu_items();
1102 UpdateStatusline(); /* wipe status line */
1106 /* process 'unset mxtics' command */
1108 unset_minitics(AXIS_INDEX axis)
1110 axis_array[axis].minitics = MINI_OFF;
1111 axis_array[axis].mtic_freq = 10.0;
1115 /*process 'unset {x|y|x2|y2|z}tics' command */
1117 unset_tics(AXIS_INDEX axis)
1119 struct position tics_nooffset = { character, character, character, 0., 0., 0.};
1120 unsigned int istart = 0;
1121 unsigned int iend = AXIS_ARRAY_SIZE;
1124 if (axis < AXIS_ARRAY_SIZE) {
1129 for (i = istart; i < iend; ++i) {
1130 axis_array[i].ticmode = NO_TICS;
1132 if (axis_array[i].ticdef.font) {
1133 free(axis_array[i].ticdef.font);
1134 axis_array[i].ticdef.font = NULL;
1136 axis_array[i].ticdef.textcolor.type = TC_DEFAULT;
1137 axis_array[i].ticdef.textcolor.lt = 0;
1138 axis_array[i].ticdef.textcolor.value = 0;
1139 axis_array[i].ticdef.offset = tics_nooffset;
1140 axis_array[i].ticdef.rangelimited = FALSE;
1141 axis_array[i].tic_rotate = 0;
1142 axis_array[i].ticscale = 1.0;
1143 axis_array[i].miniticscale = 0.5;
1144 axis_array[i].tic_in = TRUE;
1146 free_marklist(axis_array[i].ticdef.def.user);
1147 axis_array[i].ticdef.def.user = NULL;
1152 unset_month_day_tics(AXIS_INDEX axis)
1154 axis_array[axis].ticdef.type = TIC_COMPUTED;
1157 /* process 'unset offsets' command */
1161 loff = roff = toff = boff = 0.0;
1165 /* process 'unset origin' command */
1174 /* process 'unset output' command */
1179 int_error(c_token, "you can't change the output in multiplot mode");
1183 term_set_output(NULL);
1186 outstr = NULL; /* means STDOUT */
1191 /* process 'unset print' command */
1195 print_set_output(NULL, FALSE);
1199 /* process 'unset parametric' command */
1205 if (!polar) { /* keep t for polar */
1208 (void) fprintf(stderr,"\n\tdummy variable is x for curves, x/y for surfaces\n");
1213 /* process 'unset palette' command */
1218 fprintf(stderr, "you can't unset the palette.\n");
1222 /* reset colorbox to default settings */
1226 color_box = default_color_box;
1230 /* process 'unset colorbox' command: reset to default settings and then
1236 color_box.where = SMCOLOR_BOX_NO;
1240 /* process 'unset pm3d' command */
1244 pm3d.implicit = PM3D_EXPLICIT;
1245 /* reset styles, required to 'plot something' after e.g. 'set pm3d map' */
1246 if (data_style == PM3DSURFACE) data_style = POINTSTYLE;
1247 if (func_style == PM3DSURFACE) func_style = LINES;
1251 /* process 'unset pointsize' command */
1259 /* process 'unset polar' command */
1265 if (parametric && axis_array[T_AXIS].set_autoscale) {
1266 /* only if user has not set an explicit range */
1267 axis_array[T_AXIS].set_min = axis_defaults[T_AXIS].min;
1268 axis_array[T_AXIS].set_max = axis_defaults[T_AXIS].min;
1271 strcpy (set_dummy_var[0], "x");
1273 (void) fprintf(stderr,"\n\tdummy variable is x for curves\n");
1279 /* process 'unset samples' command */
1283 /* HBB 20000506: unlike unset_isosamples(), this one *has* to
1284 * clear 2D data structues! */
1285 cp_free(first_plot);
1288 sp_free(first_3dplot);
1289 first_3dplot = NULL;
1291 samples_1 = SAMPLES;
1292 samples_2 = SAMPLES;
1296 /* process 'unset size' command */
1306 /* process 'unset style' command */
1310 if (END_OF_COMMAND) {
1311 data_style = POINTSTYLE;
1313 while (first_linestyle != NULL)
1314 delete_linestyle((struct linestyle_def *) NULL, first_linestyle);
1317 unset_style_rectangle();
1319 #ifdef EAM_HISTOGRAMS
1326 switch(lookup_table(show_style_tbl, c_token)){
1327 case SHOW_STYLE_DATA:
1328 data_style = POINTSTYLE;
1331 case SHOW_STYLE_FUNCTION:
1335 case SHOW_STYLE_LINE:
1337 if (END_OF_COMMAND) {
1338 while (first_linestyle != NULL)
1339 delete_linestyle((struct linestyle_def *) NULL, first_linestyle);
1342 int tag = (int) real(const_express(&a));
1343 struct linestyle_def *this, *prev;
1344 for (this = first_linestyle, prev = NULL; this != NULL;
1345 prev = this, this = this->next) {
1346 if (this->tag == tag) {
1347 delete_linestyle(prev, this);
1353 case SHOW_STYLE_FILLING:
1357 #ifdef EAM_HISTOGRAMS
1358 case SHOW_STYLE_HISTOGRAM:
1363 case SHOW_STYLE_ARROW:
1364 unset_arrowstyles();
1368 case SHOW_STYLE_RECTANGLE:
1369 unset_style_rectangle();
1374 int_error(c_token, "expecting 'data', 'function', 'line', 'fill' or 'arrow'");
1379 /* process 'unset surface' command */
1383 draw_surface = FALSE;
1387 /* process 'unset table' command */
1392 fclose(table_outfile);
1393 table_outfile = NULL;
1398 /* process 'unset terminal' comamnd */
1402 /* This is a problematic case */
1405 int_error(c_token, "You can't change the terminal in multiplot mode");
1413 /* process 'unset tics' command */
1417 unsigned int i = AXIS_ARRAY_SIZE;
1420 if (equals(c_token,"x"))
1422 else if (equals(c_token,"y"))
1424 else if (equals(c_token,"z"))
1426 else if (equals(c_token,"x2"))
1428 else if (equals(c_token,"y2"))
1430 else if (equals(c_token,"cb"))
1432 if (i < AXIS_ARRAY_SIZE)
1435 if (i < AXIS_ARRAY_SIZE)
1436 axis_array[i].tic_in = TRUE;
1438 for (i = 0; i < AXIS_ARRAY_SIZE; ++i)
1439 axis_array[i].tic_in = TRUE;
1442 #endif /* OLDUNSETTICS */
1445 /* process 'unset ticscale' command */
1452 "Deprecated syntax - please use 'set tics scale default'");
1454 for (i = 0; i < AXIS_ARRAY_SIZE; ++i) {
1455 axis_array[i].ticscale = 1.0;
1456 axis_array[i].miniticscale = 0.5;
1461 /* process 'unset ticslevel' command */
1465 xyplane.ticslevel = 0.5;
1466 xyplane.absolute = FALSE;
1470 /* Process 'unset timefmt' command */
1477 for (axis=0; axis < AXIS_ARRAY_SIZE; axis++)
1478 strcpy(axis_array[axis].timefmt,TIMEFMT);
1479 else if ((axis=lookup_table(axisname_tbl, c_token)) >= 0) {
1480 strcpy(axis_array[axis].timefmt, TIMEFMT);
1484 /* int_error() from inside 'reset' would cause problems */
1485 int_warn(c_token, "expected optional axis name");
1490 /* process 'unset timestamp' command */
1494 unset_axislabel_or_title(&timelabel);
1495 timelabel_rotate = 0;
1496 timelabel_bottom = TRUE;
1500 /* process 'unset view' command */
1504 splot_map_deactivate();
1506 aspect_ratio_3D = 0;
1507 surface_rot_z = 30.0;
1508 surface_rot_x = 60.0;
1509 surface_scale = 1.0;
1510 surface_zscale = 1.0;
1514 /* process 'unset zero' command */
1521 /* process 'unset {x|y|z|x2|y2}data' command */
1523 unset_timedata(AXIS_INDEX axis)
1525 axis_array[axis].is_timedata = FALSE;
1529 /* process 'unset {x|y|z|x2|y2|t|u|v|r}range' command */
1531 unset_range(AXIS_INDEX axis)
1533 /* FIXME HBB 20000506: do we want to reset the axis autoscale and
1535 axis_array[axis].range_flags = 0;
1538 /* process 'unset {x|y|x2|y2|z}zeroaxis' command */
1540 unset_zeroaxis(AXIS_INDEX axis)
1542 axis_array[axis].zeroaxis = default_axis_zeroaxis;
1546 /* process 'unset zeroaxis' command */
1548 unset_all_zeroaxes()
1552 for(axis = 0; axis < AXIS_ARRAY_SIZE; axis++)
1553 unset_zeroaxis(axis);
1557 /* process 'unset [xyz]{2}label command */
1559 unset_axislabel_or_title(text_label *label)
1561 struct position default_offset = { character, character, character,
1568 label->offset = default_offset;
1569 label->textcolor.type = TC_DEFAULT;
1574 unset_axislabel(AXIS_INDEX axis)
1576 unset_axislabel_or_title(&axis_array[axis].label);
1577 axis_array[axis].label = default_axis_label;
1578 if (axis == FIRST_Y_AXIS || axis == SECOND_Y_AXIS || axis == COLOR_AXIS)
1579 axis_array[axis].label.rotate = TEXT_VERTICAL;
1582 /******** The 'reset' command ********/
1583 /* HBB 20000506: I moved this here, from set.c, because 'reset' really
1584 * is more like a big lot of 'unset' commands, rather than a bunch of
1585 * 'set's. The benefit is that it can make use of many of the
1586 * unset_something() contained in this module, i.e. you now have one
1587 * place less to keep in sync if the semantics or defaults of any
1588 * option is changed. This is only true for options for which 'unset'
1589 * state is the default, however, e.g. not for 'surface', 'bars' and
1595 TBOOLEAN save_interactive = interactive;
1596 static const TBOOLEAN set_for_axis[AXIS_ARRAY_SIZE]
1597 = AXIS_ARRAY_INITIALIZER(TRUE);
1601 /* Kludge alert, HBB 20000506: set to noninteractive mode, to
1602 * suppress some of the commentary output by the individual
1603 * unset_...() routines. */
1604 interactive = FALSE;
1610 while (first_arrow != NULL)
1611 delete_arrow((struct arrow_def *) NULL, first_arrow);
1612 unset_arrowstyles();
1614 while (first_label != NULL)
1615 delete_label((struct text_label *) NULL, first_label);
1616 /* delete linestyles */
1617 while (first_linestyle != NULL)
1618 delete_linestyle((struct linestyle_def *) NULL, first_linestyle);
1620 /* delete objects */
1621 while (first_object != NULL)
1622 delete_object((struct object *) NULL, first_object);
1623 unset_style_rectangle();
1626 /* 'polar', 'parametric' and 'dummy' are interdependent, so be
1627 * sure to keep the order intact */
1632 unset_axislabel_or_title(&title);
1638 unset_view(); /* has to be called in advance to reset reversed yrange if splot_map_active */
1640 for (axis=0; axis<AXIS_ARRAY_SIZE; axis++) {
1641 SET_DEFFORMAT(axis, set_for_axis);
1642 unset_timedata(axis);
1643 unset_zeroaxis(axis);
1645 unset_axislabel(axis);
1647 axis_array[axis].set_autoscale = AUTOSCALE_BOTH;
1648 axis_array[axis].writeback_min = axis_array[axis].set_min
1649 = axis_defaults[axis].min;
1650 axis_array[axis].writeback_max = axis_array[axis].set_max
1651 = axis_defaults[axis].max;
1653 /* 'tics' default is on for some, off for the other axes: */
1655 axis_array[axis].ticmode = axis_defaults[axis].ticmode;
1656 unset_minitics(axis);
1657 axis_array[axis].ticdef = default_axis_ticdef;
1658 axis_array[axis].minitics = MINI_DEFAULT;
1660 reset_logscale(axis);
1665 clip_points = FALSE;
1667 clip_lines2 = FALSE;
1669 border_lp = default_border_lp;
1674 data_style = POINTSTYLE;
1680 grid_lp = default_grid_lp;
1681 mgrid_lp = default_grid_lp;
1682 polar_grid_angle = 0;
1685 reset_hidden3doptions();
1688 label_contours = TRUE;
1689 strcpy(contour_format, "%8.3g");
1695 aspect_ratio = 0.0; /* don't force it */
1707 #endif /* OLDUNSETTICS */
1708 unset_margin(&bmargin);
1709 unset_margin(&lmargin);
1710 unset_margin(&rmargin);
1711 unset_margin(&tmargin);
1714 unset_decimalsign();
1718 #ifdef BINARY_DATA_FILE
1719 df_unset_datafile_binary();
1722 #ifdef EAM_HISTOGRAMS
1727 df_separator = '\0';
1728 free(df_commentschars);
1729 df_commentschars = gp_strdup(DEFAULT_COMMENTS_CHARS);
1733 /* 2003-18-04: Don't reset non-graphics settings, like set term, out,
1734 * loadpath and fontpath. */
1740 /* 01-Jun-2006: Deleting undefined user variables can break user functions.
1741 * E.g. f(x) = a + b; reset;
1742 * f(x) is still defined, sort of, but it holds pointers to a and b, which
1743 * have been deleted. Evaluation after a reset can trigger a segfault.
1745 /* Garbage collection on space allocated for user variables */
1749 update_gpval_variables(0); /* update GPVAL_ inner variables */
1751 /* HBB 20000506: set 'interactive' back to its real value: */
1752 interactive = save_interactive;
1757 unset_style_rectangle()
1759 struct object foo = DEFAULT_RECTANGLE_STYLE;
1760 default_rectangle = foo;