PLplot  5.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plplot_impl.c
Go to the documentation of this file.
1 //
2 // Copyright 2007, 2008, 2009, 2010, 2011 Hezekiah M. Carty
3 //
4 // This file is part of PLplot.
5 //
6 // PLplot is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // PLplot is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with PLplot. If not, see <http://www.gnu.org/licenses/>.
18 //
19 
20 // The "usual" OCaml includes
21 #include <caml/alloc.h>
22 #include <caml/callback.h>
23 #include <caml/fail.h>
24 #include <caml/memory.h>
25 #include <caml/misc.h>
26 #include <caml/mlvalues.h>
27 #include <caml/bigarray.h>
28 
29 #include <plplotP.h>
30 #include <plplot.h>
31 
32 #undef snprintf
33 
34 #include <stdio.h>
35 
36 #define MAX_EXCEPTION_MESSAGE_LENGTH 1000
37 #define CAML_PLPLOT_PLOTTER_FUNC_NAME "caml_plplot_plotter"
38 #define CAML_PLPLOT_MAPFORM_FUNC_NAME "caml_plplot_mapform"
39 #define CAML_PLPLOT_DEFINED_FUNC_NAME "caml_plplot_defined"
40 #define CAML_PLPLOT_LABEL_FUNC_NAME "caml_plplot_customlabel"
41 #define CAML_PLPLOT_ABORT_FUNC_NAME "caml_plplot_abort"
42 #define CAML_PLPLOT_EXIT_FUNC_NAME "caml_plplot_exit"
43 #define CAML_PLPLOT_TRANSFORM_FUNC_NAME "caml_plplot_transform"
44 
46 typedef PLINT ( *ML_DEFINED_FUNC )( PLFLT, PLFLT );
47 typedef void ( *ML_MAPFORM_FUNC )( PLINT, PLFLT*, PLFLT* );
48 typedef void ( *ML_LABEL_FUNC )( PLINT, PLFLT, char*, PLINT, PLPointer );
49 typedef PLINT ( *ML_VARIANT_FUNC )( PLINT );
50 
51 //
52 //
53 // CALLBACK WRAPPERS
54 //
55 //
56 
57 // A simple routine to wrap a properly registered OCaml callback in a form
58 // usable by PLPlot routines. If an appropriate callback is not registered
59 // then the PLPlot built-in pltr0 function is used instead.
60 void ml_plotter( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data )
61 {
62  CAMLparam0();
63  CAMLlocal1( result );
64 
65  // Get the OCaml callback function (if there is one)
66  static value * pltr = NULL;
67  if ( pltr == NULL )
68  pltr = caml_named_value( CAML_PLPLOT_PLOTTER_FUNC_NAME );
69 
70  // No check to see if a callback function has been designated yet,
71  // because that is checked before we get to this point.
72  result =
73  caml_callback2( *pltr, caml_copy_double( x ), caml_copy_double( y ) );
74  double new_x, new_y;
75  new_x = Double_val( Field( result, 0 ) );
76  new_y = Double_val( Field( result, 1 ) );
77 
78  *tx = new_x;
79  *ty = new_y;
80 
81  CAMLreturn0;
82 }
83 
84 // A simple routine to wrap a properly registered OCaml callback in a form
85 // usable by PLPlot routines. If an appropriate callback is not registered
86 // then the result is always 1 (the data point is defined).
87 // This function is used in the plshade* functions to determine if a given data
88 // point is valid/defined or not.
90 {
91  CAMLparam0();
92  CAMLlocal1( result );
93 
94  // The result which will be returned to the user.
95  PLINT is_it_defined;
96 
97  // Get the OCaml callback function (if there is one)
98  static value * defined = NULL;
99  if ( defined == NULL )
100  defined = caml_named_value( CAML_PLPLOT_DEFINED_FUNC_NAME );
101 
102  // No check to see if a callback function has been designated yet,
103  // because that is checked before we get to this point.
104  result =
105  caml_callback2( *defined, caml_copy_double( x ), caml_copy_double( y ) );
106  is_it_defined = Int_val( result );
107 
108  CAMLreturn( is_it_defined );
109 }
110 
111 // A simple routine to wrap a properly registered OCaml callback in a form
112 // usable by PLPlot routines. If an appropriate callback is not registered
113 // then nothing is done.
114 void ml_mapform( PLINT n, PLFLT *x, PLFLT *y )
115 {
116  CAMLparam0();
117  CAMLlocal1( result );
118 
119  // Get the OCaml callback function (if there is one)
120  static value * mapform = NULL;
121  if ( mapform == NULL )
122  mapform = caml_named_value( CAML_PLPLOT_MAPFORM_FUNC_NAME );
123 
124  // No check to see if a callback function has been designated yet,
125  // because that is checked before we get to this point.
126  int i;
127  for ( i = 0; i < n; i++ )
128  {
129  result =
130  caml_callback2( *mapform,
131  caml_copy_double( x[i] ), caml_copy_double( y[i] ) );
132 
133  double new_x, new_y;
134  new_x = Double_val( Field( result, 0 ) );
135  new_y = Double_val( Field( result, 1 ) );
136 
137  x[i] = new_x;
138  y[i] = new_y;
139  }
140 
141  CAMLreturn0;
142 }
143 
144 // A simple routine to wrap a properly registered OCaml callback in a form
145 // usable by PLPlot routines.
146 void ml_labelfunc( PLINT axis, PLFLT n, char *label, PLINT length, PLPointer d )
147 {
148  CAMLparam0();
149  CAMLlocal1( result );
150 
151  // Get the OCaml callback function (if there is one)
152  static value * callback = NULL;
153  if ( callback == NULL )
154  callback = caml_named_value( CAML_PLPLOT_LABEL_FUNC_NAME );
155 
156  // No check to see if a callback function has been designated yet,
157  // because that is checked before we get to this point.
158  result =
159  caml_callback2( *callback, Val_int( axis - 1 ), caml_copy_double( n ) );
160 
161  // Copy the OCaml callback output to the proper location.
162  snprintf( label, length, "%s", String_val( result ) );
163 
164  CAMLreturn0;
165 }
166 
167 // OCaml callback for plsabort
168 void ml_abort( const char* message )
169 {
170  CAMLparam0();
171  CAMLlocal1( result );
172 
173  // Get the OCaml callback function (if there is one)
174  static value * handler = NULL;
175  if ( handler == NULL )
176  handler = caml_named_value( CAML_PLPLOT_ABORT_FUNC_NAME );
177 
178  // No check to see if a callback function has been designated yet,
179  // because that is checked before we get to this point.
180  result =
181  caml_callback( *handler, caml_copy_string( message ) );
182 
183  CAMLreturn0;
184 }
185 
186 // OCaml callback for plsexit
187 int ml_exit( const char* message )
188 {
189  CAMLparam0();
190  CAMLlocal1( result );
191 
192  // Get the OCaml callback function (if there is one)
193  static value * handler = NULL;
194  if ( handler == NULL )
195  handler = caml_named_value( CAML_PLPLOT_EXIT_FUNC_NAME );
196 
197  // No check to see if a callback function has been designated yet,
198  // because that is checked before we get to this point.
199  result =
200  caml_callback( *handler, caml_copy_string( message ) );
201 
202  CAMLreturn( Int_val( result ) );
203 }
204 
205 // A simple routine to wrap a properly registered OCaml callback in a form
206 // usable by PLPlot routines. If an appropriate callback is not registered
207 // then nothing is done.
208 void ml_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data )
209 {
210  CAMLparam0();
211  CAMLlocal1( result );
212 
213  // Get the OCaml callback function (if there is one)
214  static value * transform = NULL;
215  if ( transform == NULL )
216  transform = caml_named_value( CAML_PLPLOT_TRANSFORM_FUNC_NAME );
217 
218  // No check to see if a callback function has been designated yet,
219  // because that is checked before we get to this point.
220  result =
221  caml_callback2( *transform, caml_copy_double( x ), caml_copy_double( y ) );
222 
223  *xt = Double_val( Field( result, 0 ) );
224  *yt = Double_val( Field( result, 1 ) );
225 
226  CAMLreturn0;
227 }
228 
229 // Check if the matching OCaml callback is defined. Return NULL if it is not,
230 // and the proper function pointer if it is.
232 {
233  static value * pltr = NULL;
234  if ( pltr == NULL )
235  pltr = caml_named_value( CAML_PLPLOT_PLOTTER_FUNC_NAME );
236 
237  if ( pltr == NULL || Val_int( 0 ) == *pltr )
238  {
239  // No plotter defined
240  return NULL;
241  }
242  else
243  {
244  // Plotter is defined
245  return ml_plotter;
246  }
247 }
249 {
250  static value * defined = NULL;
251  if ( defined == NULL )
252  defined = caml_named_value( CAML_PLPLOT_DEFINED_FUNC_NAME );
253 
254  if ( defined == NULL || Val_int( 0 ) == *defined )
255  {
256  // No plotter defined
257  return NULL;
258  }
259  else
260  {
261  // Plotter is defined
262  return ml_defined;
263  }
264 }
266 {
267  static value * mapform = NULL;
268  if ( mapform == NULL )
269  mapform = caml_named_value( CAML_PLPLOT_MAPFORM_FUNC_NAME );
270 
271  if ( mapform == NULL || Val_int( 0 ) == *mapform )
272  {
273  // No plotter defined
274  return NULL;
275  }
276  else
277  {
278  // Plotter is defined
279  return ml_mapform;
280  }
281 }
282 
283 // Custom wrapper for plslabelfunc
285 {
286  CAMLparam1( unit );
287  static value * label = NULL;
288  if ( label == NULL )
289  label = caml_named_value( CAML_PLPLOT_LABEL_FUNC_NAME );
290 
291  if ( label == NULL || Val_int( 0 ) == *label )
292  {
293  // No plotter defined
294  plslabelfunc( NULL, NULL );
295  }
296  else
297  {
298  // Plotter is defined
299  plslabelfunc( ml_labelfunc, NULL );
300  }
301 
302  CAMLreturn( Val_unit );
303 }
304 
305 // Custom wrappers for plsabort and plsexit
307 {
308  CAMLparam1( unit );
309  static value * handler = NULL;
310  if ( handler == NULL )
311  handler = caml_named_value( CAML_PLPLOT_ABORT_FUNC_NAME );
312 
313  if ( handler == NULL || Val_int( 0 ) == *handler )
314  {
315  // No handler defined
316  plsabort( NULL );
317  }
318  else
319  {
320  // Handler is defined
321  plsabort( ml_abort );
322  }
323  CAMLreturn( Val_unit );
324 }
326 {
327  CAMLparam1( unit );
328  static value * handler = NULL;
329  if ( handler == NULL )
330  handler = caml_named_value( CAML_PLPLOT_EXIT_FUNC_NAME );
331 
332  if ( handler == NULL || Val_int( 0 ) == *handler )
333  {
334  // No handler defined
335  plsexit( NULL );
336  }
337  else
338  {
339  // Handler is defined
340  plsexit( ml_exit );
341  }
342  CAMLreturn( Val_unit );
343 }
344 
345 // Set a global coordinate transform
347 {
348  CAMLparam1( unit );
349  static value * handler = NULL;
350  if ( handler == NULL )
351  handler = caml_named_value( CAML_PLPLOT_TRANSFORM_FUNC_NAME );
352 
353  if ( handler == NULL || Val_int( 0 ) == *handler )
354  {
355  // No handler defined
356  plstransform( NULL, NULL );
357  }
358  else
359  {
360  // Handler is defined
361  plstransform( ml_transform, NULL );
362  }
363  CAMLreturn( Val_unit );
364 }
365 
366 //
367 //
368 // CONTOURING, SHADING and IMAGE FUNCTIONS
369 //
370 //
371 
372 //
373 // void
374 // c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx,
375 // PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel,
376 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
377 // PLPointer pltr_data);
378 //
379 void ml_plcont( const PLFLT **f, PLINT nx, PLINT ny,
380  PLINT kx, PLINT lx, PLINT ky, PLINT ly,
381  PLFLT *clevel, PLINT nlevel )
382 {
383  if ( get_ml_plotter_func() == NULL )
384  {
385  // This is handled in PLplot, but the error is raised here to clarify
386  // what the user needs to do since the custom plotter is defined
387  // separately from the call to plcont.
388  caml_invalid_argument( "A custom plotter must be defined \
389  before calling plcont" );
390  }
391  else
392  {
393  c_plcont( f, nx, ny, kx, lx, ky, ly, clevel, nlevel,
394  get_ml_plotter_func(), (void *) 1 );
395  }
396 }
397 
398 //
399 // void
400 // c_plshade(PLFLT **a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT),
401 // PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
402 // PLFLT shade_min, PLFLT shade_max,
403 // PLINT sh_cmap, PLFLT sh_color, PLINT sh_width,
404 // PLINT min_color, PLINT min_width,
405 // PLINT max_color, PLINT max_width,
406 // void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
407 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
408 // PLPointer pltr_data);
409 //
410 void ml_plshade( const PLFLT **a, PLINT nx, PLINT ny,
411  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
412  PLFLT shade_min, PLFLT shade_max,
413  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
414  PLINT min_color, PLFLT min_width,
415  PLINT max_color, PLFLT max_width,
416  PLBOOL rectangular )
417 {
418  c_plshade( a, nx, ny,
420  left, right, bottom, top,
421  shade_min, shade_max,
422  sh_cmap, sh_color, sh_width, min_color, min_width,
423  max_color, max_width, plfill, rectangular,
424  get_ml_plotter_func(), (void *) 1 );
425 }
426 
427 //
428 // void
429 // c_plshade1(PLFLT *a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT),
430 // PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
431 // PLFLT shade_min, PLFLT shade_max,
432 // PLINT sh_cmap, PLFLT sh_color, PLINT sh_width,
433 // PLINT min_color, PLINT min_width,
434 // PLINT max_color, PLINT max_width,
435 // void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
436 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
437 // PLPointer pltr_data);
438 //
439 
440 //
441 // void
442 // c_plshades( PLFLT **a, PLINT nx, PLINT ny, PLINT (*defined) (PLFLT, PLFLT),
443 // PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
444 // PLFLT *clevel, PLINT nlevel, PLINT fill_width,
445 // PLINT cont_color, PLINT cont_width,
446 // void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
447 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
448 // PLPointer pltr_data);
449 //
450 void ml_plshades( const PLFLT **a, PLINT nx, PLINT ny,
452  PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
454  PLBOOL rectangular )
455 {
456  c_plshades( a, nx, ny,
458  xmin, xmax, ymin, ymax,
459  clevel, nlevel, fill_width,
460  cont_color, cont_width,
461  plfill, rectangular,
463  (void *) 1 );
464 }
465 
466 //
467 // void
468 // c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny,
469 // PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax,
470 // PLFLT valuemin, PLFLT valuemax,
471 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
472 // PLPointer pltr_data);
473 //
474 void ml_plimagefr( const PLFLT **idata, PLINT nx, PLINT ny,
476  PLFLT zmin, PLFLT zmax,
477  PLFLT valuemin, PLFLT valuemax )
478 {
479  c_plimagefr( idata, nx, ny,
480  xmin, xmax, ymin, ymax,
481  zmin, zmax,
482  valuemin, valuemax,
484  (void *) 1 );
485 }
486 
487 //
488 // void
489 // c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale,
490 // void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
491 // PLPointer pltr_data);
492 //
493 void ml_plvect( const PLFLT **u, const PLFLT **v, PLINT nx, PLINT ny, PLFLT scale )
494 {
495  c_plvect( u, v, nx, ny, scale,
497  (void *) 1 );
498 }
499 
500 //
501 // void
502 // c_plmap( void (*mapform)(PLINT, PLFLT *, PLFLT *), const char *type,
503 // PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
504 //
505 void ml_plmap( const char *type,
506  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat )
507 {
509  type, minlong, maxlong, minlat, maxlat );
510 }
511 
512 //
513 // void
514 // c_plmeridians( void (*mapform)(PLINT, PLFLT *, PLFLT *),
515 // PLFLT dlong, PLFLT dlat,
516 // PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
517 //
518 void ml_plmeridians( PLFLT dlong, PLFLT dlat,
519  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat )
520 {
522  dlong, dlat, minlong, maxlong, minlat, maxlat );
523 }
524 
525 //
526 // void
527 // c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts,
528 // PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy,
529 // PLFLT **zg, PLINT type, PLFLT data);
530 //
531 // This one is currently wrapped by hand, as I am not sure how to get camlidl
532 // to allocate zg in a way that makes plgriddata happy and doesn't require the
533 // user to pre-allocate the space.
535  value xg, value yg,
536  value type, value data )
537 {
538  CAMLparam5( x, y, z, xg, yg );
539  CAMLxparam2( type, data );
540 
541  // zg holds the OCaml float array array.
542  // y_ml_array is a temporary structure which will be used to form each
543  // float array making up zg.
544  CAMLlocal2( zg, y_ml_array );
545 
546  PLFLT **zg_local;
547 
548  int npts, nptsx, nptsy;
549  int i, j;
550 
551  // Check to make sure x, y and z are all the same length.
552  npts = Wosize_val( x ) / Double_wosize;
553  if ( ( Wosize_val( y ) / Double_wosize != Wosize_val( z ) / Double_wosize ) ||
554  ( Wosize_val( y ) / Double_wosize != npts ) ||
555  ( Wosize_val( z ) / Double_wosize != npts )
556  )
557  {
558  caml_failwith( "ml_plgriddata: x, y, z must all have the same dimensions" );
559  }
560 
561  nptsx = Wosize_val( xg ) / Double_wosize;
562  nptsy = Wosize_val( yg ) / Double_wosize;
563 
564  // Allocate the 2D grid in a way that will make PLplot happy
565  plAlloc2dGrid( &zg_local, nptsx, nptsy );
566 
567  // Using "type + 1" because "type" is passed in as a variant type, so
568  // the indexing starts from 0 rather than 1.
569  c_plgriddata( (double *) x, (double *) y, (double *) z, npts, (double *) xg, nptsx,
570  (double *) yg, nptsy, zg_local, Int_val( type ) + 1,
571  Double_val( data ) );
572 
573  // Allocate the X-dimension of the to-be-returned OCaml array
574  zg = caml_alloc( nptsx, 0 );
575 
576  for ( i = 0; i < nptsx; i++ )
577  {
578  // Allocate each Y-dimension array of the OCaml array
579  y_ml_array = caml_alloc( nptsy * Double_wosize, Double_array_tag );
580  for ( j = 0; j < nptsy; j++ )
581  {
582  Store_double_field( y_ml_array, j, zg_local[i][j] );
583  }
584  caml_modify( &Field( zg, i ), y_ml_array );
585  }
586 
587  // Free the memory used by the C array
588  plFree2dGrid( zg_local, nptsx, nptsy );
589 
590  CAMLreturn( zg );
591 }
592 
594 {
595  return ml_plgriddata( argv[0], argv[1], argv[2], argv[3], argv[4],
596  argv[5], argv[6] );
597 }
598 
599 //
600 // void
601 // c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc);
602 //
603 // plpoly3 is wrapped by hand because draw has a length of (n - 1) and camlidl
604 // does not have a way to indicate this automatically.
605 void ml_plpoly3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT ndraw, PLBOOL *draw, PLBOOL ifcc )
606 {
607  plpoly3( n, x, y, z, draw, ifcc );
608 }
609 
610 // Raise Invalid_argument if the given value is <> 0
611 void plplot_check_nonzero_result( int result )
612 {
613  if ( result != 0 )
614  {
615  char exception_message[MAX_EXCEPTION_MESSAGE_LENGTH];
616  sprintf( exception_message, "Error, return code %d", result );
617  caml_invalid_argument( exception_message );
618  }
619  return;
620 }
621 
622 // Translate the integer version of the OCaml variant to the appropriate
623 // PLplot constant.
624 int translate_parse_option( int parse_option )
625 {
626  int translated_option;
627  switch ( parse_option )
628  {
629  case 0: translated_option = PL_PARSE_PARTIAL; break;
630  case 1: translated_option = PL_PARSE_FULL; break;
631  case 2: translated_option = PL_PARSE_QUIET; break;
632  case 3: translated_option = PL_PARSE_NODELETE; break;
633  case 4: translated_option = PL_PARSE_SHOWALL; break;
634  case 5: translated_option = PL_PARSE_OVERRIDE; break;
635  case 6: translated_option = PL_PARSE_NOPROGRAM; break;
636  case 7: translated_option = PL_PARSE_NODASH; break;
637  case 8: translated_option = PL_PARSE_SKIP; break;
638  default: translated_option = -1;
639  }
640  return translated_option;
641 }
642 
643 // Copy a string array
644 #define INIT_STRING_ARRAY( o ) \
645  int o ## _length; \
646  o ## _length = Wosize_val( o ); \
647  const char *c_ ## o[o ## _length]; \
648  for ( i = 0; i < o ## _length; i++ ) { c_ ## o[i] = String_val( Field( o, i ) ); }
649 
650 // Copy an int array, o, of n element to the C array c
651 #define INIT_INT_ARRAY( o ) \
652  int o ## _length; \
653  o ## _length = Wosize_val( o ); \
654  int c_ ## o[o ## _length]; \
655  for ( i = 0; i < ( o ## _length ); i++ ) { ( c_ ## o )[i] = Int_val( Field( ( o ), i ) ); }
656 
657 // Copy an int array, o, of n element to the C array c
658 #define INIT_INT_ARRAYS( o ) \
659  int o ## _length, o ## _inner; \
660  o ## _length = Wosize_val( o ); \
661  int *c_ ## o[o ## _length]; \
662  for ( i = 0; i < ( o ## _length ); i++ ) { \
663  INIT_INT_ARRAY( o ## _subarray ); \
664  ( c_ ## o )[i] = c_ ## o ## _subarray; \
665  }
666 
667 int lor_ml_list( value list, ML_VARIANT_FUNC variant_f )
668 {
669  CAMLparam1( list );
670  int result;
671 
672  result = 0;
673  while ( list != Val_emptylist )
674  {
675  // Accumulate the elements of the list
676  result = result | variant_f( Int_val( Field( list, 0 ) ) );
677  // Point to the tail of the list for the next loop
678  list = Field( list, 1 );
679  }
680 
681  CAMLreturn( result );
682 }
683 
685 {
686  CAMLparam2( argv, parse_method );
687  int i;
688  int result;
689  int combined_parse_method;
690  // Make a copy of the command line argument strings
691  INIT_STRING_ARRAY( argv )
692 
693  // OR the elements of the parse_method list together
694  combined_parse_method = lor_ml_list( parse_method, translate_parse_option );
695 
696  result = plparseopts( &argv_length, c_argv, combined_parse_method );
697  if ( result != 0 )
698  {
699  char exception_message[MAX_EXCEPTION_MESSAGE_LENGTH];
700  sprintf( exception_message, "Invalid arguments in plparseopts, error %d", result );
701  caml_invalid_argument( exception_message );
702  }
703  CAMLreturn( Val_unit );
704 }
705 
707  value ymin, value ymax, value xlpos, value ylpos, value y_ascl,
708  value acc, value colbox, value collab, value colline, value styline,
709  value legline, value labx, value laby, value labtop )
710 {
711  // Function parameters
712  CAMLparam5( xspec, yspec, xmin, xmax, xjump );
713  CAMLxparam5( ymin, ymax, xlpos, ylpos, y_ascl );
714  CAMLxparam5( acc, colbox, collab, colline, styline );
715  CAMLxparam4( legline, labx, laby, labtop );
716  // Line attribute array copies
717  int colline_copy[4];
718  int styline_copy[4];
719  const char* legend_copy[4];
720  int i;
721  for ( i = 0; i < 4; i++ )
722  {
723  colline_copy[i] = Int_val( Field( colline, i ) );
724  styline_copy[i] = Int_val( Field( styline, i ) );
725  legend_copy[i] = String_val( Field( legline, i ) );
726  }
727  // The returned value
728  int id;
729  plstripc( &id, String_val( xspec ), String_val( yspec ),
730  Double_val( xmin ), Double_val( xmax ),
731  Double_val( xjump ), Double_val( ymin ), Double_val( ymax ),
732  Double_val( xlpos ), Double_val( ylpos ), Bool_val( y_ascl ),
733  Bool_val( acc ), Int_val( colbox ), Int_val( collab ),
734  colline_copy, styline_copy, legend_copy,
735  String_val( labx ), String_val( laby ), String_val( labtop ) );
736  // Make me do something!
737  CAMLreturn( Val_int( id ) );
738 }
739 
741 {
742  return ml_plstripc( argv[0], argv[1], argv[2], argv[3], argv[4],
743  argv[5], argv[6], argv[7], argv[8], argv[9],
744  argv[10], argv[11], argv[12], argv[13], argv[14],
745  argv[15], argv[16], argv[17], argv[18] );
746 }
747 
748 int translate_legend_option( int legend_option )
749 {
750  int translated_option;
751  switch ( legend_option )
752  {
753  case 0: translated_option = PL_LEGEND_NONE; break;
754  case 1: translated_option = PL_LEGEND_COLOR_BOX; break;
755  case 2: translated_option = PL_LEGEND_LINE; break;
756  case 3: translated_option = PL_LEGEND_SYMBOL; break;
757  case 4: translated_option = PL_LEGEND_TEXT_LEFT; break;
758  case 5: translated_option = PL_LEGEND_BACKGROUND; break;
759  case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break;
760  case 7: translated_option = PL_LEGEND_ROW_MAJOR; break;
761  default: translated_option = -1;
762  }
763  return translated_option;
764 }
765 
766 int translate_colorbar_option( int colorbar_option )
767 {
768  int translated_option;
769  switch ( colorbar_option )
770  {
771  case 0: translated_option = PL_COLORBAR_LABEL_LEFT; break;
772  case 1: translated_option = PL_COLORBAR_LABEL_RIGHT; break;
773  case 2: translated_option = PL_COLORBAR_LABEL_TOP; break;
774  case 3: translated_option = PL_COLORBAR_LABEL_BOTTOM; break;
775  case 4: translated_option = PL_COLORBAR_IMAGE; break;
776  case 5: translated_option = PL_COLORBAR_SHADE; break;
777  case 6: translated_option = PL_COLORBAR_GRADIENT; break;
778  case 7: translated_option = PL_COLORBAR_CAP_NONE; break;
779  case 8: translated_option = PL_COLORBAR_CAP_LOW; break;
780  case 9: translated_option = PL_COLORBAR_CAP_HIGH; break;
781  case 10: translated_option = PL_COLORBAR_SHADE_LABEL; break;
782  case 11: translated_option = PL_COLORBAR_ORIENT_RIGHT; break;
783  case 12: translated_option = PL_COLORBAR_ORIENT_TOP; break;
784  case 13: translated_option = PL_COLORBAR_ORIENT_LEFT; break;
785  case 14: translated_option = PL_COLORBAR_ORIENT_BOTTOM; break;
786  case 15: translated_option = PL_COLORBAR_BACKGROUND; break;
787  case 16: translated_option = PL_COLORBAR_BOUNDING_BOX; break;
788  default: translated_option = -1;
789  }
790  return translated_option;
791 }
792 
793 int translate_position_option( int position_option )
794 {
795  int translated_option;
796  switch ( position_option )
797  {
798  case 0: translated_option = PL_POSITION_LEFT; break;
799  case 1: translated_option = PL_POSITION_RIGHT; break;
800  case 2: translated_option = PL_POSITION_TOP; break;
801  case 3: translated_option = PL_POSITION_BOTTOM; break;
802  case 4: translated_option = PL_POSITION_INSIDE; break;
803  case 5: translated_option = PL_POSITION_OUTSIDE; break;
804  case 6: translated_option = PL_POSITION_VIEWPORT; break;
805  case 7: translated_option = PL_POSITION_SUBPAGE; break;
806  default: translated_option = -1;
807  }
808  return translated_option;
809 }
810 
812  value bg_color,
814  value nrow, value ncolumn,
815  value opt_array,
816  value text_offset, value text_scale, value text_spacing,
817  value text_justification, value text_colors, value text,
818  value box_colors, value box_patterns, value box_scales,
819  value box_line_widths,
820  value line_colors, value line_styles, value line_widths,
821  value symbol_colors, value symbol_scales,
822  value symbol_numbers, value symbols )
823 {
824  CAMLparam5( position, opt, x, y, plot_width );
825  CAMLxparam5( bg_color, bb_color, bb_style, nrow, ncolumn );
826  CAMLxparam5( opt_array, text_offset, text_scale, text_spacing, text_justification );
827  CAMLxparam5( text_colors, text, box_colors, box_patterns, box_scales );
828  CAMLxparam5( box_line_widths, line_colors, line_styles, line_widths, symbol_colors );
829  CAMLxparam3( symbol_scales, symbol_numbers, symbols );
830  CAMLlocal1( result );
831  result = caml_alloc( 2, 0 );
832 
833  // Counter
834  int i;
835  // General legend options
836  int c_position, c_opt;
837  // Number of legend entries
838  int n_legend;
839  n_legend = Wosize_val( opt_array );
840  // Options for each legend entry
841  int c_opt_array[n_legend];
842 
843  // Assume that the dimensions all line up on the OCaml side, so we don't
844  // need to do any further dimension checks.
845 
846  // Define and initialize all of the C arrays to pass in to pllegend
847  INIT_STRING_ARRAY( text )
848  INIT_INT_ARRAY( text_colors )
849  INIT_INT_ARRAY( box_colors )
850  INIT_INT_ARRAY( box_patterns )
851  INIT_INT_ARRAY( line_colors )
852  INIT_INT_ARRAY( line_styles )
853  INIT_INT_ARRAY( symbol_colors )
854  INIT_INT_ARRAY( symbol_numbers )
855  INIT_STRING_ARRAY( symbols )
856 
857  // Translate the legend configuration options
858  c_opt = lor_ml_list( opt, translate_legend_option );
859  c_position = lor_ml_list( position, translate_position_option );
860 
861  for ( i = 0; i < n_legend; i++ )
862  {
863  c_opt_array[i] =
864  lor_ml_list( Field( opt_array, i ), translate_legend_option );
865  }
866 
867  // The returned width and height of the legend
868  PLFLT width, height;
869 
870  pllegend( &width, &height, c_opt, c_position, Double_val( x ), Double_val( y ),
871  Double_val( plot_width ), Int_val( bg_color ),
872  Int_val( bb_color ), Int_val( bb_style ),
873  Int_val( nrow ), Int_val( ncolumn ),
874  n_legend, c_opt_array,
875  Double_val( text_offset ), Double_val( text_scale ),
876  Double_val( text_spacing ),
877  Double_val( text_justification ),
878  c_text_colors, c_text,
879  c_box_colors, c_box_patterns, (double *) box_scales,
880  (double *) box_line_widths,
881  c_line_colors, c_line_styles, (double *) line_widths,
882  c_symbol_colors, (double *) symbol_scales, c_symbol_numbers,
883  c_symbols );
884 
885  // Return a tuple with the legend's size
886  Store_field( result, 0, caml_copy_double( width ) );
887  Store_field( result, 1, caml_copy_double( height ) );
888 
889  CAMLreturn( result );
890 }
891 
893 {
894  return ml_pllegend( argv[0], argv[1], argv[2], argv[3], argv[4],
895  argv[5], argv[6], argv[7], argv[8], argv[9],
896  argv[10], argv[11], argv[12], argv[13], argv[14],
897  argv[15], argv[16], argv[17], argv[18], argv[19],
898  argv[20], argv[21], argv[22], argv[23], argv[24],
899  argv[25], argv[26], argv[27] );
900 }
901 
910  value values )
911 {
912  CAMLparam5( opt, position, x, y, x_length );
913  CAMLxparam5( y_length, bg_color, bb_color, bb_style, low_cap_color );
914  CAMLxparam5( high_cap_color, cont_color, cont_width, label_opts, label );
915  CAMLxparam4( axis_opts, ticks, sub_ticks, values );
916  CAMLlocal1( result );
917  result = caml_alloc( 2, 0 );
918 
919  // Counter
920  int i;
921  // General colorbar options
922  int c_opt, c_position;
923  // Number of labels
924  int n_labels;
925  n_labels = Wosize_val( label_opts );
926  // Number of axes and value ranges
927  int n_axes;
928  n_axes = Wosize_val( axis_opts );
929 
930  // Translate configuration options
931  c_opt = lor_ml_list( opt, translate_colorbar_option );
932  c_position = lor_ml_list( position, translate_position_option );
933 
934  // Assume that the dimensions all line up on the OCaml side, so we don't
935  // need to do any further dimension checks.
936 
937  // Define and initialize all of the C arrays to pass into plcolorbar
938  INIT_STRING_ARRAY( label )
939  INIT_STRING_ARRAY( axis_opts )
940  INIT_INT_ARRAY( sub_ticks );
941 
942  // Label options
943  int c_label_opts[ n_labels ];
944  for ( i = 0; i < n_labels; i++ )
945  {
946  c_label_opts[i] = lor_ml_list( Field( label_opts, i ), translate_colorbar_option );
947  }
948 
949  // Copy the axis/range values
950  double **c_values;
951  int n_values[ n_axes ];
952  c_values = malloc( n_axes * sizeof ( double * ) );
953  // TODO: Add allocation failure check
954  for ( i = 0; i < n_axes; i++ )
955  {
956  c_values[i] = (double *) Field( values, i );
957  n_values[i] = Wosize_val( Field( values, i ) ) / Double_wosize;
958  }
959 
960  // Return values
961  PLFLT width, height;
962 
963  plcolorbar( &width, &height,
964  c_opt, c_position, Double_val( x ), Double_val( y ),
965  Double_val( x_length ), Double_val( y_length ),
966  Int_val( bg_color ), Int_val( bb_color ), Int_val( bb_style ),
967  Double_val( low_cap_color ), Double_val( high_cap_color ),
968  Int_val( cont_color ), Double_val( cont_width ),
969  n_labels, c_label_opts, c_label,
970  n_axes, c_axis_opts,
971  (double *) ticks, c_sub_ticks,
972  n_values, (const PLFLT * const *) c_values );
973 
974  // Return a tuple with the colorbar's size
975  Store_field( result, 0, caml_copy_double( width ) );
976  Store_field( result, 1, caml_copy_double( height ) );
977 
978  CAMLreturn( result );
979 }
980 
982 {
983  return ml_plcolorbar( argv[0], argv[1], argv[2], argv[3], argv[4],
984  argv[5], argv[6], argv[7], argv[8], argv[9],
985  argv[10], argv[11], argv[12], argv[13], argv[14],
986  argv[15], argv[16], argv[17], argv[18] );
987 }
988 
989 // pltr* function implementations
990 void ml_pltr0( double x, double y, double* tx, double* ty )
991 {
992  pltr0( x, y, tx, ty, NULL );
993 }
994 
996 {
997  CAMLparam4( xg, yg, x, y );
998  CAMLlocal1( tx_ty );
999  tx_ty = caml_alloc( 2, 0 );
1000  double tx;
1001  double ty;
1002  PLcGrid grid;
1003  grid.xg = (double *) xg;
1004  grid.yg = (double *) yg;
1005  grid.nx = Wosize_val( xg ) / Double_wosize;
1006  grid.ny = Wosize_val( yg ) / Double_wosize;
1007  pltr1( Double_val( x ), Double_val( y ), &tx, &ty, ( PLPointer ) & grid );
1008 
1009  // Allocate a tuple and return it with the results
1010  Store_field( tx_ty, 0, caml_copy_double( tx ) );
1011  Store_field( tx_ty, 1, caml_copy_double( ty ) );
1012  CAMLreturn( tx_ty );
1013 }
1014 
1016 {
1017  CAMLparam4( xg, yg, x, y );
1018  CAMLlocal1( tx_ty );
1019  tx_ty = caml_alloc( 2, 0 );
1020  double ** c_xg;
1021  double ** c_yg;
1022  int i;
1023  int length1;
1024  int length2;
1025  PLcGrid2 grid;
1026  double tx;
1027  double ty;
1028 
1029  // TODO: As of now, you will probably get a segfault of the xg and yg
1030  // dimensions don't match up properly.
1031  // Build the grid.
1032  // Length of "outer" array
1033  length1 = Wosize_val( xg );
1034  // Length of the "inner" arrays
1035  length2 = Wosize_val( Field( xg, 0 ) ) / Double_wosize;
1036  c_xg = malloc( length1 * sizeof ( double* ) );
1037  for ( i = 0; i < length1; i++ )
1038  {
1039  c_xg[i] = (double *) Field( xg, i );
1040  }
1041  c_yg = malloc( length1 * sizeof ( double* ) );
1042  for ( i = 0; i < length1; i++ )
1043  {
1044  c_yg[i] = (double *) Field( yg, i );
1045  }
1046  grid.xg = c_xg;
1047  grid.yg = c_yg;
1048  grid.nx = length1;
1049  grid.ny = length2;
1050 
1051  pltr2( Double_val( x ), Double_val( y ), &tx, &ty, ( PLPointer ) & grid );
1052 
1053  // Clean up
1054  free( c_xg );
1055  free( c_yg );
1056 
1057  // Allocate a tuple and return it with the results
1058  Store_field( tx_ty, 0, caml_copy_double( tx ) );
1059  Store_field( tx_ty, 1, caml_copy_double( ty ) );
1060  CAMLreturn( tx_ty );
1061 }
1062 
1063 // XXX Non-core functions follow XXX
1064 //*
1065 // The following functions are here for (my?) convenience. As far as I can
1066 // tell, they are not defined in the core PLplot library.
1067 //
1068 
1069 // Get the current color map 0 color index
1070 int plg_current_col0( void )
1071 {
1072  return plsc->icol0;
1073 }
1074 
1075 // Get the current color map 1 color index
1077 {
1078  return plsc->icol1;
1079 }
1080 
1081 // Get the current pen width. TODO: Remove this, as I think this information
1082 // can be retrieved from another proper PLplot function.
1084 {
1085  return plsc->width;
1086 }
1087 
1088 // Get the current character (text) height in mm. TODO: Remove this, as I
1089 // think this information can be retrieved from another proper PLplot
1090 // function
1092 {
1093  return plsc->chrht;
1094 }
void ml_pltr0(double x, double y, double *tx, double *ty)
Definition: plplot_impl.c:990
PLFLT plgchrht(void)
Definition: plplot_impl.c:1091
static PLINT text
Definition: gcw.c:97
value ml_plcolorbar_byte(value *argv, int argn)
Definition: plplot_impl.c:981
static char ** argv
Definition: qt.cpp:40
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
Definition: pdfutils.c:1130
#define PL_PARSE_NOPROGRAM
Definition: plplot.h:298
void ml_plshade(const PLFLT **a, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, PLBOOL rectangular)
Definition: plplot_impl.c:410
void ml_mapform(PLINT n, PLFLT *x, PLFLT *y)
Definition: plplot_impl.c:114
void(* ML_LABEL_FUNC)(PLINT, PLFLT, char *, PLINT, PLPointer)
Definition: plplot_impl.c:48
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const * label
value ml_plstripc(value xspec, value yspec, value xmin, value xmax, value xjump, value ymin, value ymax, value xlpos, value ylpos, value y_ascl, value acc, value colbox, value collab, value colline, value styline, value legline, value labx, value laby, value labtop)
Definition: plplot_impl.c:706
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT nx
static PLFLT ** xg
PLINT ml_defined(PLFLT x, PLFLT y)
Definition: plplot_impl.c:89
PLFLT * xg
Definition: plplot.h:428
#define PL_PARSE_QUIET
Definition: plplot.h:293
#define CAML_PLPLOT_TRANSFORM_FUNC_NAME
Definition: plplot_impl.c:43
#define PL_PARSE_NODASH
Definition: plplot.h:299
#define CAML_PLPLOT_LABEL_FUNC_NAME
Definition: plplot_impl.c:40
#define pllegend
Definition: plplot.h:653
void mapform(PLINT n, PLFLT *x, PLFLT *y)
Definition: tclAPI.c:3228
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT bb_color
void PLFLT PLINT PLINT position
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT const PLINT const PLINT * n_values
#define CAML_PLPLOT_DEFINED_FUNC_NAME
Definition: plplot_impl.c:39
value ml_plstransform(value unit)
Definition: plplot_impl.c:346
void c_plshades(const PLFLT *const *a, PLINT nx, PLINT ny, PLINT(*defined)(PLFLT, PLFLT), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, void(*fill)(PLINT, const PLFLT *, const PLFLT *), PLINT rectangular, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
Definition: plshade.c:205
#define plfill
Definition: plplot.h:612
void ml_plvect(const PLFLT **u, const PLFLT **v, PLINT nx, PLINT ny, PLFLT scale)
Definition: plplot_impl.c:493
void c_plvect(const PLFLT *const *u, const PLFLT *const *v, PLINT nx, PLINT ny, PLFLT scale, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
Definition: plvect.c:216
int lor_ml_list(value list, ML_VARIANT_FUNC variant_f)
Definition: plplot_impl.c:667
value ml_pllegend_byte(value *argv, int argn)
Definition: plplot_impl.c:892
#define plpoly3
Definition: plplot.h:673
ML_MAPFORM_FUNC get_ml_mapform_func()
Definition: plplot_impl.c:265
PLFLT * yg
Definition: plplot.h:428
#define PL_PARSE_NODELETE
Definition: plplot.h:294
void plsexit(int(*handler)(const char *))
Definition: plctrl.c:1970
#define plparseopts
Definition: plplot.h:669
void(* ML_PLOTTER_FUNC)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer)
Definition: plplot_impl.c:45
void PLFLT PLINT PLINT PLFLT x
tuple xmin
Definition: Plframe.py:907
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
Definition: pdfutils.c:1104
void * PLPointer
Definition: plplot.h:201
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT const PLINT const PLINT const PLFLT * a
tuple ymin
Definition: Plframe.py:908
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const * axis_opts
#define CAML_PLPLOT_MAPFORM_FUNC_NAME
Definition: plplot_impl.c:38
PLINT ny
Definition: plplot.h:441
static PLFLT ** yg
ML_PLOTTER_FUNC get_ml_plotter_func()
Definition: plplot_impl.c:231
value ml_plsexit(value unit)
Definition: plplot_impl.c:325
void plsabort(void(*handler)(const char *))
Definition: plctrl.c:1921
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT low_cap_color
PLFLT plg_current_col1(void)
Definition: plplot_impl.c:1076
value ml_plgriddata(value x, value y, value z, value xg, value yg, value type, value data)
Definition: plplot_impl.c:534
PLDLLIMPEXP void c_plmeridians(void(*mapform)(PLINT, PLFLT *, PLFLT *), PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat)
int PLINT
Definition: plplot.h:175
value ml_pltr2(value xg, value yg, value x, value y)
Definition: plplot_impl.c:1015
void c_plimagefr(const PLFLT *const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
Definition: plimage.c:194
void ml_plshades(const PLFLT **a, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLFLT fill_width, PLINT cont_color, PLINT cont_width, PLBOOL rectangular)
Definition: plplot_impl.c:450
#define MAX_EXCEPTION_MESSAGE_LENGTH
Definition: plplot_impl.c:36
PLINT PLBOOL
Definition: plplot.h:198
ML_DEFINED_FUNC get_ml_defined_func()
Definition: plplot_impl.c:248
int ml_exit(const char *message)
Definition: plplot_impl.c:187
PLINT ny
Definition: plplot.h:429
#define INIT_INT_ARRAY(o)
Definition: plplot_impl.c:651
void c_plgriddata(const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT npts, const PLFLT *xg, PLINT nptsx, const PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data)
Definition: plgridd.c:114
#define PL_PARSE_PARTIAL
Definition: plplot.h:291
void ml_plmeridians(PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat)
Definition: plplot_impl.c:518
value ml_plgriddata_bytecode(value *argv, int argn)
Definition: plplot_impl.c:593
static void pltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data)
Definition: f77/sccont.c:211
#define snprintf
Definition: plplotP.h:240
void ml_plcont(const PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel)
Definition: plplot_impl.c:379
void PLFLT PLINT PLINT PLFLT PLFLT y
PLFLT ** xg
Definition: plplot.h:440
#define plstransform
Definition: plplot.h:732
value ml_pltr1(value xg, value yg, value x, value y)
Definition: plplot_impl.c:995
PLINT nx
Definition: plplot.h:441
#define INIT_STRING_ARRAY(o)
Definition: plplot_impl.c:644
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT high_cap_color
value ml_plcolorbar(value opt, value position, value x, value y, value x_length, value y_length, value bg_color, value bb_color, value bb_style, value low_cap_color, value high_cap_color, value cont_color, value cont_width, value label_opts, value label, value axis_opts, value ticks, value sub_ticks, value values)
Definition: plplot_impl.c:902
#define CAML_PLPLOT_PLOTTER_FUNC_NAME
Definition: plplot_impl.c:37
void ml_plmap(const char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat)
Definition: plplot_impl.c:505
tuple xmax
Definition: Plframe.py:909
#define plstripc
Definition: plplot.h:736
PLFLT plgwidth(void)
Definition: plplot_impl.c:1083
void
Definition: f95/scstubs.c:588
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT cont_color
PLFLT ** yg
Definition: plplot.h:440
static PLFLT value(double n1, double n2, double hue)
Definition: plctrl.c:1203
int translate_legend_option(int legend_option)
Definition: plplot_impl.c:748
#define CAML_PLPLOT_EXIT_FUNC_NAME
Definition: plplot_impl.c:42
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT x_length
PLINT(* ML_VARIANT_FUNC)(PLINT)
Definition: plplot_impl.c:49
float PLFLT
Definition: plplot.h:159
#define PL_PARSE_FULL
Definition: plplot.h:292
value ml_plparseopts(value argv, value parse_method)
Definition: plplot_impl.c:684
void plplot_check_nonzero_result(int result)
Definition: plplot_impl.c:611
void PLFLT PLINT opt
int plg_current_col0(void)
Definition: plplot_impl.c:1070
#define PL_PARSE_SKIP
Definition: plplot.h:300
void ml_transform(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data)
Definition: plplot_impl.c:208
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT cont_width
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT bb_style
tuple ymax
Definition: Plframe.py:910
value ml_pllegend(value opt, value position, value x, value y, value plot_width, value bg_color, value bb_color, value bb_style, value nrow, value ncolumn, value opt_array, value text_offset, value text_scale, value text_spacing, value text_justification, value text_colors, value text, value box_colors, value box_patterns, value box_scales, value box_line_widths, value line_colors, value line_styles, value line_widths, value symbol_colors, value symbol_scales, value symbol_numbers, value symbols)
Definition: plplot_impl.c:811
void ml_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT ndraw, PLBOOL *draw, PLBOOL ifcc)
Definition: plplot_impl.c:605
void ml_abort(const char *message)
Definition: plplot_impl.c:168
#define PL_PARSE_SHOWALL
Definition: plplot.h:296
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT bg_color
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT * label_opts
int translate_parse_option(int parse_option)
Definition: plplot_impl.c:624
value ml_plstripc_byte(value *argv, int argn)
Definition: plplot_impl.c:740
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT const PLINT * sub_ticks
void ml_plimagefr(const PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax)
Definition: plplot_impl.c:474
#define PL_PARSE_OVERRIDE
Definition: plplot.h:297
void ml_labelfunc(PLINT axis, PLFLT n, char *label, PLINT length, PLPointer d)
Definition: plplot_impl.c:146
#define CAML_PLPLOT_ABORT_FUNC_NAME
Definition: plplot_impl.c:41
int translate_colorbar_option(int colorbar_option)
Definition: plplot_impl.c:766
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT * ticks
void c_plshade(const PLFLT *const *a, PLINT nx, PLINT ny, PLINT(*defined)(PLFLT, PLFLT), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void(*fill)(PLINT, const PLFLT *, const PLFLT *), PLINT rectangular, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
Definition: plshade.c:321
void c_plcont(const PLFLT *const *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
Definition: plcont.c:515
PLINT(* ML_DEFINED_FUNC)(PLFLT, PLFLT)
Definition: plplot_impl.c:46
PLDLLIMPEXP void c_plmap(void(*mapform)(PLINT, PLFLT *, PLFLT *), const char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat)
void plcolorbar(PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLFLT cont_width, PLINT n_labels, const PLINT *label_opts, const char *const *label, PLINT n_axes, const char *const *axis_opts, const PLFLT *ticks, const PLINT *sub_ticks, const PLINT *n_values, const PLFLT *const *values) void my_plcolorbar(PLFLT *p_colorbar_width
value ml_plslabelfunc(value unit)
Definition: plplot_impl.c:284
void(* ML_MAPFORM_FUNC)(PLINT, PLFLT *, PLFLT *)
Definition: plplot_impl.c:47
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT y_length
#define plslabelfunc
Definition: plplot.h:716
PLINT nx
Definition: plplot.h:429
void ml_plotter(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data)
Definition: plplot_impl.c:60
int translate_position_option(int position_option)
Definition: plplot_impl.c:793
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT n_labels
value ml_plsabort(value unit)
Definition: plplot_impl.c:306