Example #1
0
/* plot parsed expression and write it to postscript file */
void write_ps(FILE * out, parsed_expr parsed, char *expr, Limits * lim)
{
    plot_init(parsed.length, lim);

    write_header(out, expr);
    plot(out, parsed);
    write_box(out);
    write_footer(out);

    free(stack);
}
Example #2
0
void
mexFunction(int nlhs, mxArray *plhs[],
            int nrhs, const mxArray *prhs[])
{
   FILE *fob;
   mxArray *internal;
   element_t *pe;
   double *pd;
   int compound;
   double uu_to_dbu;

   /* check argument number */
   if (nrhs != 4) {
      mexErrMsgTxt("gds_write_element :  4 input arguments expected.");
   }
   
   /* get file handle argument */
   fob = get_file_ptr((mxArray *)prhs[0]);

   /* get unit conversion factor user units --> database units */
   pd = (double *)mxGetData(prhs[2]);
   uu_to_dbu = pd[0];

   /* decide what to do */
   if ( !get_field_ptr((mxArray *)prhs[1], "internal", &internal) )
      mexErrMsgTxt("gds_write_element :  missing internal data field.");
   pe = (element_t *)mxGetData(internal);

   switch (pe->kind) {
     
      case GDS_BOUNDARY:
	 pd = (double *)mxGetData(prhs[3]); /* compound */
	 compound = (int)pd[0];
	 if ( compound )
	    write_compound_boundary(fob, (mxArray *)prhs[1], uu_to_dbu);
	 else
	    write_boundary(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_PATH:
	 pd = (double *)mxGetData(prhs[3]); /* compound */
	 compound = (int)pd[0];
	 if ( compound )
	    write_compound_path(fob, (mxArray *)prhs[1], uu_to_dbu);
	 else
	    write_path(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_SREF:
	 pd = (double *)mxGetData(prhs[3]); /* compound */
	 compound = (int)pd[0];
	 if ( compound )
	    write_compound_sref(fob, (mxArray *)prhs[1], uu_to_dbu);
	 else
	    write_sref(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_AREF:
	 write_aref(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_TEXT:
	 write_text(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_NODE:
	 write_node(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      case GDS_BOX:
	 write_box(fob, (mxArray *)prhs[1], uu_to_dbu);
	 break;

      default:
	 mexErrMsgTxt("gds_write_element :  unknown element type.");
   }
}