home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xprism.zip / xprism / src / xprism3 / run_answer.c < prev    next >
C/C++ Source or Header  |  1992-09-30  |  22KB  |  767 lines

  1.  /*
  2.   * Khoros: $Id: run_answer.c,v 1.4 1992/03/20 22:41:35 dkhoros Exp $
  3.   */
  4.  
  5. #if !defined(lint) && !defined(SABER)
  6. static char rcsid[] = "Khoros: $Id: run_answer.c,v 1.4 1992/03/20 22:41:35 dkhoros Exp $";
  7. #endif
  8.  
  9.  /*
  10.   * $Log: run_answer.c,v $
  11.  * Revision 1.4  1992/03/20  22:41:35  dkhoros
  12.  * VirtualPatch5
  13.  *
  14.   */ 
  15.  
  16. /*
  17.  *----------------------------------------------------------------------
  18.  *
  19.  * Copyright 1990, University of New Mexico.  All rights reserved.
  20.  
  21.  * Permission to copy and modify this software and its documen-
  22.  * tation only for internal use in your organization is hereby
  23.  * granted, provided that this notice is retained thereon and
  24.  * on all copies.  UNM makes no representations as too the sui-
  25.  * tability and operability of this software for any purpose.
  26.  * It is provided "as is" without express or implied warranty.
  27.  * 
  28.  * UNM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  29.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
  30.  * NESS.  IN NO EVENT SHALL UNM BE LIABLE FOR ANY SPECIAL,
  31.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY OTHER DAMAGES WHAT-
  32.  * SOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  33.  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  34.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER-
  35.  * FORMANCE OF THIS SOFTWARE.
  36.  * 
  37.  * No other rights, including for example, the right to redis-
  38.  * tribute this software and its documentation or the right to
  39.  * prepare derivative works, are granted unless specifically
  40.  * provided in a separate license agreement.
  41.  *---------------------------------------------------------------------
  42.  */
  43.  
  44. #include "unmcopyright.h"     /* Copyright 1990 by UNM */
  45. #include "xprism3.h"    
  46.  
  47.  
  48. /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  49.    >>>>                                                       <<<<
  50.    >>>>        file name: run_answer.c
  51.    >>>>              
  52.    >>>>   description: These routines drive the answerfile
  53.    >>>>             input and output
  54.    >>>>                
  55.    >>>>      routines:
  56.    >>>>            run_answer
  57.    >>>>            run_answer_file
  58.    >>>>              
  59.    >>>> modifications:
  60.    >>>>                                                       <<<<
  61.    >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
  62.  
  63.  
  64. /************************************************************
  65. *
  66. *  MODULE NAME: run_answer
  67. *
  68. *
  69. *      PURPOSE: Drives the Answer File subform --
  70. *               Called after the user clicks on an action
  71. *               button on one of the "Ans File" subform's panes.
  72. *
  73. *    INPUT:  form - pointer to the form tree
  74. *        output_info - pointer to the Answer File Pane 
  75. *                  information structure
  76. *
  77. *       OUTPUT: none
  78. *
  79. *    CALLED BY: main
  80. *
  81. *    WRITTEN BY: Tom Sauer & John M. Salas
  82. *
  83. *
  84. *************************************************************/
  85. run_answer(form, answer_info, master, xprism3_args)
  86.  
  87. xvf_form    *form;
  88. Master_answer    *answer_info;
  89. Master        *master;
  90. xprism3_struct    **xprism3_args;
  91.  
  92. {
  93.      /*
  94.       * get the form information structure indicating
  95.       * selections & and input provided by the user
  96.       */
  97.     _xvf_get_answer(form, answer_info);
  98.                 
  99.     run_answer_file(form, answer_info->ans_file, master, xprism3_args);
  100.  
  101. }  /* end run_answer */
  102.  
  103.  
  104.  
  105. /************************************************************
  106. *
  107. *  MODULE NAME: run_answer_file
  108. *
  109. *
  110. *      PURPOSE: Drives the Files pane of the Answer File subform --
  111. *               Called after the user clicks on "OUTPUT ANSWER FILE",
  112. *        "INPUT ANSWER FILE",
  113. *        creates the specified output file under the filename given,
  114. *        reads in a specified answer file.
  115. *
  116. *    INPUT:  form - pointer to the form tree
  117. *        output_info - pointer to the Output Pane information structure
  118. *
  119. *       OUTPUT: none
  120. *
  121. *    CALLED BY: main
  122. *
  123. *    WRITTEN BY: Tom Sauer & John M. Salas
  124. *
  125. *
  126. *************************************************************/
  127.  
  128. run_answer_file(form, file_info, master, xprism3_args)
  129.  
  130. xvf_form *form;
  131. answer_ans_file *file_info;
  132. Master *master;
  133. xprism3_struct **xprism3_args;
  134.  
  135. {
  136.     FILE *fp, *fopen();
  137.     char     temp[512], *filestring, *filename, *vfullpath(), *mesg;
  138.     int    fd_ansr, mono_display;
  139.     XObject    *tmp_list;
  140.     xprism3_struct *args;
  141.  
  142.     _xvf_get_ans_file(form, file_info);
  143.  
  144.     if (file_info->quit)
  145.         xvf_change_active(form, false);
  146.  
  147.     if (file_info->out_answer_file_selected)
  148.     {
  149.        if (gwin == NULL)
  150.            {
  151.                 mesg =
  152.     xvf_strcpy("Cannot output anything-- no graphics workspace present!\n");
  153.                 xvf_error_wait(mesg, "run_answer_file", NULL);
  154.                 free(mesg);
  155.                 return;
  156.            }
  157.  
  158.        if (file_info->out_answer_file == NULL)
  159.        {
  160.         mesg = xvf_strcpy("\nPlease specify the name of the Answer \
  161. file on the 'Filename' parameter for Output Answer File\n");
  162.                 xvf_error_wait(mesg, "run_answer_file", NULL);
  163.                 free(mesg);
  164.                 return;
  165.            }
  166.        filestring = vfullpath(file_info->out_answer_file, 
  167.                                   global_outdir, NULL);
  168.     
  169.        if ((fp = fopen(filestring,"w+")) == NULL)
  170.        {  
  171.         (void) sprintf(temp, "%s: Can not open answer file %s\n",
  172.                   program, filestring);
  173.         xvf_error_wait(temp, "run_answer_file", NULL);
  174.        }
  175.        else
  176.        {
  177.            make_answer_file(fp, master);
  178.        }
  179.  
  180.            sprintf(temp,"The answer file '%s' has been created.\n", filestring);
  181.            xvf_error_wait(temp, "run_answer_file", NULL);
  182.  
  183.        free(filestring);
  184.     }
  185.     else if (file_info->in_answer_file_selected)
  186.     {
  187.        if (file_info->in_answer_file == NULL)
  188.        {
  189.             mesg = xvf_strcpy("\nPlease specify the name of the Answer \
  190. file on the 'Filename' parameter for Input Answer File\n");
  191.          xvf_error_wait(mesg, "run_answer_files", NULL);
  192.          free(mesg);
  193.          return;
  194.        }
  195.  
  196.        filestring = vfullpath(file_info->in_answer_file, 
  197.                                       global_indir, NULL);
  198.  
  199.        if ((fd_ansr = open(filestring, O_RDONLY, 0666)) == -1)
  200.        {       /* an error trying to open answer file */
  201.         (void) sprintf(temp, "%s: Can not open answer file %s\n",
  202.                   program, filestring);
  203.         xvf_error_wait(temp, "run_answer_file", NULL);
  204.        }
  205.        else
  206.        {
  207. /*
  208.    Major kludge to be able to load multiple answer files.
  209. */
  210.         init_afile_args(fd_ansr);
  211.  
  212.         if (*xprism3_args != NULL)
  213.         {
  214.             free(*xprism3_args);
  215.         }
  216.  
  217.         args = (xprism3_struct *) calloc((unsigned) 1,
  218.                           (unsigned)sizeof(xprism3_struct));
  219.  
  220.         if (gwin != NULL)
  221.         {
  222.             freegwin();
  223.         }
  224.  
  225.         init_xprism3(FALSE, fd_ansr, args);
  226.  
  227.         set_gwin_attr_3D(args);
  228.  
  229.         if ( args->plots_specified )
  230.         {
  231.             start_cmd_plot_3D(args);
  232.             update_tics(form, master->options->tics);
  233.         }
  234.  
  235.         if (gwin != NULL)
  236.         {
  237.             if (args->annotation_in_file != NULL)
  238.             {
  239.             filename = vfullpath(args->annotation_in_file,
  240.                          global_indir, NULL);
  241.             if (tmp_list = read_overlays(canvas, filename))
  242.                 obj_list = tmp_list;
  243.  
  244.             free(filename);
  245.             }
  246.         }
  247.  
  248. /*
  249.  *  if on monochrome display, begin with a default of linemarker
  250.  */
  251.  
  252.         if ( XDisplayPlanes(display, screen) > 1)
  253.             mono_display = false;
  254.         else
  255.             mono_display = true;
  256.  
  257.         if (mono_display == true)
  258.         {
  259.                    /* turn off "Colors" pane */
  260.                    xvf_change_input(form,
  261.                               master->options->colors_gb_index,
  262.                               xvf_activation_chng, "0", 0);
  263.         }
  264.  
  265.         close_afile(fd_ansr);
  266.  
  267.         *xprism3_args = args;
  268.  
  269.        }
  270.        plot_routine();
  271.     }
  272.  
  273.     free(filestring);
  274. }
  275.  
  276. /************************************************************
  277. *
  278. *  MODULE NAME: make_answer_file
  279. *
  280. *
  281. *      PURPOSE: This routine will create an answer file for xprism3.
  282. *
  283. *    INPUT: FILE *fp;
  284. *           Master *master;
  285. *
  286. *       OUTPUT: none
  287. *
  288. *    CALLED BY: main
  289. *
  290. *    WRITTEN BY: Tom Sauer & John M. Salas
  291. *
  292. *
  293. *************************************************************/
  294. make_answer_file(fp, master)
  295.  
  296. FILE *fp;
  297. Master *master;
  298.  
  299. {
  300.  
  301.   XPlot    *plotptr;
  302.   char     *title, *xaxis, *yaxis, *zaxis;
  303.   int      axes, grid, auto_scale, legend, box, rescale_relabel, fonts[6],
  304.        colors[12], numlabels, machtype, clear_labels, rows;
  305.   Coord    scale, minor_tics, disp_label_min, disp_label_max, disp_label_intv,
  306.        disp_scale_min, disp_scale_max, disp_scale_intv;
  307.  
  308.   int active, plot_type, data_type, data_format;
  309.   char *filename, *function, *xrange, *yrange, *legend_str, *func_xmin,
  310.        *func_xmax, *func_xptnum, *ptr1, *ptr2, *ptr3, func[MaxLength],
  311.        *func_ymin, *func_ymax, *func_yptnum, dummy[MaxLength];
  312.   int  marker_type, line_type, plot_color, 
  313.     xbegin_point, xend_point, xstep_size,
  314.     ybegin_point, yend_point, ystep_size;
  315.   int  band, cmplx, input_type;
  316.  
  317.   int number_areas, number_plots, plot_area, plot_number;
  318.  
  319.   float alpha, theta, eyedist, viewdist;
  320.  
  321. /*
  322.    PLOT SUBFORM ENVIRONMENT PANE
  323. */
  324.   if ( master->xprism->environment->input_path != NULL )
  325.   {
  326.     fprintf(fp,"-indir %s\n", master->xprism->environment->input_path);
  327.   }
  328.  
  329.   if ( master->xprism->environment->output_path != NULL )
  330.   {
  331.     fprintf(fp,"-outdir %s\n", master->xprism->environment->output_path);
  332.   }
  333.  
  334. /*
  335.    ANNOTATION SUBFORM FILE PANE
  336. */
  337.   if ( master->xvoverlay->ovfile->ov_input != NULL )
  338.   {
  339.     fprintf(fp,"-anin %s\n", master->xvoverlay->ovfile->ov_input);
  340.   }
  341.  
  342.   if ( master->xvoverlay->ovfile->ov_output != NULL )
  343.   {
  344.     fprintf(fp,"-anout %s\n", master->xvoverlay->ovfile->ov_output);
  345.   }
  346.  
  347. /*
  348.    OUTPUT SUBFORM FILES PANE
  349. */
  350.  
  351.   if ( master->output->file->expl_filename != NULL )
  352.   {
  353.     fprintf(fp,"-expifile %s\n", master->output->file->expl_filename);
  354.   }
  355.  
  356.   if ( master->output->file->impl_filename != NULL )
  357.   {
  358.     fprintf(fp,"-impifile %s\n", master->output->file->impl_filename);
  359.   }
  360.  
  361.   if ( master->output->file->cm_filename != NULL )
  362.   {
  363.     fprintf(fp,"-cmifile %s\n", master->output->file->cm_filename);
  364.   }
  365.  
  366.   if ( master->output->file->dump_filename != NULL )
  367.   {
  368.     fprintf(fp,"-sdumpfile %s\n", master->output->file->dump_filename);
  369.   }
  370.  
  371. /*
  372.    OUTPUT SUBFORM POSTSCRIPT PANE
  373. */
  374.  
  375.   if ( master->output->postscr->printer != NULL )
  376.   {
  377.     fprintf(fp,"-pslp %s\n", master->output->postscr->printer);
  378.   }
  379.  
  380.   if ( master->output->postscr->filename != NULL )
  381.   {
  382.     fprintf(fp,"-psfile %s\n", master->output->postscr->filename);
  383.   }
  384.  
  385.   fprintf(fp,"-psflush %d\n", master->output->postscr->flush);
  386.  
  387.   fprintf(fp,"-psinvert %d\n", master->output->postscr->invert);
  388.  
  389.   fprintf(fp,"-pslandscape %d\n", master->output->postscr->landscape);
  390.  
  391.   fprintf(fp,"-psmono %d\n", master->output->postscr->mono);
  392.  
  393.   fprintf(fp,"-psw %g\n", master->output->postscr->width);
  394.  
  395.   fprintf(fp,"-psh %g\n", master->output->postscr->height);
  396.  
  397.   fprintf(fp,"-psx %g\n", master->output->postscr->x_offset);
  398.  
  399.   fprintf(fp,"-psy %g\n", master->output->postscr->y_offset);
  400.  
  401.   fprintf(fp,"-psotype %d\n", master->output->postscr->output_type_val);
  402.  
  403. /*
  404.    OUTPUT SUBFORM IMAGEN PANE
  405. */
  406.  
  407.   if ( master->output->imagen->printer != NULL )
  408.   {
  409.     fprintf(fp,"-imlp %s\n", master->output->imagen->printer);
  410.   }
  411.  
  412.   if ( master->output->imagen->filename != NULL )
  413.   {
  414.     fprintf(fp,"-imfile %s\n", master->output->imagen->filename);
  415.   }
  416.  
  417.   fprintf(fp,"-imflush %d\n", master->output->imagen->flush);
  418.  
  419.   fprintf(fp,"-iminvert %d\n", master->output->imagen->invert);
  420.  
  421.   fprintf(fp,"-imw %g\n", master->output->imagen->width);
  422.  
  423.   fprintf(fp,"-imh %g\n", master->output->imagen->height);
  424.  
  425.   fprintf(fp,"-imx %g\n", master->output->imagen->x_offset);
  426.  
  427.   fprintf(fp,"-imy %g\n", master->output->imagen->y_offset);
  428.  
  429.   fprintf(fp,"-imotype %d\n", master->output->imagen->output_type_val);
  430.  
  431. /*
  432.    OUTPUT SUBFORM HPGL PANE
  433. */
  434.  
  435.   if ( master->output->hpgl->printer != NULL )
  436.   {
  437.     fprintf(fp,"-hpgllp %s\n", master->output->hpgl->printer);
  438.   }
  439.  
  440.   if ( master->output->hpgl->filename != NULL )
  441.   {
  442.     fprintf(fp,"-hpglfile %s\n", master->output->hpgl->filename);
  443.   }
  444.  
  445.   fprintf(fp,"-hpglflush %d\n", master->output->hpgl->flush);
  446.  
  447.   fprintf(fp,"-hpgllandscape %d\n", master->output->hpgl->landscape);
  448.  
  449.   fprintf(fp,"-hpglw %g\n", master->output->hpgl->width);
  450.  
  451.   fprintf(fp,"-hpglh %g\n", master->output->hpgl->height);
  452.  
  453.   fprintf(fp,"-hpglx %g\n", master->output->hpgl->x_offset);
  454.  
  455.   fprintf(fp,"-hpgly %g\n", master->output->hpgl->y_offset);
  456.  
  457. /*
  458.    OUTPUT SUBFORM LN03 PANE
  459. */
  460.  
  461.   if ( master->output->ln03->printer != NULL )
  462.   {
  463.     fprintf(fp,"-ln03lp %s\n", master->output->ln03->printer);
  464.   }
  465.  
  466.   if ( master->output->ln03->filename != NULL )
  467.   {
  468.     fprintf(fp,"-ln03file %s\n", master->output->ln03->filename);
  469.   }
  470.  
  471.   fprintf(fp,"-ln03invert %d\n", master->output->ln03->invert);
  472.  
  473.   /* kludge to put update file time in the answer file */
  474.   fprintf(fp,"-update %g\n", gwin_attr->update);
  475.  
  476. /*
  477.    Until the rain stop failing on the earth below and the galaxies stop
  478.    moving through teh universe, this is the kludge for multiple areas.
  479. */
  480.   number_areas = 1;
  481.  
  482.   for ( plot_area = 1 ; plot_area <= number_areas ; plot_area++ )
  483.   {
  484.  
  485.     inquire_gwin_attr(plot_area, &title, &xaxis, &yaxis, &zaxis, fonts, 
  486.              colors, &clear_labels, &grid, &box, &legend, 
  487.              &axes, &numlabels, &auto_scale, &rescale_relabel, 
  488.              &scale, &minor_tics, &disp_label_min, &disp_label_max, 
  489.              &disp_label_intv, &disp_scale_min, &disp_scale_max, 
  490.              &disp_scale_intv, &alpha, &theta, &eyedist, &viewdist);
  491.  
  492.     /* fonts */
  493.  
  494.     fprintf(fp,"-tf%d %d\n", plot_area, fonts[TITLE]);
  495.     fprintf(fp,"-xalf%d %d\n", plot_area, fonts[XAXIS]);
  496.     fprintf(fp,"-yalf%d %d\n", plot_area, fonts[YAXIS]);
  497.     fprintf(fp,"-zalf%d %d\n", plot_area, fonts[ZAXIS]);
  498.     fprintf(fp,"-lf%d %d\n", plot_area, fonts[LEGEND]);
  499.     fprintf(fp,"-numf%d %d\n", plot_area, fonts[NUMBERS]);
  500.  
  501.     /* labels */
  502.  
  503.     if ( title != NULL )
  504.     {
  505.       fprintf(fp,"-title%d %s\n", plot_area, title);
  506.       free(title);
  507.       title = NULL;
  508.     }
  509.  
  510.     if ( xaxis != NULL )
  511.     {
  512.       fprintf(fp,"-xaxis%d %s\n", plot_area, xaxis);
  513.       free(xaxis);
  514.       xaxis = NULL;
  515.     }
  516.  
  517.     if ( yaxis != NULL )
  518.     {
  519.       fprintf(fp,"-yaxis%d %s\n", plot_area, yaxis);
  520.       free(yaxis);
  521.       yaxis = NULL;
  522.     }
  523.  
  524.     if ( zaxis != NULL )
  525.     {
  526.       fprintf(fp,"-zaxis%d %s\n", plot_area, zaxis);
  527.       free(zaxis);
  528.       zaxis = NULL;
  529.     }
  530.  
  531.  
  532.     /* colors for labels, axes, grid, etc */
  533.  
  534.     fprintf(fp,"-tc%d %d\n", plot_area, colors[TITLE_COLOR]);
  535.     fprintf(fp,"-xalc%d %d\n", plot_area, colors[XTITLE_COLOR]);
  536.     fprintf(fp,"-yalc%d %d\n", plot_area, colors[YTITLE_COLOR]);
  537.     fprintf(fp,"-zalc%d %d\n", plot_area, colors[ZTITLE_COLOR]);
  538.     fprintf(fp,"-xac%d %d\n", plot_area, colors[XAXIS_COLOR]);
  539.     fprintf(fp,"-yac%d %d\n", plot_area, colors[YAXIS_COLOR]);
  540.     fprintf(fp,"-zac%d %d\n", plot_area, colors[ZAXIS_COLOR]);
  541.     fprintf(fp,"-nxac%d %d\n", plot_area, colors[XNUMS_COLOR]);
  542.     fprintf(fp,"-nyac%d %d\n", plot_area, colors[YNUMS_COLOR]);
  543.     fprintf(fp,"-nzac%d %d\n", plot_area, colors[ZNUMS_COLOR]);
  544.     fprintf(fp,"-gc%d %d\n", plot_area, colors[GRID_COLOR]);
  545.     fprintf(fp,"-lc%d %d\n", plot_area, colors[LEGEND_COLOR]);
  546.  
  547.     fprintf(fp,"-box%d %d\n", plot_area, box);
  548.  
  549.     fprintf(fp,"-numlabels%d %d\n", plot_area, numlabels);
  550.  
  551.     fprintf(fp,"-rsrl%d %d\n", plot_area, rescale_relabel);
  552.  
  553.     fprintf(fp,"-clrls%d %d\n", plot_area, clear_labels);
  554.  
  555.     fprintf(fp,"-axes%d %d\n", plot_area, axes);
  556.  
  557.     fprintf(fp,"-legend%d %d\n", plot_area, legend);
  558.  
  559.     fprintf(fp,"-grid%d %d\n", plot_area, grid);
  560.  
  561.     fprintf(fp,"-autoscale%d %d\n", plot_area, auto_scale);
  562.  
  563. /* all axes scale code is commented out until it can be reworked
  564.     fprintf(fp,"-xscale%d %d\n", plot_area, scale.x);
  565.     fprintf(fp,"-yscale%d %d\n", plot_area, scale.y);
  566.     fprintf(fp,"-zscale%d %d\n", plot_area, scale.z);
  567. */
  568.  
  569.     fprintf(fp,"-xtics%d %g\n", plot_area, minor_tics.x);
  570.     fprintf(fp,"-ytics%d %g\n", plot_area, minor_tics.y);
  571.     fprintf(fp,"-ztics%d %g\n", plot_area, minor_tics.z);
  572.  
  573.     fprintf(fp,"-xlmin%d %g\n", plot_area, disp_label_min.x);
  574.     fprintf(fp,"-ylmin%d %g\n", plot_area, disp_label_min.y);
  575.     fprintf(fp,"-zlmin%d %g\n", plot_area, disp_label_min.z);
  576.  
  577.     fprintf(fp,"-xlmax%d %g\n", plot_area, disp_label_max.x);
  578.     fprintf(fp,"-ylmax%d %g\n", plot_area, disp_label_max.y);
  579.     fprintf(fp,"-zlmax%d %g\n", plot_area, disp_label_max.z);
  580.  
  581.     fprintf(fp,"-xlint%d %g\n", plot_area, disp_label_intv.x);
  582.     fprintf(fp,"-ylint%d %g\n", plot_area, disp_label_intv.y);
  583.     fprintf(fp,"-zlint%d %g\n", plot_area, disp_label_intv.z);
  584.  
  585.     fprintf(fp,"-xsmin%d %g\n", plot_area, disp_scale_min.x);
  586.     fprintf(fp,"-ysmin%d %g\n", plot_area, disp_scale_min.y);
  587.     fprintf(fp,"-zsmin%d %g\n", plot_area, disp_scale_min.z);
  588.  
  589.     fprintf(fp,"-xsmax%d %g\n", plot_area, disp_scale_max.x);
  590.     fprintf(fp,"-ysmax%d %g\n", plot_area, disp_scale_max.y);
  591.     fprintf(fp,"-zsmax%d %g\n", plot_area, disp_scale_max.z);
  592.  
  593.     fprintf(fp,"-xsint%d %g\n", plot_area, disp_scale_intv.x);
  594.     fprintf(fp,"-ysint%d %g\n", plot_area, disp_scale_intv.y);
  595.     fprintf(fp,"-zsint%d %g\n", plot_area, disp_scale_intv.z);
  596.  
  597.     fprintf(fp,"-alpha%d %g\n", plot_area, alpha);
  598.     fprintf(fp,"-theta%d %g\n", plot_area, theta);
  599.     fprintf(fp,"-eyedist%d %g\n", plot_area, eyedist);
  600.     fprintf(fp,"-viewdist%d %g\n", plot_area, viewdist);
  601.     
  602.  
  603.     inquire_gwin_plots(plot_area, &number_plots);
  604.  
  605.      /*
  606.       * Hard code the number of plots to be 0. In init_xprism2()
  607.       * if the number of plots is zero and we are using an answer file
  608.       * then other plots on the command line and in Cantata can be
  609.       * specified. init_xprism2() was changed for the special
  610.       * case of when the -np1 option is set to 0. This fixes one
  611.       * bug and creates who know how many more!!!
  612.       */
  613.  
  614. /*
  615.     fprintf(fp,"-np%d %d\n", plot_area, number_plots);
  616. */
  617.  
  618.  
  619.     fprintf(fp,"-np%d %d\n", plot_area, 0);
  620.  
  621.     /* note: fix by Danielle => previous code
  622.        made false assumption that plots were numbered incrementally */
  623.     plot_number = 1;
  624.     plotptr = gwin->plist;
  625.     while (plotptr != NULL)
  626.     {
  627.       inquire_plot_3D(plotptr->id, plot_area, &active, &plot_type, &data_type,
  628.               &data_format, &filename, &function, &xrange, &yrange,
  629.               &legend_str, &marker_type, &line_type, &plot_color, 
  630.               &rows, &xbegin_point, &xend_point, &xstep_size, 
  631.               &ybegin_point, ¥d_point, &ystep_size, &machtype,
  632.               &band, &cmplx, &input_type);
  633.  
  634.       if ( filename != NULL )
  635.       {
  636.         fprintf(fp,"-i%d%d %s\n", plot_area, plot_number, filename);
  637.     free(filename);
  638.     filename = NULL;
  639.  
  640.         if ( data_type == VFF_TYP_FLOAT )
  641.         {
  642.           fprintf(fp,"-dt%d%d %d\n", plot_area, plot_number, MAX_DATA_TYPE);
  643.         }
  644.         else if ( data_type ==  VFF_TYP_4_BYTE )
  645.         {
  646.         fprintf(fp,"-dt%d%d %d\n", plot_area, plot_number, (MAX_DATA_TYPE - 1));
  647.         }
  648.         else
  649.         {
  650.           fprintf(fp,"-dt%d%d %d\n", plot_area, plot_number, data_type);
  651.         }
  652.  
  653.         if ( data_format != NO_FORMAT )
  654.         {
  655.           if ( data_format == Z_ONLY )
  656.           {
  657.             fprintf(fp,"-df%d%d %d\n", plot_area, plot_number, MAX_DATA_FORMAT);
  658.           }
  659.           else
  660.           {
  661.             fprintf(fp,"-df%d%d %d\n", plot_area, plot_number, MAX_DATA_FORMAT-1);
  662.           }
  663.         }
  664.         if (input_type == XVIFF_IMPL || input_type == XVIFF_EXP)
  665.         {
  666.            if (band != -1)
  667.                 fprintf(fp,"-band%d%d %d\n", plot_area, plot_number, band);
  668.            if (cmplx > 0)
  669.                 fprintf(fp,"-cmplx%d%d %d\n", plot_area, plot_number, cmplx);
  670.         }
  671.       }
  672.  
  673.       if ( function != NULL )
  674.       {
  675.     sscanf(function, " %[^=]%*[ =\t\n]%[^\n]", dummy, func);
  676.         fprintf(fp,"-func%d%d %s\n", plot_area, plot_number, func);
  677.     free(function);
  678.     function = NULL;
  679.  
  680.     if ( xrange != NULL )
  681.     {
  682.       func_xmin = strchr(xrange,'(');
  683.       func_xmin++;
  684.       ptr1 = strchr(func_xmin,',');
  685.  
  686.       func_xmax = strchr(xrange,',');
  687.       func_xmax++;
  688.       ptr2 = strchr(func_xmax,',');
  689.  
  690.       func_xptnum = strrchr(xrange,',');
  691.       func_xptnum++;
  692.       ptr3 = strchr(func_xptnum,')');
  693.  
  694.       *ptr1 = '\0';
  695.       *ptr2 = '\0';
  696.       *ptr3 = '\0';
  697.  
  698.           fprintf(fp,"-fxmin%d%d %s\n", plot_area, plot_number, func_xmin);
  699.           fprintf(fp,"-fxmax%d%d %s\n", plot_area, plot_number, func_xmax);
  700.           fprintf(fp,"-fxpts%d%d %s\n", plot_area, plot_number, func_xptnum);
  701.     }
  702.     free(xrange);
  703.     xrange = NULL;
  704.     if ( yrange != NULL )
  705.     {
  706.       func_ymin = strchr(yrange,'(');
  707.       func_ymin++;
  708.       ptr1 = strchr(func_ymin,',');
  709.  
  710.       func_ymax = strchr(yrange,',');
  711.       func_ymax++;
  712.       ptr2 = strchr(func_ymax,',');
  713.  
  714.       func_yptnum = strrchr(yrange,',');
  715.       func_yptnum++;
  716.       ptr3 = strchr(func_yptnum,')');
  717.  
  718.       *ptr1 = '\0';
  719.       *ptr2 = '\0';
  720.       *ptr3 = '\0';
  721.  
  722.           fprintf(fp,"-fymin%d%d %s\n", plot_area, plot_number, func_ymin);
  723.           fprintf(fp,"-fymax%d%d %s\n", plot_area, plot_number, func_ymax);
  724.           fprintf(fp,"-fypts%d%d %s\n", plot_area, plot_number, func_yptnum);
  725.     }
  726.     free(yrange);
  727.     yrange = NULL;
  728.       }
  729.  
  730.       fprintf(fp,"-xb%d%d %d\n", plot_area, plot_number, xbegin_point);
  731.       fprintf(fp,"-xe%d%d %d\n", plot_area, plot_number, xend_point);
  732.       fprintf(fp,"-xs%d%d %d\n", plot_area, plot_number, xstep_size);
  733.       fprintf(fp,"-yb%d%d %d\n", plot_area, plot_number, ybegin_point);
  734.       fprintf(fp,"-ye%d%d %d\n", plot_area, plot_number, yend_point);
  735.       fprintf(fp,"-ys%d%d %d\n", plot_area, plot_number, ystep_size);
  736.  
  737.       fprintf(fp,"-pt%d%d %d\n", plot_area, plot_number, plot_type - 1);
  738.  
  739.       if ( machtype != -1)
  740.       {
  741.     fprintf(fp,"-mach%d%d %d\n", plot_area, plot_number, machtype);
  742.       }
  743.  
  744.       fprintf(fp,"-mt%d%d %d\n", plot_area, plot_number, marker_type);
  745.       fprintf(fp,"-lt%d%d %d\n", plot_area, plot_number, line_type);
  746.       fprintf(fp,"-pc%d%d %d\n", plot_area, plot_number, plot_color);
  747.       fprintf(fp,"-rows%d%d %d\n", plot_area, plot_number, rows);
  748.  
  749.       if ( legend_str != NULL )
  750.       {
  751.       fprintf(fp,"-legendstr%d%d %s\n", plot_area, plot_number, legend_str);
  752.     free(legend_str);
  753.     legend_str = NULL;
  754.       }
  755.  
  756. /* SET THE ROWS */
  757.  
  758.  
  759.       fprintf(fp,"-active%d%d %d\n", plot_area, plot_number, active);
  760.       plotptr = plotptr->next;
  761.       plot_number++;
  762.     }
  763.   }
  764.   fclose(fp);
  765. }
  766.  
  767.