Ejemplo n.º 1
0
uint8_t menu_GPS_MAIN_SCN(void)
{
	menu_key_loop();
	
	if(keycode == KEY_OK)
	{
		switch(mi_index)
		{
			case 0:
				save_position();
				break;
			case 1:
				finish_logfile();
				sys_state = SYS_READY;
				break;
			case 2:
				return 2;
				break;
			default:
				break;
		}
		return 1;
	}
	else
	{
		return 2;
	}
	return 0;
}
Ejemplo n.º 2
0
void Key_task(void)
{
	key_scan();
	
	if(keycode != KEY_NULL)
	{
		if(scn_mode == GPS_MAIN_SCN)
		{
			switch(keycode)
			{
				case KEY_UP:
				case KEY_DOWN:
					switch_scn_flag(0);
					set_screen(GPS_MAIN_SCN);
					break;
				case KEY_LEFT:
					save_position();
					break;	
				case KEY_OK:
				case KEY_CANCEL:
					menu_start();
					break;
				default:
					break;
			}
		}
	}
}
Ejemplo n.º 3
0
void print_input_buf( char * str, int input_off )
{
	save_position();
	move_xy( 20, 10 );
	printf("                                   \n");
	move_xy( 20, 10 );
	printf("%s len = %d\n", str, strlen(str) );
	printf( "input_off = %d\n", input_off );
	fflush( NULL );
	restore_position();
}
Ejemplo n.º 4
0
void RedScreen::show_full_screen()
{
    if (_full_screen) {
        return;
    }
    RecurciveLock lock(_update_lock);
    hide();
    save_position();
    _full_screen = true;
    __show_full_screen();
}
Ejemplo n.º 5
0
int debug( char * fmt, char * str )
{
	save_position();
	
	move_xy( 65, 15 );
	printf("            \n");
	move_xy( 65, 15 );
	printf( fmt, str );
	
	restore_position();
}
Ejemplo n.º 6
0
int show_left_words( char * prefix, char left_words[][MAX_WORDS_LEN] )
{
	save_position();

	bar( 2, 6, winx / 3 - 3, left_words_num, ' ' );
	int i;
	for( i=0; i<have_search_words_num; i++ ) {
		move_xy( 3, 6+i );
		left_words[i][winx/3-5-strlen(prefix)] = '\0';
		printf("%s%s", prefix, left_words[i] );
	}
	fflush( NULL );
	restore_position();
}
Ejemplo n.º 7
0
RedScreen::RedScreen(Application& owner, int id, const std::string& name, int width, int height)
    : _owner (owner)
    , _id (id)
    , _refs (1)
    , _window (*this)
    , _active (false)
    , _full_screen (false)
    , _out_of_sync (false)
    , _frame_area (false)
    , _periodic_update (false)
    , _key_interception (false)
    , _update_by_timer (true)
    , _size_locked (false)
    , _forec_update_timer (0)
    , _update_timer (new UpdateTimer(this))
    , _composit_area (NULL)
    , _update_mark (1)
    , _monitor (NULL)
    , _default_cursor (NULL)
    , _inactive_cursor (NULL)
    , _pixel_format_index (0)
    , _update_interrupt_trigger (NULL)
    , _pointer_layer (NULL)
    , _mouse_captured (false)
    , _active_layer_change_event (false)
    , _pointer_on_screen (false)
{
    region_init(&_dirty_region);
    set_name(name);
    _size.x = width;
    _size.y = height;
    _origin.x = _origin.y = 0;
    create_composit_area();
    _window.resize(_size.x, _size.y);
    save_position();
    if ((_default_cursor = Platform::create_default_cursor()) == NULL) {
        THROW("create default cursor failed");
    }
    if ((_inactive_cursor = Platform::create_inactive_cursor()) == NULL) {
        THROW("create inactive cursor failed");
    }
    _window.set_cursor(_default_cursor);
    update_menu();
    AutoRef<Icon> icon(Platform::load_icon(RED_ICON_RES_ID));
    _window.set_icon(*icon);
    _window.start_key_interception();
}
Ejemplo n.º 8
0
void glStaticMovesRobot::save_file( string mFilename  )
{
    ofstream  outfile;
    outfile.open(mFilename);

    int count=1;
    struct stBodyPositionVector bp;
    bool   result = false;
    while (result==false)                           // Loop thru all positions within the demo() function.
    {
        result = demo();
        extract_body_pose(&bp);
        outfile << "Move #" << count++ << endl;
        save_position( outfile, &bp );
        m_left_arm.m_gripper.write_angles ( outfile );
        m_right_arm.m_gripper.write_angles( outfile );
    }
    outfile.close();
}
Ejemplo n.º 9
0
void show_english(char *english)
{
	save_position();

	int i,j,k;
	
	for(i = 0;i < word_count;i++)
	{
		move_xy(6 + i,2);
		for(j = 0;english[j] != 0 && j < win_y / 3 - 3;j++)
			putchar(english[j]);
		for(k = 0;word[i][k] != 0 && j < win_y / 3 - 3;k++,j++)
			putchar(word[i][k]);
	}

	fflush(stdout);

	restore_position();
}	
Ejemplo n.º 10
0
int show_explain( char * words, char * explain )
{
	save_position();

	bar( winx/3 + 2, 7, winx/3*2 -2, winy - 8, ' ' );
	move_xy( winx / 3 + 2, 7 );
	if( explain == NULL ) {
		printf("sorry, 没有找到这个单词.\n" );
	} else {
		printf("------ <<善哉电子辞典>> -------");
		move_xy( winx / 3 + 2, 8 );
		printf("单词: ");
		move_xy( winx / 3 + 2, 9 );
		printf("   %s", words ); 
		move_xy( winx / 3 + 2, 10 );
		printf("意义: ");
		move_xy( winx / 3 + 2, 11 );
		printf( "  %s\n", explain );
	}
	restore_position();
}
Ejemplo n.º 11
0
void show_chinese(char *chinese,char *english)
{
	int i,l;
	if(chinese != NULL && english != NULL)
	{
		save_position();

		move_xy(7,win_y / 3 + 1);
		puts("单词:");
		
		move_xy(8,win_y / 3 + 1);
		printf("     %s\n",english);	
		
		move_xy(10,win_y / 3 + 1);
		puts("意义:");

		move_xy(11,win_y / 3 + 1);
		printf("     %s\n",chinese);

		restore_position();
	}
}
Ejemplo n.º 12
0
char			*get_next_line2(const int fd)
{
  static char		buffer[SIZE_BUF];
  static int		position = 0;
  char			*returned;
  int			i;
  int			ret;

  i = 0;
  if((ret = read(fd, buffer + position, SIZE_READ - position)) <= 0)
    return (NULL);
  buffer[SIZE_BUF] = '\0';
  if ((returned = malloc(sizeof(char) * SIZE_BUF)) == NULL)
    return (NULL);
  returned[i] = '\0';
  while (buffer[i] && buffer[i] != '\n')
    returned[i] = buffer[i++];
  if (buffer[i] == '\n')
    i++;
  position = save_position(buffer, i);
  return (returned);
}
Ejemplo n.º 13
0
void 
save_histogram_opts (FILE *fp)
{
    switch (histogram_opts.type) {
	default:
	case HT_CLUSTERED:
	    fprintf(fp,"clustered gap %d ",histogram_opts.gap); break;
	case HT_ERRORBARS:
	    fprintf(fp,"errorbars gap %d lw %g",histogram_opts.gap,histogram_opts.bar_lw); break;
	case HT_STACKED_IN_LAYERS:
	    fprintf(fp,"rowstacked "); break;
	case HT_STACKED_IN_TOWERS:
	    fprintf(fp,"columnstacked "); break;
    }
    if (fp == stderr)
	fprintf(fp,"\n\t\t");
    fprintf(fp,"title");
    save_textcolor(fp, &histogram_opts.title.textcolor);
    if (histogram_opts.title.font)
	fprintf(fp, " font \"%s\" ", histogram_opts.title.font);
    save_position(fp, &histogram_opts.title.offset, TRUE);
    fprintf(fp, "\n");
}
Ejemplo n.º 14
0
static void save_config_cb (void * hook_data, void * user_data)
{
    if (gtk_widget_get_visible ((GtkWidget *) user_data))
        save_position ((GtkWidget *) user_data);
}
Ejemplo n.º 15
0
static bool_t hide_cb (GtkWidget * window)
{
    save_position (window);
    gtk_widget_hide (window);
    return TRUE;
}
Ejemplo n.º 16
0
static void
save_tics(FILE *fp, AXIS_INDEX axis)
{
    if ((axis_array[axis].ticmode & TICS_MASK) == NO_TICS) {
	fprintf(fp, "set no%stics\n", axis_defaults[axis].name);
	return;
    }
    fprintf(fp, "set %stics %s %s scale %g,%g %smirror %s ",
	    axis_defaults[axis].name,
	    ((axis_array[axis].ticmode & TICS_MASK) == TICS_ON_AXIS)
	    ? "axis" : "border",
	    (axis_array[axis].tic_in) ? "in" : "out",
	    axis_array[axis].ticscale, axis_array[axis].miniticscale,
	    (axis_array[axis].ticmode & TICS_MIRROR) ? "" : "no",
	    axis_array[axis].tic_rotate ? "rotate" : "norotate");
    if (axis_array[axis].tic_rotate)
    	fprintf(fp,"by %d ",axis_array[axis].tic_rotate);
    save_position(fp, &axis_array[axis].ticdef.offset, TRUE);
    if (axis_array[axis].manual_justify) {
    	switch (axis_array[axis].label.pos) {
    	case LEFT:{
		fputs(" left", fp);
		break;
	    }
    	case RIGHT:{
		fputs(" right", fp);
		break;
	    }
    	case CENTRE:{
		fputs(" center", fp);
		break;
	    }
    	}
    } else 
        fputs(" autojustify", fp);
    fprintf(fp, "\nset %stics ", axis_defaults[axis].name);
    switch (axis_array[axis].ticdef.type) {
    case TIC_COMPUTED:{
	    fputs("autofreq ", fp);
	    break;
	}
    case TIC_MONTH:{
	    fprintf(fp, "\nset %smtics", axis_defaults[axis].name);
	    break;
	}
    case TIC_DAY:{
	    fprintf(fp, "\nset %sdtics", axis_defaults[axis].name);
	    break;
	}
    case TIC_SERIES:
	if (axis_array[axis].ticdef.def.series.start != -VERYLARGE) {
	    SAVE_NUM_OR_TIME(fp,
			     (double) axis_array[axis].ticdef.def.series.start,
			     axis);
	    putc(',', fp);
	}
	fprintf(fp, "%g", axis_array[axis].ticdef.def.series.incr);
	if (axis_array[axis].ticdef.def.series.end != VERYLARGE) {
	    putc(',', fp);
	    SAVE_NUM_OR_TIME(fp,
			     (double) axis_array[axis].ticdef.def.series.end,
			     axis);
	}
	break;
    case TIC_USER:
	break;
    }

    fprintf(fp, (axis_array[axis].ticdef.rangelimited)?" rangelimit":" norangelimit");

    if (axis_array[axis].ticdef.font && *axis_array[axis].ticdef.font)
        fprintf(fp, " font \"%s\"", axis_array[axis].ticdef.font);

    if (axis_array[axis].ticdef.textcolor.type != TC_DEFAULT)
        save_textcolor(fp, &axis_array[axis].ticdef.textcolor);

    putc('\n', fp);

    if (axis_array[axis].ticdef.def.user) { 
	struct ticmark *t;
	fprintf(fp, "set %stics %s ", axis_defaults[axis].name,
		(axis_array[axis].ticdef.type == TIC_USER) ? "" : "add");
	fputs(" (", fp);
	for (t = axis_array[axis].ticdef.def.user; t != NULL; t = t->next) {
	    if (t->level < 0)	/* Don't save ticlabels read from data file */
		continue;
	    if (t->label)
		fprintf(fp, "\"%s\" ", conv_text(t->label));
	    SAVE_NUM_OR_TIME(fp, (double) t->position, axis);
	    if (t->level)
		fprintf(fp, " %d", t->level);
	    if (t->next) {
		fputs(", ", fp);
	    }
	}
	fputs(")\n", fp);
    }

}
Ejemplo n.º 17
0
/* Save/show rectangle <tag> (0 means show all) */
void
save_object(FILE *fp, int tag)
{
    t_object *this_object;
    t_rectangle *this_rect;
    t_circle *this_circle;
    t_ellipse *this_ellipse;
    TBOOLEAN showed = FALSE;

    for (this_object = first_object; this_object != NULL; this_object = this_object->next) {
	if ((this_object->object_type == OBJ_RECTANGLE)
	    && (tag == 0 || tag == this_object->tag)) {
	    this_rect = &this_object->o.rectangle;
	    showed = TRUE;
	    fprintf(fp, "%sobject %2d rect ", (fp==stderr) ? "\t" : "set ",this_object->tag);

	    if (this_rect->type == 1) {
		fprintf(fp, "center ");
		save_position(fp, &this_rect->center, FALSE);
		fprintf(fp, " size ");
		save_position(fp, &this_rect->extent, FALSE);
	    } else {
		fprintf(fp, "from ");
		save_position(fp, &this_rect->bl, FALSE);
		fprintf(fp, " to ");
		save_position(fp, &this_rect->tr, FALSE);
	    }
	}

	else if ((this_object->object_type == OBJ_CIRCLE)
	    && (tag == 0 || tag == this_object->tag)) {
	    struct position *e = &this_object->o.circle.extent;
	    this_circle = &this_object->o.circle;
	    showed = TRUE;
	    fprintf(fp, "%sobject %2d circle ", (fp==stderr) ? "\t" : "set ",this_object->tag);

	    fprintf(fp, "center ");
	    save_position(fp, &this_circle->center, FALSE);
	    fprintf(fp, " size ");
	    fprintf(fp, "%s%g", e->scalex == first_axes ? "" : coord_msg[e->scalex], e->x);
	    fprintf(fp, " arc [%g:%g] ", this_circle->arc_begin, this_circle->arc_end);
	}

	else if ((this_object->object_type == OBJ_ELLIPSE)
	    && (tag == 0 || tag == this_object->tag)) {
	    struct position *e = &this_object->o.ellipse.extent;
	    this_ellipse = &this_object->o.ellipse;
	    showed = TRUE;
	    fprintf(fp, "%sobject %2d ellipse ", (fp==stderr) ? "\t" : "set ",this_object->tag);
	    fprintf(fp, "center ");
	    save_position(fp, &this_ellipse->center, FALSE);
	    fprintf(fp, " size ");
	    fprintf(fp, "%s%g", e->scalex == first_axes ? "" : coord_msg[e->scalex], e->x);
	    fprintf(fp, ", %s%g", e->scaley == e->scalex ? "" : coord_msg[e->scaley], e->y);
	    fprintf(fp, "  angle %g", this_ellipse->orientation);
	    fputs(" units ", fp);
	    switch (this_ellipse->type) {
        	case ELLIPSEAXES_XY:
        	    fputs("xy", fp);
		    break;
		case ELLIPSEAXES_XX:
		    fputs("xx", fp);
		    break;
		case ELLIPSEAXES_YY:
		    fputs("yy", fp);
		    break;
	    }
	}

	else if ((this_object->object_type == OBJ_POLYGON)
	    && (tag == 0 || tag == this_object->tag)) {
	    t_polygon *this_polygon = &this_object->o.polygon;
	    int nv;
	    showed = TRUE;
	    fprintf(fp, "%sobject %2d polygon ", (fp==stderr) ? "\t" : "set ",this_object->tag);
	    if (this_polygon->vertex) {
		fprintf(fp, "from ");
		save_position(fp, &this_polygon->vertex[0], FALSE);
	    }
	    for (nv=1; nv < this_polygon->type; nv++) {
		fprintf(fp, (fp==stderr) ? "\n\t\t\t    to " : " to ");
		save_position(fp, &this_polygon->vertex[nv], FALSE);
	    }
	}

	/* Properties common to all objects */
	if (tag == 0 || tag == this_object->tag) {
	    fprintf(fp, "\n%sobject %2d ", (fp==stderr) ? "\t" : "set ",this_object->tag);
	    fprintf(fp, "%s ", this_object->layer > 0 ? "front" : this_object->layer < 0 ? "behind" : "back");
	    if (this_object->clip == OBJ_NOCLIP)
		fputs("noclip ", fp);
	    else 
		fputs("clip ", fp);

	    if (this_object->lp_properties.l_width)
		    fprintf(fp, "lw %.1f ",this_object->lp_properties.l_width);
	    fprintf(fp, "fc ");
	    if (this_object->lp_properties.l_type == LT_DEFAULT)
		    fprintf(fp,"default");
	    else if (this_object->lp_properties.use_palette)
		    save_pm3dcolor(fp, &this_object->lp_properties.pm3d_color);
	    else
		    fprintf(fp, "lt %d",this_object->lp_properties.l_type+1);
	    fprintf(fp, " fillstyle ");
	    save_fillstyle(fp, &this_object->fillstyle);
	}

    }
    if (tag > 0 && !showed)
	int_error(c_token, "object not found");
}
Ejemplo n.º 18
0
static void
save_set_all(FILE *fp)
{
    struct text_label *this_label;
    struct arrow_def *this_arrow;
    struct linestyle_def *this_linestyle;
    struct arrowstyle_def *this_arrowstyle;
    legend_key *key = &keyT;
    int axis;

    /* opinions are split as to whether we save term and outfile
     * as a compromise, we output them as comments !
     */
    if (term)
	fprintf(fp, "# set terminal %s %s\n", term->name, term_options);
    else
	fputs("# set terminal unknown\n", fp);

    if (outstr)
	fprintf(fp, "# set output '%s'\n", outstr);
    else
	fputs("# set output\n", fp);

    fprintf(fp, "\
%sset clip points\n\
%sset clip one\n\
%sset clip two\n\
set bar %f %s\n",
	    (clip_points) ? "" : "un",
	    (clip_lines1) ? "" : "un",
	    (clip_lines2) ? "" : "un",
	    bar_size, (bar_layer == LAYER_BACK) ? "back" : "front");

    if (draw_border) {
	fprintf(fp, "set border %d %s", draw_border, border_layer == 0 ? "back" : "front");
	save_linetype(fp, &border_lp, FALSE);
	fprintf(fp, "\n");
    } else
	fputs("unset border\n", fp);

    for (axis = FIRST_AXES; axis < LAST_REAL_AXIS; axis++) {
	if (axis == SECOND_Z_AXIS) continue;
	if (strlen(axis_array[axis].timefmt))
	    fprintf(fp, "set timefmt %s \"%s\"\n", axis_defaults[axis].name,
		conv_text(axis_array[axis].timefmt));
	if (axis == COLOR_AXIS) continue;
	fprintf(fp, "set %sdata %s\n", axis_defaults[axis].name,
		axis_array[axis].datatype == DT_TIMEDATE ? "time" :
		"");
    }

    if (boxwidth < 0.0)
	fputs("set boxwidth\n", fp);
    else
	fprintf(fp, "set boxwidth %g %s\n", boxwidth,
		(boxwidth_is_absolute) ? "absolute" : "relative");

    fprintf(fp, "set style fill ");
    save_fillstyle(fp, &default_fillstyle);

#ifdef EAM_OBJECTS
    /* Default rectangle style */
    fprintf(fp, "set style rectangle %s fc ",
	    default_rectangle.layer > 0 ? "front" : 
	    default_rectangle.layer < 0 ? "behind" : "back");
    if (default_rectangle.lp_properties.use_palette)
	save_pm3dcolor(fp, &default_rectangle.lp_properties.pm3d_color);
    else
	fprintf(fp, "lt %d",default_rectangle.lp_properties.l_type+1);
    fprintf(fp, " fillstyle ");
    save_fillstyle(fp, &default_rectangle.fillstyle);

    /* Default circle properties */
    fprintf(fp, "set style circle radius ");
    save_position(fp, &default_circle.o.circle.extent, FALSE);
    fputs(" \n", fp);

    /* Default ellipse properties */
    fprintf(fp, "set style ellipse size ");
    save_position(fp, &default_ellipse.o.ellipse.extent, FALSE);
    fprintf(fp, " angle %g ", default_ellipse.o.ellipse.orientation);
    fputs("units ", fp);
    switch (default_ellipse.o.ellipse.type) {
        case ELLIPSEAXES_XY:
            fputs("xy\n", fp);
	    break;
	case ELLIPSEAXES_XX:
	    fputs("xx\n", fp);
	    break;
	case ELLIPSEAXES_YY:
	    fputs("yy\n", fp);
	    break;
    }
#endif

    if (dgrid3d) {
      if( dgrid3d_mode == DGRID3D_QNORM ) {
	fprintf(fp, "set dgrid3d %d,%d, %d\n",
          	dgrid3d_row_fineness,
          	dgrid3d_col_fineness,
          	dgrid3d_norm_value);
      } else if( dgrid3d_mode == DGRID3D_SPLINES ) {
	fprintf(fp, "set dgrid3d %d,%d splines\n",
          	dgrid3d_row_fineness, dgrid3d_col_fineness );
      } else {
	fprintf(fp, "set dgrid3d %d,%d %s%s %f,%f\n",
          	dgrid3d_row_fineness,
          	dgrid3d_col_fineness,
		reverse_table_lookup(dgrid3d_mode_tbl, dgrid3d_mode),
		dgrid3d_kdensity ? " kdensity2d" : "",
          	dgrid3d_x_scale,
          	dgrid3d_y_scale );
      }
    }

    fprintf(fp, "set dummy %s,%s\n", set_dummy_var[0], set_dummy_var[1]);

#define SAVE_FORMAT(axis)						\
    fprintf(fp, "set format %s \"%s\"\n", axis_defaults[axis].name,	\
	    conv_text(axis_array[axis].formatstring));
    SAVE_FORMAT(FIRST_X_AXIS );
    SAVE_FORMAT(FIRST_Y_AXIS );
    SAVE_FORMAT(SECOND_X_AXIS);
    SAVE_FORMAT(SECOND_Y_AXIS);
    SAVE_FORMAT(FIRST_Z_AXIS );
    SAVE_FORMAT(COLOR_AXIS );
    SAVE_FORMAT(POLAR_AXIS );
#undef SAVE_FORMAT

    fprintf(fp, "set angles %s\n",
	    (ang2rad == 1.0) ? "radians" : "degrees");

    /* Grid back/front controls tics also. Make sure it is saved */
    if (grid_layer >= 0)
	fprintf(fp,"set tics %s\n", grid_layer == 0 ? "back" : "front");
    
    if (! some_grid_selected())
	fputs("unset grid\n", fp);
    else {
	if (polar_grid_angle) 	/* set angle already output */
	    fprintf(fp, "set grid polar %f\n", polar_grid_angle / ang2rad);
        else
	    fputs("set grid nopolar\n", fp);

#define SAVE_GRID(axis)					\
	fprintf(fp, " %s%stics %sm%stics",		\
		axis_array[axis].gridmajor ? "" : "no",	\
		axis_defaults[axis].name,		\
		axis_array[axis].gridminor ? "" : "no",	\
		axis_defaults[axis].name);
	fputs("set grid", fp);
	SAVE_GRID(FIRST_X_AXIS);
	SAVE_GRID(FIRST_Y_AXIS);
	SAVE_GRID(FIRST_Z_AXIS);
	fputs(" \\\n", fp);
	SAVE_GRID(SECOND_X_AXIS);
	SAVE_GRID(SECOND_Y_AXIS);
	SAVE_GRID(COLOR_AXIS);
	fputs("\n", fp);
#undef SAVE_GRID

	fprintf(fp, "set grid %s  ", (grid_layer==-1) ? "layerdefault" : ((grid_layer==0) ? "back" : "front"));
	save_linetype(fp, &grid_lp, FALSE);
	fprintf(fp, ", ");
	save_linetype(fp, &mgrid_lp, FALSE);
	fputc('\n', fp);
    }
    fprintf(fp, "%sset raxis\n", raxis ? "" : "un");

    fprintf(fp, "set key title \"%s\"", conv_text(key->title));
    if (key->font)
	fprintf(fp, " font \"%s\"", key->font);
    if (key->textcolor.type != TC_LT || key->textcolor.lt != LT_BLACK)
	save_textcolor(fp, &key->textcolor);
    fputs("\n", fp);

    fputs("set key ", fp);
    switch (key->region) {
	case GPKEY_AUTO_INTERIOR_LRTBC:
	    fputs("inside", fp);
	    break;
	case GPKEY_AUTO_EXTERIOR_LRTBC:
	    fputs("outside", fp);
	    break;
	case GPKEY_AUTO_EXTERIOR_MARGIN:
	    switch (key->margin) {
	    case GPKEY_TMARGIN:
		fputs("tmargin", fp);
		break;
	    case GPKEY_BMARGIN:
		fputs("bmargin", fp);
		break;
	    case GPKEY_LMARGIN:
		fputs("lmargin", fp);
		break;
	    case GPKEY_RMARGIN:
		fputs("rmargin", fp);
		break;
	    }
	    break;
	case GPKEY_USER_PLACEMENT:
	    fputs("at ", fp);
	    save_position(fp, &key->user_pos, FALSE);
	    break;
    }
    if (!(key->region == GPKEY_AUTO_EXTERIOR_MARGIN
	      && (key->margin == GPKEY_LMARGIN || key->margin == GPKEY_RMARGIN))) {
	switch (key->hpos) {
	    case RIGHT:
		fputs(" right", fp);
		break;
	    case LEFT:
		fputs(" left", fp);
		break;
	    case CENTRE:
		fputs(" center", fp);
		break;
	}
    }
    if (!(key->region == GPKEY_AUTO_EXTERIOR_MARGIN
	      && (key->margin == GPKEY_TMARGIN || key->margin == GPKEY_BMARGIN))) {
	switch (key->vpos) {
	    case JUST_TOP:
		fputs(" top", fp);
		break;
	    case JUST_BOT:
		fputs(" bottom", fp);
		break;
	    case JUST_CENTRE:
		fputs(" center", fp);
		break;
	}
    }
    fprintf(fp, " %s %s %sreverse %senhanced %s ",
		key->stack_dir == GPKEY_VERTICAL ? "vertical" : "horizontal",
		key->just == GPKEY_LEFT ? "Left" : "Right",
		key->reverse ? "" : "no",
		key->enhanced ? "" : "no",
		key->auto_titles == COLUMNHEAD_KEYTITLES ? "autotitles columnhead"
		: key->auto_titles == FILENAME_KEYTITLES ? "autotitles"
		: "noautotitles" );
    if (key->box.l_type > LT_NODRAW) {
	fputs("box", fp);
	save_linetype(fp, &(key->box), FALSE);
    } else
	fputs("nobox", fp);

    /* Put less common options on separate lines */
    fprintf(fp, "\nset key %sinvert samplen %g spacing %g width %g height %g ",
		key->invert ? "" : "no",
		key->swidth, key->vert_factor, key->width_fix, key->height_fix);
    fprintf(fp, "\nset key maxcolumns %d maxrows %d",key->maxcols,key->maxrows);
    fputc('\n', fp);
    fprintf(fp, "set key %sopaque\n", key->front ? "" : "no");

    if (!(key->visible))
	fputs("unset key\n", fp);

    fputs("unset label\n", fp);
    for (this_label = first_label; this_label != NULL;
	 this_label = this_label->next) {
	fprintf(fp, "set label %d \"%s\" at ",
		this_label->tag,
		conv_text(this_label->text));
	save_position(fp, &this_label->place, FALSE);

	switch (this_label->pos) {
	case LEFT:
	    fputs(" left", fp);
	    break;
	case CENTRE:
	    fputs(" centre", fp);
	    break;
	case RIGHT:
	    fputs(" right", fp);
	    break;
	}
	if (this_label->rotate)
	    fprintf(fp, " rotate by %d", this_label->rotate);
	else
	    fprintf(fp, " norotate");
	if (this_label->font != NULL)
	    fprintf(fp, " font \"%s\"", this_label->font);
	fprintf(fp, " %s", (this_label->layer==0) ? "back" : "front");
	if (this_label->noenhanced)
	    fprintf(fp, " noenhanced");
	save_textcolor(fp, &(this_label->textcolor));
	if (this_label->lp_properties.pointflag == 0)
	    fprintf(fp, " nopoint");
	else {
	    fprintf(fp, " point");
	    save_linetype(fp, &(this_label->lp_properties), TRUE);
	}
	save_position(fp, &this_label->offset, TRUE);
	fputc('\n', fp);
    }
    fputs("unset arrow\n", fp);
    for (this_arrow = first_arrow; this_arrow != NULL;
	 this_arrow = this_arrow->next) {
	fprintf(fp, "set arrow %d from ", this_arrow->tag);
	save_position(fp, &this_arrow->start, FALSE);
	fputs(this_arrow->relative ? " rto " : " to ", fp);
	save_position(fp, &this_arrow->end, FALSE);
	fprintf(fp, " %s %s %s",
		arrow_head_names[this_arrow->arrow_properties.head],
		(this_arrow->arrow_properties.layer==0) ? "back" : "front",
		( (this_arrow->arrow_properties.head_filled==2) ? "filled" :
		  ( (this_arrow->arrow_properties.head_filled==1) ? "empty" :
		    "nofilled" )) );
	save_linetype(fp, &(this_arrow->arrow_properties.lp_properties), FALSE);
	if (this_arrow->arrow_properties.head_length > 0) {
	    static char *msg[] = {"first", "second", "graph", "screen",
				  "character"};
	    fprintf(fp, " size %s %.3f,%.3f,%.3f",
		    msg[this_arrow->arrow_properties.head_lengthunit],
		    this_arrow->arrow_properties.head_length,
		    this_arrow->arrow_properties.head_angle,
		    this_arrow->arrow_properties.head_backangle);
	}
	fprintf(fp, "\n");
    }
    fprintf(fp, "set style increment %s\n", prefer_line_styles ? "userstyles" : "default");
    fputs("unset style line\n", fp);
    for (this_linestyle = first_linestyle; this_linestyle != NULL;
	 this_linestyle = this_linestyle->next) {
	fprintf(fp, "set style line %d ", this_linestyle->tag);
	save_linetype(fp, &(this_linestyle->lp_properties), TRUE);
	fprintf(fp, "\n");
    }
    fputs("unset style arrow\n", fp);
    for (this_arrowstyle = first_arrowstyle; this_arrowstyle != NULL;
	 this_arrowstyle = this_arrowstyle->next) {
	fprintf(fp, "set style arrow %d", this_arrowstyle->tag);
	fprintf(fp, " %s %s %s",
		arrow_head_names[this_arrowstyle->arrow_properties.head],
		(this_arrowstyle->arrow_properties.layer==0)?"back":"front",
		( (this_arrowstyle->arrow_properties.head_filled==2)?"filled":
		  ( (this_arrowstyle->arrow_properties.head_filled==1)?"empty":
		    "nofilled" )) );
	save_linetype(fp, &(this_arrowstyle->arrow_properties.lp_properties), FALSE);
	if (this_arrowstyle->arrow_properties.head_length > 0) {
	    static char *msg[] = {"first", "second", "graph", "screen",
				  "character"};
	    fprintf(fp, " size %s %.3f,%.3f,%.3f",
		    msg[this_arrowstyle->arrow_properties.head_lengthunit],
		    this_arrowstyle->arrow_properties.head_length,
		    this_arrowstyle->arrow_properties.head_angle,
		    this_arrowstyle->arrow_properties.head_backangle);
	}
	fprintf(fp, "\n");
    }

    fprintf(fp, "set style histogram ");
    switch (histogram_opts.type) {
	default:
	case HT_CLUSTERED:
	    fprintf(fp,"clustered gap %d ",histogram_opts.gap); break;
	case HT_ERRORBARS:
	    fprintf(fp,"errorbars gap %d lw %g",histogram_opts.gap,histogram_opts.bar_lw); break;
	case HT_STACKED_IN_LAYERS:
	    fprintf(fp,"rowstacked "); break;
	case HT_STACKED_IN_TOWERS:
	    fprintf(fp,"columnstacked "); break;
    }
    fprintf(fp,"title ");
    save_position(fp, &histogram_opts.title.offset, TRUE);
    fprintf(fp, "\n");

#ifdef EAM_OBJECTS
    save_object(fp, 0);
#endif

    fputs("unset logscale\n", fp);
#define SAVE_LOG(axis)							\
    if (axis_array[axis].log)						\
	fprintf(fp, "set logscale %s %g\n", axis_defaults[axis].name,	\
		axis_array[axis].base);
    SAVE_LOG(FIRST_X_AXIS );
    SAVE_LOG(FIRST_Y_AXIS );
    SAVE_LOG(SECOND_X_AXIS);
    SAVE_LOG(SECOND_Y_AXIS);
    SAVE_LOG(FIRST_Z_AXIS );
    SAVE_LOG(COLOR_AXIS );
    SAVE_LOG(POLAR_AXIS );
#undef SAVE_LOG

    save_offsets(fp, "set offsets");

    /* FIXME */
    fprintf(fp, "\
set pointsize %g\n\
set pointintervalbox %g\n\
set encoding %s\n\
%sset polar\n\
%sset parametric\n",
	    pointsize, pointintervalbox,
	    encoding_names[encoding],
	    (polar) ? "" : "un",
	    (parametric) ? "" : "un");

    if (numeric_locale)
	fprintf(fp, "set decimalsign locale \"%s\"\n", numeric_locale);
    if (decimalsign != NULL)
	fprintf(fp, "set decimalsign '%s'\n", decimalsign);
    if (!numeric_locale && !decimalsign)
        fprintf(fp, "unset decimalsign\n");

    fputs("set view ", fp);
    if (splot_map == TRUE)
	fputs("map", fp);
    else {
	fprintf(fp, "%g, %g, %g, %g",
	    surface_rot_x, surface_rot_z, surface_scale, surface_zscale);
    }
    if (aspect_ratio_3D)
	fprintf(fp, "\nset view  %s", aspect_ratio_3D == 2 ? "equal xy" :
			aspect_ratio_3D == 3 ? "equal xyz": "");

    fprintf(fp, "\n\
set samples %d, %d\n\
set isosamples %d, %d\n\
%sset surface\n\
%sset contour",
	    samples_1, samples_2,
	    iso_samples_1, iso_samples_2,
	    (draw_surface) ? "" : "un",
	    (draw_contour) ? "" : "un");

    switch (draw_contour) {
    case CONTOUR_NONE:
	fputc('\n', fp);
	break;
    case CONTOUR_BASE:
	fputs(" base\n", fp);
	break;
    case CONTOUR_SRF:
	fputs(" surface\n", fp);
	break;
    case CONTOUR_BOTH:
	fputs(" both\n", fp);
	break;
    }
    if (label_contours)
	fprintf(fp, "set clabel '%s'\n", contour_format);
    else
	fputs("unset clabel\n", fp);

#ifdef GP_MACROS
    if (expand_macros)
	fputs("set macros\n", fp);
#endif

    fputs("set mapping ", fp);
    switch (mapping3d) {
    case MAP3D_SPHERICAL:
	fputs("spherical\n", fp);
	break;
    case MAP3D_CYLINDRICAL:
	fputs("cylindrical\n", fp);
	break;
    case MAP3D_CARTESIAN:
    default:
	fputs("cartesian\n", fp);
	break;
    }

    if (missing_val != NULL)
	fprintf(fp, "set datafile missing '%s'\n", missing_val);
    if (df_separator != '\0')
	fprintf(fp, "set datafile separator \"%c\"\n",df_separator);
    else
	fprintf(fp, "set datafile separator whitespace\n");
    if (strcmp(df_commentschars, DEFAULT_COMMENTS_CHARS))
	fprintf(fp, "set datafile commentschars '%s'\n", df_commentschars);
    if (df_fortran_constants)
	fprintf(fp, "set datafile fortran\n");
    if (df_nofpe_trap)
	fprintf(fp, "set datafile nofpe_trap\n");

    save_hidden3doptions(fp);
    fprintf(fp, "set cntrparam order %d\n", contour_order);
    fputs("set cntrparam ", fp);
    switch (contour_kind) {
    case CONTOUR_KIND_LINEAR:
	fputs("linear\n", fp);
	break;
    case CONTOUR_KIND_CUBIC_SPL:
	fputs("cubicspline\n", fp);
	break;
    case CONTOUR_KIND_BSPLINE:
	fputs("bspline\n", fp);
	break;
    }
    fputs("set cntrparam levels ", fp);
    switch (contour_levels_kind) {
    case LEVELS_AUTO:
	fprintf(fp, "auto %d\n", contour_levels);
	break;
    case LEVELS_INCREMENTAL:
	fprintf(fp, "incremental %g,%g,%g\n",
		contour_levels_list[0], contour_levels_list[1],
		contour_levels_list[0] + contour_levels_list[1] * contour_levels);
	break;
    case LEVELS_DISCRETE:
	{
	    int i;
	    fprintf(fp, "discrete %g", contour_levels_list[0]);
	    for (i = 1; i < contour_levels; i++)
		fprintf(fp, ",%g ", contour_levels_list[i]);
	    fputc('\n', fp);
	}
    }
    fprintf(fp, "\
set cntrparam points %d\n\
set size ratio %g %g,%g\n\
set origin %g,%g\n",
	    contour_pts,
	    aspect_ratio, xsize, ysize,
	    xoffset, yoffset);

    fprintf(fp, "set style data ");
    save_data_func_style(fp,"data",data_style);
    fprintf(fp, "set style function ");
    save_data_func_style(fp,"function",func_style);

    save_zeroaxis(fp, FIRST_X_AXIS);
    save_zeroaxis(fp, FIRST_Y_AXIS);
    save_zeroaxis(fp, FIRST_Z_AXIS);
    save_zeroaxis(fp, SECOND_X_AXIS);
    save_zeroaxis(fp, SECOND_Y_AXIS);

    if (xyplane.absolute)
	fprintf(fp, "set xyplane at %g\n", xyplane.z);
    else
	fprintf(fp, "set ticslevel %g\n", xyplane.z);

#define SAVE_MINI(axis)							\
    switch(axis_array[axis].minitics & TICS_MASK) {			\
    case 0:								\
	fprintf(fp, "set nom%stics\n", axis_defaults[axis].name);	\
	break;								\
    case MINI_AUTO:							\
	fprintf(fp, "set m%stics\n", axis_defaults[axis].name);		\
	break;								\
    case MINI_DEFAULT:							\
	fprintf(fp, "set m%stics default\n", axis_defaults[axis].name);	\
	break;								\
    case MINI_USER:							\
	fprintf(fp, "set m%stics %f\n", axis_defaults[axis].name,	\
		axis_array[axis].mtic_freq);				\
	break;								\
    }

    SAVE_MINI(FIRST_X_AXIS);
    SAVE_MINI(FIRST_Y_AXIS);
    SAVE_MINI(FIRST_Z_AXIS);	/* HBB 20000506: noticed mztics were not saved! */
    SAVE_MINI(SECOND_X_AXIS);
    SAVE_MINI(SECOND_Y_AXIS);
    SAVE_MINI(COLOR_AXIS);
#undef SAVE_MINI

    save_tics(fp, FIRST_X_AXIS);
    save_tics(fp, FIRST_Y_AXIS);
    save_tics(fp, FIRST_Z_AXIS);
    save_tics(fp, SECOND_X_AXIS);
    save_tics(fp, SECOND_Y_AXIS);
    save_tics(fp, COLOR_AXIS);
    save_tics(fp, POLAR_AXIS);

#define SAVE_AXISLABEL_OR_TITLE(name,suffix,lab)			 \
    {									 \
	fprintf(fp, "set %s%s \"%s\" ",					 \
		name, suffix, lab.text ? conv_text(lab.text) : "");	 \
	fprintf(fp, "\nset %s%s ", name, suffix);			 \
        save_position(fp, &(lab.offset), TRUE);				 \
	fprintf(fp, " font \"%s\"", lab.font ? conv_text(lab.font) : "");\
	save_textcolor(fp, &(lab.textcolor));				 \
	if (lab.tag == ROTATE_IN_3D_LABEL_TAG)				 \
	    fprintf(fp, " rotate parallel");				 \
	if (lab.rotate)							 \
	    fprintf(fp, " rotate by %d", lab.rotate);			 \
	else								 \
	    fprintf(fp, " norotate");					 \
	fprintf(fp, "%s\n", (lab.noenhanced) ? " noenhanced" : "");	 \
    }

    SAVE_AXISLABEL_OR_TITLE("", "title", title);

    /* FIXME */
    fprintf(fp, "set timestamp %s \n", timelabel_bottom ? "bottom" : "top");
    SAVE_AXISLABEL_OR_TITLE("", "timestamp", timelabel);

    save_range(fp, POLAR_AXIS);
    save_range(fp, T_AXIS);
    save_range(fp, U_AXIS);
    save_range(fp, V_AXIS);

#define SAVE_AXISLABEL(axis)					\
    SAVE_AXISLABEL_OR_TITLE(axis_defaults[axis].name,"label",	\
			    axis_array[axis].label)

    SAVE_AXISLABEL(FIRST_X_AXIS);
    SAVE_AXISLABEL(SECOND_X_AXIS);
    save_range(fp, FIRST_X_AXIS);
    save_range(fp, SECOND_X_AXIS);

    SAVE_AXISLABEL(FIRST_Y_AXIS);
    SAVE_AXISLABEL(SECOND_Y_AXIS);
    if (splot_map == FALSE) {
	save_range(fp, FIRST_Y_AXIS);
	save_range(fp, SECOND_Y_AXIS);
    } else { /* 'set view map' uses flipped y-axes */
	splot_map_deactivate();
	save_range(fp, FIRST_Y_AXIS);
	save_range(fp, SECOND_Y_AXIS);
	splot_map_activate();
    }

    SAVE_AXISLABEL(FIRST_Z_AXIS);
    save_range(fp, FIRST_Z_AXIS);

    SAVE_AXISLABEL(COLOR_AXIS);
    save_range(fp, COLOR_AXIS);
#undef SAVE_AXISLABEL
#undef SAVE_AXISLABEL_OR_TITLE

    fprintf(fp, "set zero %g\n", zero);

    fprintf(fp, "set lmargin %s %g\n",
	    lmargin.scalex == screen ? "at screen" : "", lmargin.x);
    fprintf(fp, "set bmargin %s %g\n",
	    bmargin.scalex == screen ? "at screen" : "", bmargin.x);
    fprintf(fp, "set rmargin %s %g\n",
	    rmargin.scalex == screen ? "at screen" : "", rmargin.x);
    fprintf(fp, "set tmargin %s %g\n",
	    tmargin.scalex == screen ? "at screen" : "", tmargin.x);

    fprintf(fp, "set locale \"%s\"\n", get_time_locale());

    fputs("set pm3d ", fp);
    fputs((PM3D_IMPLICIT == pm3d.implicit ? "implicit" : "explicit"), fp);
    fprintf(fp, " at %s\n", pm3d.where);
    fputs("set pm3d ", fp);
    switch (pm3d.direction) {
    case PM3D_SCANS_AUTOMATIC: fputs("scansautomatic\n", fp); break;
    case PM3D_SCANS_FORWARD: fputs("scansforward\n", fp); break;
    case PM3D_SCANS_BACKWARD: fputs("scansbackward\n", fp); break;
    case PM3D_DEPTH: fputs("depthorder\n", fp); break;
    }
    fprintf(fp, "set pm3d interpolate %d,%d", pm3d.interp_i, pm3d.interp_j);
    fputs(" flush ", fp);
    switch (pm3d.flush) {
    case PM3D_FLUSH_CENTER: fputs("center", fp); break;
    case PM3D_FLUSH_BEGIN: fputs("begin", fp); break;
    case PM3D_FLUSH_END: fputs("end", fp); break;
    }
    fputs((pm3d.ftriangles ? " " : " no"), fp);
    fputs("ftriangles", fp);
    if (pm3d.hidden3d_tag > 0) fprintf(fp," hidden3d %d", pm3d.hidden3d_tag);
	else fputs(pm3d.hidden3d_tag ? " hidden3d" : " nohidden3d", fp);
    fputs(" corners2color ", fp);
    switch (pm3d.which_corner_color) {
	case PM3D_WHICHCORNER_MEAN:    fputs("mean", fp); break;
	case PM3D_WHICHCORNER_GEOMEAN: fputs("geomean", fp); break;
	case PM3D_WHICHCORNER_MEDIAN:  fputs("median", fp); break;
	case PM3D_WHICHCORNER_MIN:     fputs("min", fp); break;
	case PM3D_WHICHCORNER_MAX:     fputs("max", fp); break;
	default: /* PM3D_WHICHCORNER_C1 ... _C4 */
	     fprintf(fp, "c%i", pm3d.which_corner_color - PM3D_WHICHCORNER_C1 + 1);
    }
    fputs("\n", fp);

    /*
     *  Save palette information
     */

    fprintf( fp, "set palette %s %s maxcolors %d ",
	     sm_palette.positive==SMPAL_POSITIVE ? "positive" : "negative",
	     sm_palette.ps_allcF ? "ps_allcF" : "nops_allcF",
	sm_palette.use_maxcolors);
    fprintf( fp, "gamma %g ", sm_palette.gamma );
    if (sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY) {
      fputs( "gray\n", fp );
    }
    else {
      fputs( "color model ", fp );
      switch( sm_palette.cmodel ) {
        case C_MODEL_RGB: fputs( "RGB ", fp ); break;
        case C_MODEL_HSV: fputs( "HSV ", fp ); break;
        case C_MODEL_CMY: fputs( "CMY ", fp ); break;
        case C_MODEL_YIQ: fputs( "YIQ ", fp ); break;
        case C_MODEL_XYZ: fputs( "XYZ ", fp ); break;
        default:
	  fprintf( stderr, "%s:%d ooops: Unknown color model '%c'.\n",
		   __FILE__, __LINE__, (char)(sm_palette.cmodel) );
      }
      fputs( "\nset palette ", fp );
      switch( sm_palette.colorMode ) {
      case SMPAL_COLOR_MODE_RGB:
	fprintf( fp, "rgbformulae %d, %d, %d\n", sm_palette.formulaR,
		 sm_palette.formulaG, sm_palette.formulaB );
	break;
      case SMPAL_COLOR_MODE_GRADIENT: {
	int i=0;
	fprintf( fp, "defined (" );
	for( i=0; i<sm_palette.gradient_num; ++i ) {
	  fprintf( fp, " %.4g %.4g %.4g %.4g", sm_palette.gradient[i].pos,
		   sm_palette.gradient[i].col.r, sm_palette.gradient[i].col.g,
		   sm_palette.gradient[i].col.b );
	  if (i<sm_palette.gradient_num-1)  {
	      fputs( ",", fp);
	      if (i==2 || i%4==2)  fputs( "\\\n    ", fp );
	  }
	}
	fputs( " )\n", fp );
	break;
      }
      case SMPAL_COLOR_MODE_FUNCTIONS:
	fprintf( fp, "functions %s, %s, %s\n", sm_palette.Afunc.definition,
		 sm_palette.Bfunc.definition, sm_palette.Cfunc.definition );
	break;
      case SMPAL_COLOR_MODE_CUBEHELIX:
	fprintf( fp, "cubehelix start %.2g cycles %.2g saturation %.2g\n",
		sm_palette.cubehelix_start, sm_palette.cubehelix_cycles,
		sm_palette.cubehelix_saturation);
	break;
      default:
	fprintf( stderr, "%s:%d ooops: Unknown color mode '%c'.\n",
		 __FILE__, __LINE__, (char)(sm_palette.colorMode) );
      }
    }

    /*
     *  Save colorbox info
     */
    if (color_box.where != SMCOLOR_BOX_NO)
	fprintf(fp,"set colorbox %s\n", color_box.where==SMCOLOR_BOX_DEFAULT ? "default" : "user");
    fprintf(fp, "set colorbox %sal origin ", color_box.rotation ==  'v' ? "vertic" : "horizont");
    save_position(fp, &color_box.origin, FALSE);
    fputs(" size ", fp);
    save_position(fp, &color_box.size, FALSE);
    fprintf(fp, " %s ", color_box.layer ==  LAYER_FRONT ? "front" : "back");
    if (color_box.border == 0) fputs("noborder", fp);
	else if (color_box.border_lt_tag < 0) fputs("bdefault", fp);
		 else fprintf(fp, "border %d", color_box.border_lt_tag);
    if (color_box.where == SMCOLOR_BOX_NO) fputs("\nunset colorbox\n", fp);
	else fputs("\n", fp);

    fprintf(fp, "set style boxplot %s %s %5.2f %soutliers pt %d separation %g labels %s %ssorted\n",
		boxplot_opts.plotstyle == FINANCEBARS ? "financebars" : "candles",
		boxplot_opts.limit_type == 1 ? "fraction" : "range",
		boxplot_opts.limit_value, 
		boxplot_opts.outliers ? "" : "no",
		boxplot_opts.pointtype+1,
		boxplot_opts.separation,
		(boxplot_opts.labels == BOXPLOT_FACTOR_LABELS_X)  ? "x"  :
		(boxplot_opts.labels == BOXPLOT_FACTOR_LABELS_X2) ? "x2" :
		(boxplot_opts.labels == BOXPLOT_FACTOR_LABELS_AUTO) ? "auto" :"off",
		boxplot_opts.sort_factors ? "" : "un");

    fputs("set loadpath ", fp);
    {
	char *s;
	while ((s = save_loadpath()) != NULL)
	    fprintf(fp, "\"%s\" ", s);
	fputc('\n', fp);
    }

    fputs("set fontpath ", fp);
    {
	char *s;
	while ((s = save_fontpath()) != NULL)
	    fprintf(fp, "\"%s\" ", s);
	fputc('\n', fp);
    }

    if (PS_psdir)
	fprintf(fp, "set psdir \"%s\"\n", PS_psdir);
    else
	fprintf(fp, "set psdir\n");

    fprintf(fp, "set fit");
    if (fitlogfile)
	fprintf(fp, " logfile \'%s\'", fitlogfile);
    fprintf(fp, " %serrorvariables",
	fit_errorvariables ? "" : "no");
    fprintf(fp, " %sprescale", fit_prescale ? "" : "no");
    fputc('\n', fp);

}