00001 // 00002 // Copyright 2008 Hezekiah M. Carty 00003 // 00004 // This file is part of PLplot. 00005 // 00006 // PLplot is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation, either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // PLplot is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with PLplot. If not, see <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #include <plplotP.h> 00021 00022 // The "usual" OCaml includes 00023 #include <caml/alloc.h> 00024 #include <caml/callback.h> 00025 #include <caml/fail.h> 00026 #include <caml/memory.h> 00027 #include <caml/misc.h> 00028 #include <caml/mlvalues.h> 00029 #include <caml/bigarray.h> 00030 00031 #include <plplot.h> 00032 00033 #include <cairo.h> 00034 00035 //* OCaml Cairo integration. 00036 // Get a Cairo context from OCaml. These #defines are from the 00037 // OCaml Cairo bindings. 00038 #define wPointer_val( t, val ) ( *( (t **) Data_custom_val( val ) ) ) 00039 #define cairo_t_val( v ) wPointer_val( cairo_t, v ) 00040 00041 value ml_set_plplot_cairo_context( value context ) 00042 { 00043 CAMLparam1( context ); 00044 pl_cmd( PLESC_DEVINIT, cairo_t_val( context ) ); 00045 CAMLreturn( Val_unit ); 00046 } 00047