├── .gitignore ├── CHANGES ├── LICENSE ├── Makefile ├── README.md ├── configure ├── discover.ml └── dune ├── dune-project ├── plplot.opam └── src ├── camlidlruntime.h ├── dune ├── idlalloc.c ├── plplot.ml ├── plplot.mli ├── plplot_core.h ├── plplot_core.ml ├── plplot_core.mli ├── plplot_core_stubs.c └── plplot_impl.c /.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | *.install 3 | .merlin 4 | -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | # 5.12.0 2 | 3 | * Compatibility with ocaml 5 4 | 5 | # 5.11.0-1 6 | 7 | * Port to dune2 8 | * Port to opam2 9 | * Added more depexts 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU Lesser General Public License (LGPL) version 2.1 (included below). 2 | 3 | As a special exception to the GNU Lesser General Public License, you may link, 4 | statically or dynamically, a "work that uses opam" with a publicly distributed 5 | version of opam to produce an executable file containing portions of opam, and 6 | distribute that executable file under terms of your choice, without any of the 7 | additional requirements listed in clause 6 of the GNU Lesser General Public 8 | License. By "a publicly distributed version of opam", we mean either the 9 | unmodified opam as distributed by OCamlPro, or a modified version of the opam 10 | that is distributed under the conditions defined in clause 2 of the GNU Lesser 11 | General Public License. This exception does not however invalidate any other 12 | reasons why the executable file might be covered by the GNU Lesser General 13 | Public License. 14 | 15 | ---------------------------------------------------------------------- 16 | 17 | GNU LESSER GENERAL PUBLIC LICENSE 18 | 19 | Version 2.1, February 1999 20 | 21 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 22 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 | Everyone is permitted to copy and distribute verbatim copies 24 | of this license document, but changing it is not allowed. 25 | 26 | [This is the first released version of the Lesser GPL. It also counts 27 | as the successor of the GNU Library Public License, version 2, hence 28 | the version number 2.1.] 29 | 30 | Preamble 31 | 32 | The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. 33 | 34 | This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. 35 | 36 | When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. 37 | 38 | To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. 41 | 42 | We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. 43 | 44 | To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. 45 | 46 | Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. 47 | 48 | Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. 49 | 50 | When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. 51 | 52 | We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. 53 | 54 | For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. 55 | 56 | In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. 57 | 58 | Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. 59 | 60 | The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. 61 | 62 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 63 | 64 | 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". 65 | 66 | A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. 67 | 68 | The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) 69 | 70 | "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. 71 | 72 | Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 73 | 74 | 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. 75 | 76 | You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 77 | 78 | 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 79 | 80 | a) The modified work must itself be a software library. 81 | b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. 82 | c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. 83 | d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. 84 | 85 | (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) 86 | 87 | These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. 88 | 89 | Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. 90 | 91 | In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 92 | 93 | 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. 94 | 95 | Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. 96 | 97 | This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 98 | 99 | 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. 100 | 101 | If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 102 | 103 | 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. 104 | 105 | However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. 106 | 107 | When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. 108 | 109 | If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) 110 | 111 | Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 112 | 113 | 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. 114 | 115 | You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: 116 | 117 | a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) 118 | b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. 119 | c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. 120 | d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. 121 | e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. 122 | 123 | For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. 124 | 125 | It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 126 | 127 | 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: 128 | 129 | a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. 130 | b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 131 | 132 | 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 133 | 134 | 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 135 | 136 | 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 137 | 138 | 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. 139 | 140 | If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. 141 | 142 | It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. 143 | 144 | This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 145 | 146 | 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 147 | 148 | 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 149 | 150 | Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 151 | 152 | 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. 153 | 154 | NO WARRANTY 155 | 156 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 157 | 158 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 159 | END OF TERMS AND CONDITIONS 160 | 161 | How to Apply These Terms to Your New Libraries 162 | 163 | If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). 164 | 165 | To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 166 | 167 | one line to give the library's name and an idea of what it does. 168 | Copyright (C) year name of author 169 | 170 | This library is free software; you can redistribute it and/or 171 | modify it under the terms of the GNU Lesser General Public 172 | License as published by the Free Software Foundation; either 173 | version 2.1 of the License, or (at your option) any later version. 174 | 175 | This library is distributed in the hope that it will be useful, 176 | but WITHOUT ANY WARRANTY; without even the implied warranty of 177 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178 | Lesser General Public License for more details. 179 | 180 | You should have received a copy of the GNU Lesser General Public 181 | License along with this library; if not, write to the Free Software 182 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 183 | 184 | Also add information on how to contact you by electronic and paper mail. 185 | 186 | You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: 187 | 188 | Yoyodyne, Inc., hereby disclaims all copyright interest in 189 | the library `Frob' (a library for tweaking knobs) written 190 | by James Random Hacker. 191 | 192 | signature of Ty Coon, 1 April 1990 193 | Ty Coon, President of Vice 194 | 195 | That's all there is to it! 196 | 197 | -------------------------------------------------- 198 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | dune build 3 | 4 | clean: 5 | dune clean 6 | 7 | doc: 8 | dune build @doc 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OCaml bindings to the PLplot library 2 | 3 | [PLplot][] is a library for creating scientific plots. 4 | 5 | # Installation 6 | 7 | The library is available in [opam][]: 8 | ``` 9 | opam install plplot 10 | ``` 11 | 12 | [opam]: https://opam.ocaml.org/ 13 | [PLplot]: https://sourceforge.net/projects/plplot/ 14 | -------------------------------------------------------------------------------- /configure/discover.ml: -------------------------------------------------------------------------------- 1 | module C = Configurator.V1 2 | 3 | let plplot_test = {| 4 | #include 5 | 6 | int main() 7 | { 8 | printf("PL_X_AXIS = %d\n", PL_X_AXIS); 9 | return 0; 10 | } 11 | |} 12 | 13 | let () = 14 | C.main ~name:"plplot" (fun c -> 15 | let conf = 16 | let default = { C.Pkg_config.cflags = []; libs = ["-lplplot"] } in 17 | match C.Pkg_config.get c with 18 | | None -> default 19 | | Some p -> begin 20 | match C.Pkg_config.query ~package:"plplot" p with 21 | | None -> begin 22 | match C.Pkg_config.query ~package:"plplotd" p with 23 | | None -> default 24 | | Some conf -> conf 25 | end 26 | | Some conf -> conf 27 | end 28 | in 29 | if not 30 | @@ C.c_test 31 | c 32 | plplot_test 33 | ~c_flags:conf.cflags 34 | ~link_flags:conf.libs 35 | then 36 | failwith "No valid installation of plplot or plplotd found." 37 | else 38 | C.Flags.write_sexp "c_flags.sexp" conf.cflags; 39 | C.Flags.write_sexp "c_library_flags.sexp" conf.libs) -------------------------------------------------------------------------------- /configure/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name discover) 3 | (libraries dune.configurator)) 4 | -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 2.0) 2 | (name plplot) 3 | -------------------------------------------------------------------------------- /plplot.opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Hezekiah M. Carty " 3 | authors: [ "Hezekiah M. Carty " ] 4 | license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" 5 | homepage: "https://github.com/hcarty/ocaml-plplot/" 6 | dev-repo: "git+https://github.com/hcarty/ocaml-plplot.git" 7 | bug-reports: "https://github.com/hcarty/ocaml-plplot/issues" 8 | doc: "https://hcarty.github.io/ocaml-plplot/plplot" 9 | build: [ 10 | [ 11 | "dune" "build" "-p" name "-j" jobs 12 | "@doc" {with-doc} 13 | ] 14 | ] 15 | depends: [ 16 | "ocaml" {>= "4.02.0"} 17 | "dune" {>= "2.0.0"} 18 | "dune-configurator" 19 | "odoc" {with-doc} 20 | ] 21 | depexts: [ 22 | ["libplplot-dev" "libshp-dev"] {os-family = "debian"} 23 | ["plplot"] {os = "macos" & os-distribution = "homebrew"} 24 | ["plpot"] {os-family = "arch"} 25 | ["plplot-devel"] {os-family = "rhel"} 26 | ["plplot-devel"] {os-family = "fedora"} 27 | ["plplot-devel"] {os-family = "suse"} 28 | ["plplot-devel" "epel-release"] {os-distribution = "centos"} 29 | ["plplot"] {os-distribution = "nixos"} 30 | ] 31 | synopsis: "Bindings for the PLplot library" 32 | description: "PLplot is a library for creating scientific plots http://plplot.sf.net/" 33 | -------------------------------------------------------------------------------- /src/camlidlruntime.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************/ 2 | /* */ 3 | /* CamlIDL */ 4 | /* */ 5 | /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ 6 | /* */ 7 | /* Copyright 1999 Institut National de Recherche en Informatique et */ 8 | /* en Automatique. All rights reserved. This file is distributed */ 9 | /* under the terms of the GNU Library General Public License. */ 10 | /* */ 11 | /***********************************************************************/ 12 | 13 | /* $Id: camlidlruntime.h,v 1.13 2004/07/08 09:48:15 xleroy Exp $ */ 14 | 15 | /* Helper functions for stub code generated by camlidl */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /* Functions for allocating in the Caml heap */ 22 | 23 | #define camlidl_alloc caml_alloc 24 | #define camlidl_alloc_small caml_alloc_small 25 | 26 | /* Helper functions for conversion */ 27 | 28 | extern value camlidl_find_enum(int n, int *flags, int nflags, char *errmsg); 29 | extern value camlidl_alloc_flag_list (int n, int *flags, int nflags); 30 | extern mlsize_t camlidl_ptrarray_size(void ** array); 31 | 32 | /* Malloc-like allocation with en masse deallocation */ 33 | 34 | typedef void (* camlidl_free_function)(void *); 35 | 36 | struct camlidl_block_list { 37 | camlidl_free_function free_fn; 38 | void * block; 39 | struct camlidl_block_list * next; 40 | }; 41 | 42 | struct camlidl_ctx_struct { 43 | int flags; 44 | struct camlidl_block_list * head; 45 | }; 46 | 47 | #define CAMLIDL_TRANSIENT 1 48 | #define CAMLIDL_ADDREF 2 49 | 50 | typedef struct camlidl_ctx_struct * camlidl_ctx; 51 | 52 | extern void * camlidl_malloc(size_t sz, camlidl_ctx ctx); 53 | extern void camlidl_free(camlidl_ctx ctx); 54 | extern char * camlidl_malloc_string(value mlstring, camlidl_ctx ctx); 55 | void camlidl_register_allocation(camlidl_free_function free_fn, 56 | void * block, 57 | camlidl_ctx ctx); 58 | 59 | /* Helper functions for handling COM interfaces */ 60 | 61 | #ifdef _WIN32 62 | #include 63 | #else 64 | #define interface struct 65 | typedef struct { 66 | unsigned int Data1; 67 | unsigned short Data2, Data3; 68 | unsigned char Data4[8]; 69 | } GUID, IID; 70 | typedef IID * REFIID; 71 | typedef int HRESULT; 72 | #define S_OK 0 73 | typedef unsigned long ULONG; 74 | #define SetErrorInfo(x,y) 75 | #define STDMETHODCALLTYPE 76 | #endif 77 | 78 | typedef HRESULT HRESULT_int; 79 | typedef HRESULT HRESULT_bool; 80 | 81 | #if defined(__GNUC__) 82 | #define DECLARE_VTBL_PADDING void * padding; void * constr; 83 | #define VTBL_PADDING 0, 0, 84 | #else 85 | #define DECLARE_VTBL_PADDING 86 | #define VTBL_PADDING 87 | #endif 88 | 89 | extern void * camlidl_unpack_interface(value vintf, camlidl_ctx ctx); 90 | extern value camlidl_pack_interface(void * intf, camlidl_ctx ctx); 91 | 92 | struct camlidl_component; 93 | 94 | struct camlidl_intf { 95 | void * vtbl; 96 | value caml_object; 97 | IID * iid; 98 | struct camlidl_component * comp; 99 | void * typeinfo; 100 | }; 101 | 102 | struct camlidl_component { 103 | int numintfs; 104 | long refcount; 105 | struct camlidl_intf intf[1]; 106 | }; 107 | 108 | extern value camlidl_make_interface(void * vtbl, value caml_object, 109 | IID * iid, int has_dispatch); 110 | 111 | /* Basic methods (QueryInterface, AddRef, Release) for COM objects 112 | encapsulating a Caml object */ 113 | 114 | extern HRESULT STDMETHODCALLTYPE 115 | camlidl_QueryInterface(struct camlidl_intf * self, REFIID iid, 116 | void ** object); 117 | extern ULONG STDMETHODCALLTYPE 118 | camlidl_AddRef(struct camlidl_intf * self); 119 | extern ULONG STDMETHODCALLTYPE 120 | camlidl_Release(struct camlidl_intf * self); 121 | 122 | /* Extra methods for the IDispatch interface */ 123 | 124 | #ifdef _WIN32 125 | extern HRESULT STDMETHODCALLTYPE 126 | camlidl_GetTypeInfoCount(struct camlidl_intf * self, UINT * count_type_info); 127 | extern HRESULT STDMETHODCALLTYPE 128 | camlidl_GetTypeInfo(struct camlidl_intf * self, UINT iTypeInfo, 129 | LCID localization, ITypeInfo ** res); 130 | extern HRESULT STDMETHODCALLTYPE 131 | camlidl_GetIDsOfNames(struct camlidl_intf * self, REFIID iid, 132 | OLECHAR** arrayNames, UINT countNames, 133 | LCID localization, DISPID * arrayDispIDs); 134 | extern HRESULT STDMETHODCALLTYPE 135 | camlidl_Invoke(struct camlidl_intf * self, DISPID dispidMember, REFIID iid, 136 | LCID localization, WORD wFlags, DISPPARAMS * dispParams, 137 | VARIANT * varResult, EXCEPINFO * excepInfo, UINT * argErr); 138 | #endif 139 | 140 | /* Raise an error */ 141 | extern void camlidl_error(HRESULT errcode, char * who, char * msg); 142 | 143 | /* Handle HRESULTs */ 144 | 145 | extern void camlidl_check_hresult(HRESULT hr); 146 | extern value camlidl_c2ml_Com_HRESULT_bool(HRESULT_bool * hr, 147 | camlidl_ctx ctx); 148 | extern void camlidl_ml2c_Com_HRESULT_bool(value v, HRESULT_bool * hr, 149 | camlidl_ctx ctx); 150 | extern value camlidl_c2ml_Com_HRESULT_int(HRESULT_int * hr, camlidl_ctx ctx); 151 | extern void camlidl_ml2c_Com_HRESULT_int(value v, HRESULT_int * hr, 152 | camlidl_ctx ctx); 153 | 154 | /* Handle uncaught exceptions in C-to-ML callbacks */ 155 | 156 | extern HRESULT camlidl_result_exception(char * methname, value exn_bucket); 157 | extern void camlidl_uncaught_exception(char * methname, value exn_bucket); 158 | 159 | /* Conversion functions for OLE Automation types */ 160 | 161 | #ifdef _WIN32 162 | extern void camlidl_ml2c_Com_BSTR(value s, BSTR * res, camlidl_ctx ctx); 163 | extern value camlidl_c2ml_Com_BSTR(BSTR * bs, camlidl_ctx ctx); 164 | #endif 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets c_flags.sexp c_library_flags.sexp) 3 | (action 4 | (run ../configure/discover.exe))) 5 | 6 | (library 7 | (name plplot) 8 | (public_name plplot) 9 | (private_modules plplot_core) 10 | (foreign_stubs 11 | (language c) 12 | (names plplot_core_stubs plplot_impl idlalloc) 13 | (flags 14 | :standard 15 | -g 16 | -O2 17 | (:include c_flags.sexp))) 18 | (c_library_flags 19 | :standard 20 | (:include c_library_flags.sexp))) 21 | -------------------------------------------------------------------------------- /src/idlalloc.c: -------------------------------------------------------------------------------- 1 | /***********************************************************************/ 2 | /* */ 3 | /* CamlIDL */ 4 | /* */ 5 | /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ 6 | /* */ 7 | /* Copyright 1999 Institut National de Recherche en Informatique et */ 8 | /* en Automatique. All rights reserved. This file is distributed */ 9 | /* under the terms of the GNU Library General Public License. */ 10 | /* */ 11 | /***********************************************************************/ 12 | 13 | /* $Id: idlalloc.c,v 1.7 2000/08/19 11:05:00 xleroy Exp $ */ 14 | 15 | /* Allocation functions and various helper functions 16 | for stub code generated by camlidl */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "camlidlruntime.h" 25 | 26 | /* Helper functions for conversion */ 27 | 28 | value camlidl_find_enum(int n, int *flags, int nflags, char *errmsg) 29 | { 30 | int i; 31 | 32 | for (i = 0; i < nflags; i++) { 33 | if (n == flags[i]) return Val_int(i); 34 | } 35 | caml_invalid_argument(errmsg); 36 | return Val_unit; /* not reached, keeps CL happy */ 37 | } 38 | 39 | value camlidl_alloc_flag_list(int n, int *flags, int nflags) 40 | { 41 | value l = Val_int(0); 42 | int i; 43 | 44 | Begin_root(l) 45 | for (i = nflags - 1; i >= 0; i--) 46 | if (n & flags[i]) { 47 | value v = caml_alloc_small(2, 0); 48 | Field(v, 0) = Val_int(i); 49 | Field(v, 1) = l; 50 | l = v; 51 | n &= ~ flags[i]; 52 | } 53 | End_roots(); 54 | return l; 55 | } 56 | 57 | mlsize_t camlidl_ptrarray_size(void ** array) 58 | { 59 | mlsize_t i; 60 | 61 | for (i = 0; array[i] != NULL; i++) /*nothing*/; 62 | return i; 63 | } 64 | 65 | /* Malloc-like allocation with en masse deallocation */ 66 | 67 | void camlidl_register_allocation(camlidl_free_function free_fn, 68 | void * block, 69 | camlidl_ctx ctx) 70 | { 71 | if (ctx->flags & CAMLIDL_TRANSIENT) { 72 | struct camlidl_block_list * l = 73 | caml_stat_alloc(sizeof(struct camlidl_block_list)); 74 | l->free_fn = free_fn; 75 | l->block = block; 76 | l->next = ctx->head; 77 | ctx->head = l; 78 | } 79 | } 80 | 81 | #ifdef _WIN32 82 | static void camlidl_task_mem_free(void * ptr) 83 | { 84 | CoTaskMemFree(ptr); 85 | } 86 | #endif 87 | 88 | void * camlidl_malloc(size_t sz, camlidl_ctx ctx) 89 | { 90 | #ifdef _WIN32 91 | void * res = CoTaskMemAlloc(sz); 92 | if (res == NULL) raise_out_of_memory(); 93 | camlidl_register_allocation(camlidl_task_mem_free, res, ctx); 94 | #else 95 | void * res = caml_stat_alloc(sz); 96 | camlidl_register_allocation(caml_stat_free, res, ctx); 97 | #endif 98 | return res; 99 | } 100 | 101 | void camlidl_free(camlidl_ctx ctx) 102 | { 103 | struct camlidl_block_list * arena, * tmp; 104 | for (arena = ctx->head; arena != NULL; /*nothing*/) { 105 | arena->free_fn(arena->block); 106 | tmp = arena; 107 | arena = arena->next; 108 | caml_stat_free(tmp); 109 | } 110 | } 111 | 112 | char * camlidl_malloc_string(value mlstring, camlidl_ctx ctx) 113 | { 114 | mlsize_t len = caml_string_length(mlstring); 115 | char * res = camlidl_malloc(len + 1, ctx); 116 | memcpy(res, String_val(mlstring), len + 1); 117 | return res; 118 | } 119 | 120 | /* This function is for compatibility with OCaml 2.00 and earlier */ 121 | 122 | #if defined(CAMLVERSION) && CAMLVERSION < 201 123 | 124 | value camlidl_alloc (mlsize_t wosize, tag_t tag) 125 | { 126 | value result; 127 | mlsize_t i; 128 | 129 | Assert (wosize > 0); 130 | if (wosize <= Max_young_wosize){ 131 | result = alloc (wosize, tag); 132 | if (tag < No_scan_tag){ 133 | for (i = 0; i < wosize; i++) Field (result, i) = 0; 134 | } 135 | }else{ 136 | result = caml_alloc_shr (wosize, tag); 137 | if (tag < No_scan_tag) memset (Bp_val (result), 0, Bsize_wsize (wosize)); 138 | result = check_urgent_gc (result); 139 | } 140 | return result; 141 | } 142 | 143 | #endif 144 | 145 | -------------------------------------------------------------------------------- /src/plplot.mli: -------------------------------------------------------------------------------- 1 | (* 2 | Copyright 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 . 18 | *) 19 | 20 | (** {1 PLplot - A library for creating scientific plots} *) 21 | 22 | (** {e Note:} The API for the {!Plot} and {!Quick_plot} modules is not yet 23 | fixed and may change between now and the 5.10.0 PLplot release. 24 | 25 | {!core} is {b not} expected to change. *) 26 | 27 | (** {3 A higher-level OCaml interface to PLplot} *) 28 | module Plot : 29 | sig 30 | 31 | (** {b THIS API IS NOT FIXED AND MAY CHANGE BEFORE THE 5.10.0 RELEASE} *) 32 | 33 | type side_t = [`top | `bottom | `left | `right] 34 | type 'a tagged_side_t = 35 | [`top of 'a | `bottom of 'a | `left of 'a | `right of 'a] 36 | (** The different sides of a (2D) plot. These values are used to 37 | represent, e.g., offsets along axes and text placement. *) 38 | 39 | (** These are the available options for drawing plot axes. These values 40 | map to individual letters provided to {!Plplot.plbox} and similar 41 | functions. *) 42 | type axis_options_t = 43 | [ `axis 44 | | `frame0 45 | | `frame1 46 | | `time 47 | | `fixed_point 48 | | `major_grid 49 | | `minor_grid 50 | | `invert_ticks 51 | | `log 52 | | `unconventional_label 53 | | `label 54 | | `custom_label 55 | | `minor_ticks 56 | | `minor_tick_count of int 57 | | `major_ticks 58 | | `major_tick_spacing of float 59 | | `vertical_label ] 60 | 61 | (** A plot stream. *) 62 | type stream_t 63 | 64 | (** Colors from the indexed color map (color map 0), from the 65 | [cmapo_alternate.pal] file! Note that these will NOT match up with 66 | colors from the default color palette! *) 67 | type color_t = 68 | [ `white 69 | | `red 70 | | `yellow 71 | | `green 72 | | `gray 73 | | `blue 74 | | `light_blue 75 | | `purple 76 | | `pink 77 | | `black 78 | | `brown 79 | | `index of int ] 80 | 81 | (** Different map outlines available for {!map} *) 82 | type map_t = 83 | [ `globe 84 | | `usa 85 | | `countries 86 | | `all ] 87 | 88 | (** Type signature for coordinate transform functions *) 89 | type pltr_t = float -> float -> float * float 90 | 91 | (** A plottable element, usable by the function {!plot}. *) 92 | type plot_t 93 | 94 | (** The different available plot device families. This is not a complete 95 | representation of all of the available devices provided by PLplot. *) 96 | type plot_device_family_t = 97 | [ `cairo 98 | | `qt 99 | | `core 100 | | `wx ] 101 | 102 | (** Plot devices. The constructor argument allows one to define which 103 | device family is used. *) 104 | type plot_device_t = 105 | [ `pdf of plot_device_family_t 106 | | `png of plot_device_family_t 107 | | `ps of plot_device_family_t 108 | | `svg of plot_device_family_t 109 | | `window of plot_device_family_t 110 | | `prompt (** Ask for the correct device to use at run-time *) 111 | | `stream of int (** Pre-defined plot streams *) 112 | | `other_device of string ] (** PLplot plotting devices otherwise not 113 | available from this list *) 114 | 115 | (** Type of scaling to use for plot axes, as in {!Plplot.plenv}. *) 116 | type plot_scaling_t = [ `preset | `greedy | `equal | `equal_square ] 117 | 118 | (** A color palette, usually loaded from disk *) 119 | type color_palette_t 120 | 121 | (** Line plotting styles/patterns. *) 122 | type line_style_t = 123 | [ `solid 124 | | `line1 | `line2 | `line3 | `line4 125 | | `line5 | `line6 | `line7 | `line8 (** These correspond to PLplot's 126 | pre-defined line styles as set by 127 | {!pllsty}. *) 128 | | `custom of ((int * int) list) ] (** A custom line style, with each 129 | (mark, space) pair defining the 130 | length of one segment and gap 131 | in the line drawing pattern. *) 132 | 133 | (** The default list of axis rendering options, used for all plots generated 134 | with {!init} if no custom options are provided. *) 135 | val default_axis_options : axis_options_t list 136 | 137 | (** Convert {!color_t} values to [r, g, b] integer values, each ranging in 138 | value from [0 - 255].*) 139 | val rgb_of_color : color_t -> int * int * int 140 | 141 | (** A recommended/standard file name extension, given a particular plot 142 | device. *) 143 | val recommended_extension : plot_device_t -> string 144 | 145 | (** {4 Plot streams}*) 146 | 147 | (** Make a new {!stream_t}, possibly using an existing plot stream index. 148 | If no [stream] argument is provided then a new plot stream is 149 | created. *) 150 | val make_stream : ?stream:int -> unit -> stream_t 151 | 152 | (** [start_page ?stream (x0, y0) (x1, y1) scaling] starts a new plot page 153 | with the given dimensions and scaling. *) 154 | val start_page : 155 | ?stream:stream_t -> 156 | float * float -> float * float -> plot_scaling_t -> unit 157 | 158 | (** An alias for {!start_page}. *) 159 | val next_page : 160 | ?stream:stream_t -> 161 | float * float -> float * float -> plot_scaling_t -> unit 162 | 163 | (** Create a new plot instance. See {!init} for a description of the 164 | parameters. *) 165 | val make : 166 | ?stream:stream_t -> 167 | ?filename:string -> 168 | ?size:int * int -> 169 | ?pre:(unit -> unit) -> 170 | plot_device_t -> stream_t 171 | 172 | (** [init ?filename ?size ?pages (x0, y0) (x1, y1) scale device] - Start a 173 | new plot stream for a 2D plot with plot axis extents given by [(x0, y0)] 174 | to [(x1, y1)]. A call to [init] is roughly equivalent to calling 175 | {!make} and then {!start_page}. 176 | @param filename Plot output filename. A suitable file extension 177 | will be added if it does not already exist. 178 | @param size Dimension of the plot in physical units (e.g., pixels 179 | for bitmap outputs (PNG, X) and 1/72 inch for vector 180 | outputs (PS, PDF, SVG) 181 | @param pages Layout of multiple plots on a single page 182 | @param pre This function, if provided, is called just before the plot 183 | instance is initialized. It can be used to, for example, 184 | load custom color palettes. *) 185 | val init : 186 | ?filename:string -> 187 | ?size:int * int -> 188 | ?pages:int * int -> 189 | ?pre:(unit -> unit) -> 190 | float * float -> float * float -> 191 | plot_scaling_t -> plot_device_t -> stream_t 192 | 193 | (** [with_stream ?stream f] performs [f] with [stream] as the active plot 194 | stream. If [stream] is not provided then the currently active plot 195 | stream is left active. Once [f] is complete, the previously active plot 196 | stream is restored. *) 197 | val with_stream : ?stream:stream_t -> (unit -> 'a) -> 'a 198 | 199 | (** [make_stream_active stream] makes [stream] in to the currently active 200 | plot stream for {!core} calls or any function which is not 201 | provided with an explicit [stream] argument. *) 202 | val make_stream_active : stream:stream_t -> unit 203 | 204 | (** {4 Colors} *) 205 | 206 | (** [set_color ?stream color] sets the current active plot color to 207 | [color]. *) 208 | val set_color : ?stream:stream_t -> color_t -> unit 209 | 210 | (** [set_color_scale ?stream ?pos ?alt_hue_path colors] sets the continuous color map 211 | (color map 1) to a scale determined by interpolating between [colors]. 212 | [pos] can be used to specify where in the color scale ([0.0 - 1.0]) the 213 | a color interpolation point should fall. [pos] defaults to even 214 | spacing. 215 | [alt_hue_path] can be used to specify that a given segment should be 216 | interpolated using the alternative hue path which always includes the 217 | hue=0 point. 218 | {!Plplot.plscmap1l} is used internally to set the color scale. *) 219 | val set_color_scale : 220 | ?stream:stream_t -> 221 | ?pos:float array -> 222 | ?alt_hue_path:bool array -> 223 | color_t array -> unit 224 | 225 | (** PLplot has two color palettes - indexed (color map 0) and 226 | continuous (color map 1). These functions can be used with 227 | {!load_palette} to set custom indexed and continuous color palettes. *) 228 | val indexed_palette : string -> color_palette_t 229 | 230 | (** [continuous_palette ?interpolate filename] - If [interpolate] is true 231 | (the default) then a smooth palette is generated using the color 232 | definitions in the palette file [filename]. Otherwise, the colors 233 | are considered to be discrete, giving a segmented palette. *) 234 | val continuous_palette : ?interpolate:bool -> string -> color_palette_t 235 | 236 | (** [load_palette ?stream palette] loads either indexed or continuous 237 | color palette information from a file on disk. *) 238 | val load_palette : ?stream:stream_t -> color_palette_t -> unit 239 | 240 | (** {4 Plot elements} *) 241 | 242 | (** [arc ?fill color x y a b angle0 angle1 rotate] *) 243 | val arc : 244 | ?fill:bool -> 245 | color_t -> float -> float -> float -> float -> float -> float -> float -> 246 | plot_t 247 | 248 | (** [axes ?color ?style ?width xopt yopt] *) 249 | val axes : 250 | ?color:color_t -> 251 | ?style:line_style_t -> 252 | ?width:float -> 253 | ?labelfunc:([`x | `y | `z] -> float -> string) -> 254 | axis_options_t list -> axis_options_t list -> plot_t 255 | 256 | (** [default_axes] is equivalent to 257 | [axes default_axis_options default_axis_options] *) 258 | val default_axes : plot_t 259 | 260 | (** [circle ?fill color x y r] *) 261 | val circle : ?fill:bool -> color_t -> float -> float -> float -> plot_t 262 | 263 | (** [contours color tranform_func contours data] *) 264 | val contours : 265 | color_t -> pltr_t -> float array -> float array array -> plot_t 266 | 267 | (** [image ?range (x0, y0) (x1, y1) data] *) 268 | val image : 269 | ?range:float * float -> 270 | float * float -> float * float -> float array array -> plot_t 271 | 272 | (** [imagefr ?range ~scale (x0, y0) (x1, y1) data] *) 273 | val imagefr : 274 | ?range:float * float -> 275 | scale:float * float -> 276 | float * float -> float * float -> float array array -> plot_t 277 | 278 | (** [join ?style color (x0, y0) (x1, y1)] *) 279 | val join : 280 | ?style:line_style_t -> 281 | ?width:float -> 282 | color_t -> float * float -> float * float -> plot_t 283 | 284 | (** [label ?color x_label y_label title] adds axis labels and a title. *) 285 | val label : ?color:color_t -> string -> string -> string -> plot_t 286 | 287 | (** [lines ?label ?style color xs ys] *) 288 | val lines : 289 | ?label:string -> 290 | ?style:line_style_t -> 291 | ?width:float -> 292 | color_t -> float array -> float array -> plot_t 293 | 294 | (** [map ?sw ?ne color outline_type] *) 295 | val map : 296 | ?sw:float * float -> ?ne:float * float -> color_t -> map_t -> plot_t 297 | 298 | (** [points ?label ?symbol ?scale color xs ys] *) 299 | val points : 300 | ?label:string -> 301 | ?symbol:string -> 302 | ?scale:float -> 303 | color_t -> float array -> float array -> plot_t 304 | 305 | (** [polygon ?fill color xs ys] *) 306 | val polygon : 307 | ?fill:bool -> color_t -> float array -> float array -> plot_t 308 | 309 | (** [rectangle ?fill color (x0, y0) (x1, y1)] *) 310 | val rectangle : 311 | ?fill:bool -> color_t -> float * float -> float * float -> plot_t 312 | 313 | (** [shades ?fill_width ?contour ?rect (x0, y0) (x1, y1) contours data] *) 314 | val shades : 315 | ?fill_width:float -> 316 | ?contour:color_t * float -> 317 | ?rect:bool -> 318 | float * float -> float * float -> 319 | float array -> float array array -> plot_t 320 | 321 | (** [text ?dx ?dy ?just color x y string ] writes the text [string] inside 322 | the plot window, at an optional angle defined by the offsets [dx] and 323 | [dy]. *) 324 | val text : 325 | ?dx:float -> 326 | ?dy:float -> 327 | ?just:float -> 328 | color_t -> float -> float -> string -> plot_t 329 | 330 | (** [text_outside ?just ?perp color side offset string] writes text 331 | outside of the plot window, along [side], displaced from the axis by 332 | [offset] * character height. *) 333 | val text_outside : 334 | ?just:float -> 335 | ?perp:bool -> 336 | color_t -> float tagged_side_t -> float -> string -> plot_t 337 | 338 | (** [func ?symbol ?step color f (min, max)] plots the function [f] from 339 | [x = min] to [x = max]. [step] can be used to tighten or coarsen the 340 | sampling of plot points. *) 341 | val func : 342 | ?symbol:string -> 343 | ?step:float -> 344 | color_t -> (float -> float) -> float * float -> plot_t 345 | 346 | (** [transform f] sets the universal coordinate transformation function. *) 347 | val transform : pltr_t -> plot_t 348 | 349 | (** [clear_transform] clears any currently defined universal coordinate 350 | transform function. *) 351 | val clear_transform : plot_t 352 | 353 | (** [pltr f] sets the coordinate transformation function used by 354 | {!imagefr} and other functions affected by {!Plplot.plset_pltr}. *) 355 | val pltr : pltr_t -> plot_t 356 | 357 | (** [clear_pltr] clears any currently defined function-specific pltr 358 | transform function. *) 359 | val clear_pltr : plot_t 360 | 361 | (** [custom f] will call [f ()] when the plot element is used. This 362 | function can be used to create customized plot elements for use with 363 | {!plot}. *) 364 | val custom : (unit -> unit) -> plot_t 365 | 366 | (** [list l] makes a plot element from a list of plot elements, allowing, 367 | for example, a plot to be created piece-by-piece before being 368 | rendered. *) 369 | val list : plot_t list -> plot_t 370 | 371 | (** [maybe m_p] will plot the contents of [m_p]. If [m_p] is [None] then 372 | this is effectively a no-op. *) 373 | val maybe : plot_t option -> plot_t 374 | 375 | (** Plot a list of plottable elements *) 376 | val plot : ?stream:stream_t -> plot_t list -> unit 377 | 378 | (** {4 Support functions} *) 379 | 380 | (** Character height in world coordinate units *) 381 | val character_height : ?stream:stream_t -> unit -> float 382 | 383 | (** Positioning within viewport or subpage *) 384 | type position_t 385 | 386 | (** Position relative to the plot viewport *) 387 | val viewport_pos : 388 | ?side1:side_t -> 389 | ?side2:side_t -> ?inside:bool -> float -> float -> position_t 390 | 391 | (** Position relative to the plot subpage *) 392 | val subpage_pos : 393 | ?side1:side_t -> 394 | ?side2:side_t -> ?inside:bool -> float -> float -> position_t 395 | 396 | (** Legend entry *) 397 | type legend_entry_t 398 | 399 | (** Layout of elements *) 400 | type 'a layout_t 401 | 402 | (** Empty legend entry *) 403 | val no_legend : legend_entry_t 404 | 405 | (** Color-filled box legend entry *) 406 | val box_legend : 407 | ?pattern:int -> 408 | ?scale:float -> 409 | ?line_width:float -> 410 | ?label_color:color_t -> label:string -> color_t -> legend_entry_t 411 | 412 | (** Line legend entry *) 413 | val line_legend : 414 | ?style:int -> 415 | ?width:float -> 416 | ?label_color:color_t -> label:string -> color_t -> legend_entry_t 417 | 418 | (** Symbol/point legend entry *) 419 | val symbol_legend : 420 | ?scale:float -> 421 | ?number:int -> 422 | ?label_color:color_t -> 423 | label:string -> color_t -> string -> legend_entry_t 424 | 425 | (** Row-major layout *) 426 | val row_major : 'a -> 'b -> ('a * 'b) layout_t 427 | 428 | (** Column-major layout *) 429 | val column_major : 'a -> 'b -> ('a * 'b) layout_t 430 | 431 | (** [legend entries] *) 432 | val legend : 433 | ?pos:position_t -> 434 | ?plot_width:float -> 435 | ?bg:color_t -> 436 | ?bb:color_t * line_style_t -> 437 | ?layout:(int * int) layout_t -> 438 | ?color:color_t -> 439 | ?text_offset:float -> 440 | ?text_scale:float -> 441 | ?text_spacing:float -> 442 | ?text_justification:float -> 443 | ?text_left:bool -> legend_entry_t list list -> plot_t 444 | 445 | (** Colorbar axis definitions *) 446 | type colorbar_axis_t 447 | 448 | (** Available colorbar kinds *) 449 | type colorbar_kind_t 450 | 451 | (** [colorbar_axis ?axis values] creates a {!colorbar_axis_t} with the 452 | given axis options and range values. *) 453 | val colorbar_axis : 454 | ?axis:axis_options_t list -> float array -> colorbar_axis_t 455 | 456 | (** [gradient_colorbar ?axis [|min; max|]] from [min] to [max] *) 457 | val gradient_colorbar : 458 | ?axis:axis_options_t list -> float array -> colorbar_kind_t 459 | 460 | (** [image_colorbar ?axis [|min; max|]] from [min] to [max] *) 461 | val image_colorbar : 462 | ?axis:axis_options_t list -> float array -> colorbar_kind_t 463 | 464 | (** [shade_colorbar ?custom ?axis contours] defines a shaded contour 465 | colorbar with axis labels at even spacings ([custom = false]) or at the 466 | locations of the values in [contours] ([custom = true] - the 467 | default). *) 468 | val shade_colorbar : 469 | ?custom:bool -> 470 | ?axis:axis_options_t list -> 471 | float array -> colorbar_kind_t 472 | 473 | (** Default options used for a colorbar axis *) 474 | val default_colorbar_axis : axis_options_t list 475 | 476 | (** [colorbar colorbar_kind] *) 477 | val colorbar : 478 | ?pos:position_t -> 479 | ?bg:color_t -> 480 | ?bb:color_t * line_style_t -> 481 | ?cap:float option * float option -> 482 | ?contour:color_t * float -> 483 | ?orient:(float * float) tagged_side_t -> 484 | ?axis:colorbar_axis_t list -> 485 | ?label:string tagged_side_t list -> 486 | ?color:color_t -> ?scale:float -> 487 | colorbar_kind_t -> plot_t 488 | 489 | (** Draw the plot axes on the current plot page *) 490 | val plot_axes : 491 | ?stream:stream_t -> 492 | axis_options_t list -> axis_options_t list -> unit 493 | 494 | (** {4 Finishing up a plot page} *) 495 | 496 | (** [end_stream ?stream ()] ends [stream]. This or {!finish} should be 497 | called once all plotting is complete. *) 498 | val end_stream : ?stream:stream_t -> unit -> unit 499 | 500 | (** [finish ?stream ()] draws default x and y axes, then closes [stream]. *) 501 | val finish : ?stream:stream_t -> unit -> unit 502 | end 503 | 504 | (** {3 A module for quick, "throw-away" plots} *) 505 | module Quick_plot : 506 | sig 507 | 508 | (** {b THIS API IS NOT FIXED AND MAY CHANGE BEFORE THE 5.10.0 RELEASE} *) 509 | 510 | (** [points xs ys] plots the points described by the coordinates [xs] 511 | and [ys]. *) 512 | val points : 513 | ?filename:string -> 514 | ?size:int * int -> 515 | ?device:Plot.plot_device_t -> 516 | ?labels:string * string * string -> 517 | ?names:string list -> 518 | ?log:bool * bool -> (float array * float array) list -> unit 519 | 520 | (** [lines xs ys] plots the line segments described by the coordinates 521 | [xs] and [ys]. *) 522 | val lines : 523 | ?filename:string -> 524 | ?size:int * int -> 525 | ?device:Plot.plot_device_t -> 526 | ?labels:string * string * string -> 527 | ?names:string list -> 528 | ?log:bool * bool -> (float array * float array) list -> unit 529 | 530 | (** [image ?log m] plots the image [m] with a matching colorbar. If [log] 531 | is true then the data in [m] are assumed to be [log10(x)] values. *) 532 | val image : 533 | ?filename:string -> 534 | ?size:int * int -> 535 | ?device:Plot.plot_device_t -> 536 | ?labels:string * string * string -> 537 | ?log:bool -> ?palette:Plot.color_palette_t -> float array array -> unit 538 | 539 | (** [func ?point ?step fs (min, max)] plots the functions [fs] from 540 | [x = min] to [x = max]. [step] can be used to tighten or coarsen the 541 | sampling of plot points. *) 542 | val func : 543 | ?filename:string -> 544 | ?size:int * int -> 545 | ?device:Plot.plot_device_t -> 546 | ?labels:string * string * string -> 547 | ?names:string list -> 548 | ?symbol:string -> 549 | ?step:float -> (float -> float) list -> float * float -> unit 550 | 551 | (** [shades ?log ?contours m] plots a filled contour/shaded [m] with a 552 | matching colorbar. If [log] is true then the data in [m] are assumed 553 | to be [log10(x)] values. *) 554 | val shades : 555 | ?filename:string -> 556 | ?size:int * int -> 557 | ?device:Plot.plot_device_t -> 558 | ?labels:string * string * string -> 559 | ?log:bool -> 560 | ?palette:Plot.color_palette_t -> 561 | ?contours:float array -> float array array -> unit 562 | end 563 | 564 | (** {3:core The standard PLplot API} *) 565 | 566 | (** See the main PLplot documentation for the description and documentation of 567 | these functions. *) 568 | 569 | type plplot_axis_type = 570 | PL_X_AXIS 571 | | PL_Y_AXIS 572 | | PL_Z_AXIS 573 | and plplot3d_style_enum = 574 | PL_DIFFUSE 575 | | PL_DRAW_LINEX 576 | | PL_DRAW_LINEY 577 | | PL_DRAW_LINEXY 578 | | PL_MAG_COLOR 579 | | PL_BASE_CONT 580 | | PL_TOP_CONT 581 | | PL_SURF_CONT 582 | | PL_DRAW_SIDES 583 | | PL_FACETED 584 | | PL_MESH 585 | and plplot3d_style = plplot3d_style_enum list 586 | and plplot_bin_enum = 587 | PL_BIN_DEFAULT 588 | | PL_BIN_CENTRED 589 | | PL_BIN_NOEXPAND 590 | | PL_BIN_NOEMPTY 591 | and plplot_bin_style = plplot_bin_enum list 592 | and plplot_hist_enum = 593 | PL_HIST_DEFAULT 594 | | PL_HIST_NOSCALING 595 | | PL_HIST_IGNORE_OUTLIERS 596 | | PL_HIST_NOEXPAND 597 | | PL_HIST_NOEMPTY 598 | and plplot_hist_style = plplot_hist_enum list 599 | and plplot_run_level_enum = 600 | | PL_UNINITIALIZED 601 | | PL_INITIALIZED 602 | | PL_VIEWPORT_DEFINED 603 | | PL_WORLD_COORDINATES_DEFINED 604 | and plplot_run_level = plplot_run_level_enum 605 | and plplot_position_enum = 606 | PL_POSITION_LEFT 607 | | PL_POSITION_RIGHT 608 | | PL_POSITION_TOP 609 | | PL_POSITION_BOTTOM 610 | | PL_POSITION_INSIDE 611 | | PL_POSITION_OUTSIDE 612 | | PL_POSITION_VIEWPORT 613 | | PL_POSITION_SUBPAGE 614 | and plplot_position_opt = plplot_position_enum list 615 | and plplot_legend_enum = 616 | PL_LEGEND_NONE 617 | | PL_LEGEND_COLOR_BOX 618 | | PL_LEGEND_LINE 619 | | PL_LEGEND_SYMBOL 620 | | PL_LEGEND_TEXT_LEFT 621 | | PL_LEGEND_BACKGROUND 622 | | PL_LEGEND_BOUNDING_BOX 623 | | PL_LEGEND_ROW_MAJOR 624 | and plplot_legend_opt = plplot_legend_enum list 625 | and plplot_colorbar_enum = 626 | | PL_COLORBAR_LABEL_LEFT 627 | | PL_COLORBAR_LABEL_RIGHT 628 | | PL_COLORBAR_LABEL_TOP 629 | | PL_COLORBAR_LABEL_BOTTOM 630 | | PL_COLORBAR_IMAGE 631 | | PL_COLORBAR_SHADE 632 | | PL_COLORBAR_GRADIENT 633 | | PL_COLORBAR_CAP_NONE 634 | | PL_COLORBAR_CAP_LOW 635 | | PL_COLORBAR_CAP_HIGH 636 | | PL_COLORBAR_SHADE_LABEL 637 | | PL_COLORBAR_ORIENT_RIGHT 638 | | PL_COLORBAR_ORIENT_TOP 639 | | PL_COLORBAR_ORIENT_LEFT 640 | | PL_COLORBAR_ORIENT_BOTTOM 641 | | PL_COLORBAR_BACKGROUND 642 | | PL_COLORBAR_BOUNDING_BOX 643 | and plplot_colorbar_opt = plplot_colorbar_enum list 644 | and plplot_fci_family_enum = 645 | | PL_FCI_FAMILY_UNCHANGED 646 | | PL_FCI_SANS 647 | | PL_FCI_SERIF 648 | | PL_FCI_MONO 649 | | PL_FCI_SCRIPT 650 | | PL_FCI_SYMBOL 651 | and plplot_fci_style_enum = 652 | | PL_FCI_STYLE_UNCHANGED 653 | | PL_FCI_UPRIGHT 654 | | PL_FCI_ITALIC 655 | | PL_FCI_OBLIQUE 656 | and plplot_fci_weight_enum = 657 | | PL_FCI_WEIGHT_UNCHANGED 658 | | PL_FCI_MEDIUM 659 | | PL_FCI_BOLD 660 | and plplot_draw_mode_enum = 661 | | PL_DRAWMODE_UNKNOWN 662 | | PL_DRAWMODE_DEFAULT 663 | | PL_DRAWMODE_REPLACE 664 | | PL_DRAWMODE_XOR 665 | external pl_setcontlabelformat : int -> int -> unit 666 | = "camlidl_plplot_core_c_pl_setcontlabelformat" 667 | external pl_setcontlabelparam : float -> float -> float -> int -> unit 668 | = "camlidl_plplot_core_c_pl_setcontlabelparam" 669 | external pladv : int -> unit = "camlidl_plplot_core_c_pladv" 670 | external plarc : 671 | float -> float -> float -> float -> float -> float -> float -> bool -> unit 672 | = "camlidl_plplot_core_c_plarc_bytecode" "camlidl_plplot_core_c_plarc" 673 | external plaxes : 674 | float -> float -> string -> float -> int -> string -> float -> int -> unit 675 | = "camlidl_plplot_core_c_plaxes_bytecode" "camlidl_plplot_core_c_plaxes" 676 | external plbin : float array -> float array -> plplot_bin_style -> unit 677 | = "camlidl_plplot_core_c_plbin" 678 | external plbtime : float -> int * int * int * int * int * float 679 | = "camlidl_plplot_core_c_plbtime" 680 | external plbop : unit -> unit = "camlidl_plplot_core_c_plbop" 681 | external plbox : string -> float -> int -> string -> float -> int -> unit 682 | = "camlidl_plplot_core_c_plbox_bytecode" "camlidl_plplot_core_c_plbox" 683 | external plbox3 : 684 | string -> 685 | string -> 686 | float -> 687 | int -> 688 | string -> 689 | string -> float -> int -> string -> string -> float -> int -> unit 690 | = "camlidl_plplot_core_c_plbox3_bytecode" "camlidl_plplot_core_c_plbox3" 691 | external plcalc_world : float -> float -> float * float * int 692 | = "camlidl_plplot_core_c_plcalc_world" 693 | external plclear : unit -> unit = "camlidl_plplot_core_c_plclear" 694 | external plcol0 : int -> unit = "camlidl_plplot_core_c_plcol0" 695 | external plcol1 : float -> unit = "camlidl_plplot_core_c_plcol1" 696 | external plconfigtime : 697 | float -> 698 | float -> 699 | float -> int -> bool -> int -> int -> int -> int -> int -> float -> unit 700 | = "camlidl_plplot_core_c_plconfigtime_bytecode" 701 | "camlidl_plplot_core_c_plconfigtime" 702 | external plcpstrm : int -> bool -> unit = "camlidl_plplot_core_c_plcpstrm" 703 | external plctime : int -> int -> int -> int -> int -> float -> float 704 | = "camlidl_plplot_core_c_plctime_bytecode" "camlidl_plplot_core_c_plctime" 705 | external plend : unit -> unit = "camlidl_plplot_core_c_plend" 706 | external plend1 : unit -> unit = "camlidl_plplot_core_c_plend1" 707 | external plenv : float -> float -> float -> float -> int -> int -> unit 708 | = "camlidl_plplot_core_c_plenv_bytecode" "camlidl_plplot_core_c_plenv" 709 | external plenv0 : float -> float -> float -> float -> int -> int -> unit 710 | = "camlidl_plplot_core_c_plenv0_bytecode" "camlidl_plplot_core_c_plenv0" 711 | external pleop : unit -> unit = "camlidl_plplot_core_c_pleop" 712 | external plerrx : float array -> float array -> float array -> unit 713 | = "camlidl_plplot_core_c_plerrx" 714 | external plerry : float array -> float array -> float array -> unit 715 | = "camlidl_plplot_core_c_plerry" 716 | external plfamadv : unit -> unit = "camlidl_plplot_core_c_plfamadv" 717 | external plfill : float array -> float array -> unit 718 | = "camlidl_plplot_core_c_plfill" 719 | external plfill3 : float array -> float array -> float array -> unit 720 | = "camlidl_plplot_core_c_plfill3" 721 | external plflush : unit -> unit = "camlidl_plplot_core_c_plflush" 722 | external plfont : int -> unit = "camlidl_plplot_core_c_plfont" 723 | external plfontld : int -> unit = "camlidl_plplot_core_c_plfontld" 724 | external plgchr : unit -> float * float = "camlidl_plplot_core_c_plgchr" 725 | external plgcmap1_range : unit -> float * float = 726 | "camlidl_plplot_core_c_plgcmap1_range" 727 | external plgcol0 : int -> int * int * int = "camlidl_plplot_core_c_plgcol0" 728 | external plgcol0a : int -> int * int * int * float 729 | = "camlidl_plplot_core_c_plgcol0a" 730 | external plgcolbg : unit -> int * int * int 731 | = "camlidl_plplot_core_c_plgcolbg" 732 | external plgcolbga : unit -> int * int * int * float 733 | = "camlidl_plplot_core_c_plgcolbga" 734 | external plgcompression : unit -> int 735 | = "camlidl_plplot_core_c_plgcompression" 736 | external plgdev : unit -> string = "camlidl_plplot_core_c_plgdev" 737 | external plgdidev : unit -> float * float * float * float 738 | = "camlidl_plplot_core_c_plgdidev" 739 | external plgdiori : unit -> float = "camlidl_plplot_core_c_plgdiori" 740 | external plgdiplt : unit -> float * float * float * float 741 | = "camlidl_plplot_core_c_plgdiplt" 742 | external plgdrawmode : unit -> plplot_draw_mode_enum 743 | = "camlidl_plplot_core_c_plgdrawmode" 744 | external plgfci : unit -> int64 = "camlidl_plplot_core_c_plgfci" 745 | external plgfam : unit -> int * int * int = "camlidl_plplot_core_c_plgfam" 746 | external plgfnam : unit -> string = "camlidl_plplot_core_c_plgfnam" 747 | external plgfont : unit -> int * int * int = "camlidl_plplot_core_c_plgfont" 748 | external plglevel : unit -> plplot_run_level = "camlidl_plplot_core_c_plglevel" 749 | external plgpage : unit -> float * float * int * int * int * int 750 | = "camlidl_plplot_core_c_plgpage" 751 | external plgra : unit -> unit = "camlidl_plplot_core_c_plgra" 752 | external plgradient : float array -> float array -> float -> unit 753 | = "camlidl_plplot_core_c_plgradient" 754 | external plgspa : unit -> float * float * float * float 755 | = "camlidl_plplot_core_c_plgspa" 756 | external plgstrm : unit -> int = "camlidl_plplot_core_c_plgstrm" 757 | external plgver : unit -> string = "camlidl_plplot_core_c_plgver" 758 | external plgvpd : unit -> float * float * float * float 759 | = "camlidl_plplot_core_c_plgvpd" 760 | external plgvpw : unit -> float * float * float * float 761 | = "camlidl_plplot_core_c_plgvpw" 762 | external plgxax : unit -> int * int = "camlidl_plplot_core_c_plgxax" 763 | external plgyax : unit -> int * int = "camlidl_plplot_core_c_plgyax" 764 | external plgzax : unit -> int * int = "camlidl_plplot_core_c_plgzax" 765 | external plhist : 766 | float array -> float -> float -> int -> plplot_hist_style -> unit 767 | = "camlidl_plplot_core_c_plhist" 768 | external plhlsrgb : float -> float -> float -> float * float * float 769 | = "camlidl_plplot_core_c_plhlsrgb" 770 | external plinit : unit -> unit = "camlidl_plplot_core_c_plinit" 771 | external pljoin : float -> float -> float -> float -> unit 772 | = "camlidl_plplot_core_c_pljoin" 773 | external pllab : string -> string -> string -> unit 774 | = "camlidl_plplot_core_c_pllab" 775 | external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> 776 | float -> float -> float -> int -> int -> int -> float -> float -> int -> 777 | float -> plplot_colorbar_opt array -> string array -> 778 | string array -> float array -> int array -> float array array -> 779 | float * float 780 | = "ml_plcolorbar_byte" "ml_plcolorbar" 781 | external pllegend : plplot_legend_opt -> plplot_position_opt -> 782 | float -> float -> float -> int -> int -> int -> int -> int -> 783 | plplot_legend_opt array -> float -> float -> 784 | float -> float -> int array -> string array -> int array -> int array -> 785 | float array -> float array -> int array -> int array -> float array -> 786 | int array -> float array -> int array -> string array -> float * float 787 | = "ml_pllegend_byte" "ml_pllegend" 788 | external pllightsource : float -> float -> float -> unit 789 | = "camlidl_plplot_core_c_pllightsource" 790 | external plline : float array -> float array -> unit 791 | = "camlidl_plplot_core_c_plline" 792 | external plline3 : float array -> float array -> float array -> unit 793 | = "camlidl_plplot_core_c_plline3" 794 | external pllsty : int -> unit = "camlidl_plplot_core_c_pllsty" 795 | external plmesh : 796 | float array -> float array -> float array array -> plplot3d_style -> unit 797 | = "camlidl_plplot_core_c_plmesh" 798 | external plmeshc : 799 | float array -> 800 | float array -> float array array -> plplot3d_style -> float array -> unit 801 | = "camlidl_plplot_core_c_plmeshc" 802 | external plmkstrm : unit -> int = "camlidl_plplot_core_c_plmkstrm" 803 | external plmtex : string -> float -> float -> float -> string -> unit 804 | = "camlidl_plplot_core_c_plmtex" 805 | external plmtex3 : string -> float -> float -> float -> string -> unit 806 | = "camlidl_plplot_core_c_plmtex3" 807 | external plot3d : 808 | float array -> 809 | float array -> float array array -> plplot3d_style -> bool -> unit 810 | = "camlidl_plplot_core_c_plot3d" 811 | external plot3dc : 812 | float array -> 813 | float array -> float array array -> plplot3d_style -> float array -> unit 814 | = "camlidl_plplot_core_c_plot3dc" 815 | external plpat : int array -> int array -> unit 816 | = "camlidl_plplot_core_c_plpat" 817 | external plpath : int -> float -> float -> float -> float -> unit 818 | = "camlidl_plplot_core_c_plpath" 819 | external plpoin : float array -> float array -> int -> unit 820 | = "camlidl_plplot_core_c_plpoin" 821 | external plpoin3 : float array -> float array -> float array -> int -> unit 822 | = "camlidl_plplot_core_c_plpoin3" 823 | external plprec : int -> int -> unit = "camlidl_plplot_core_c_plprec" 824 | external plpsty : int -> unit = "camlidl_plplot_core_c_plpsty" 825 | external plptex : float -> float -> float -> float -> float -> string -> unit 826 | = "camlidl_plplot_core_c_plptex_bytecode" "camlidl_plplot_core_c_plptex" 827 | external plptex3 : 828 | float -> 829 | float -> 830 | float -> 831 | float -> 832 | float -> float -> float -> float -> float -> float -> string -> unit 833 | = "camlidl_plplot_core_c_plptex3_bytecode" "camlidl_plplot_core_c_plptex3" 834 | external plrandd : unit -> float = "camlidl_plplot_core_c_plrandd" 835 | external plreplot : unit -> unit = "camlidl_plplot_core_c_plreplot" 836 | external plrgbhls : float -> float -> float -> float * float * float 837 | = "camlidl_plplot_core_c_plrgbhls" 838 | external plschr : float -> float -> unit = "camlidl_plplot_core_c_plschr" 839 | external plscmap0 : int array -> int array -> int array -> unit 840 | = "camlidl_plplot_core_c_plscmap0" 841 | external plscmap0a : 842 | int array -> int array -> int array -> float array -> unit 843 | = "camlidl_plplot_core_c_plscmap0a" 844 | external plscmap0n : int -> unit = "camlidl_plplot_core_c_plscmap0n" 845 | external plscmap1 : int array -> int array -> int array -> unit 846 | = "camlidl_plplot_core_c_plscmap1" 847 | external plscmap1a : 848 | int array -> int array -> int array -> float array -> unit 849 | = "camlidl_plplot_core_c_plscmap1a" 850 | external plscmap1l : 851 | bool -> 852 | float array -> 853 | float array -> float array -> float array -> bool array option -> unit 854 | = "camlidl_plplot_core_c_plscmap1l_bytecode" 855 | "camlidl_plplot_core_c_plscmap1l" 856 | external plscmap1la : 857 | bool -> 858 | float array -> 859 | float array -> 860 | float array -> float array -> float array -> bool array option -> unit 861 | = "camlidl_plplot_core_c_plscmap1la_bytecode" 862 | "camlidl_plplot_core_c_plscmap1la" 863 | external plscmap1n : int -> unit = "camlidl_plplot_core_c_plscmap1n" 864 | external plscmap1_range : float -> float -> unit = 865 | "camlidl_plplot_core_c_plscmap1_range" 866 | external plscol0 : int -> int -> int -> int -> unit 867 | = "camlidl_plplot_core_c_plscol0" 868 | external plscol0a : int -> int -> int -> int -> float -> unit 869 | = "camlidl_plplot_core_c_plscol0a" 870 | external plscolbg : int -> int -> int -> unit 871 | = "camlidl_plplot_core_c_plscolbg" 872 | external plscolbga : int -> int -> int -> float -> unit 873 | = "camlidl_plplot_core_c_plscolbga" 874 | external plscolor : int -> unit = "camlidl_plplot_core_c_plscolor" 875 | external plscompression : int -> unit 876 | = "camlidl_plplot_core_c_plscompression" 877 | external plsdev : string -> unit = "camlidl_plplot_core_c_plsdev" 878 | external plsdidev : float -> float -> float -> float -> unit 879 | = "camlidl_plplot_core_c_plsdidev" 880 | external plsdimap : int -> int -> int -> int -> float -> float -> unit 881 | = "camlidl_plplot_core_c_plsdimap_bytecode" 882 | "camlidl_plplot_core_c_plsdimap" 883 | external plsdiori : float -> unit = "camlidl_plplot_core_c_plsdiori" 884 | external plsdiplt : float -> float -> float -> float -> unit 885 | = "camlidl_plplot_core_c_plsdiplt" 886 | external plsdiplz : float -> float -> float -> float -> unit 887 | = "camlidl_plplot_core_c_plsdiplz" 888 | external plseed : int64 -> unit = "camlidl_plplot_core_c_plseed" 889 | external plsesc : char -> unit = "camlidl_plplot_core_c_plsesc" 890 | external plsfam : int -> int -> int -> unit = "camlidl_plplot_core_c_plsfam" 891 | external plsfci : int64 -> unit = "camlidl_plplot_core_c_plsfci" 892 | external plsfnam : string -> unit = "camlidl_plplot_core_c_plsfnam" 893 | external plsfont : plplot_fci_family_enum -> plplot_fci_style_enum -> 894 | plplot_fci_weight_enum -> unit 895 | = "camlidl_plplot_core_c_plsfont" 896 | external plsmaj : float -> float -> unit = "camlidl_plplot_core_c_plsmaj" 897 | external plsmin : float -> float -> unit = "camlidl_plplot_core_c_plsmin" 898 | external plsdrawmode : plplot_draw_mode_enum -> unit 899 | = "camlidl_plplot_core_c_plsdrawmode" 900 | external plsori : int -> unit = "camlidl_plplot_core_c_plsori" 901 | external plspage : float -> float -> int -> int -> int -> int -> unit 902 | = "camlidl_plplot_core_c_plspage_bytecode" "camlidl_plplot_core_c_plspage" 903 | external plspal0 : string -> unit = "camlidl_plplot_core_c_plspal0" 904 | external plspal1 : string -> bool -> unit = "camlidl_plplot_core_c_plspal1" 905 | external plspause : bool -> unit = "camlidl_plplot_core_c_plspause" 906 | external plsstrm : int -> unit = "camlidl_plplot_core_c_plsstrm" 907 | external plssub : int -> int -> unit = "camlidl_plplot_core_c_plssub" 908 | external plssym : float -> float -> unit = "camlidl_plplot_core_c_plssym" 909 | external plstar : int -> int -> unit = "camlidl_plplot_core_c_plstar" 910 | external plstart : string -> int -> int -> unit 911 | = "camlidl_plplot_core_c_plstart" 912 | external plstring : float array -> float array -> string -> unit 913 | = "camlidl_plplot_core_c_plstring" 914 | external plstring3 : float array -> float array -> float array -> string -> unit 915 | = "camlidl_plplot_core_c_plstring3" 916 | external plstripa : int -> int -> float -> float -> unit 917 | = "camlidl_plplot_core_c_plstripa" 918 | external plstripd : int -> unit = "camlidl_plplot_core_c_plstripd" 919 | external plimage : 920 | float array array -> 921 | float -> 922 | float -> 923 | float -> 924 | float -> float -> float -> float -> float -> float -> float -> unit 925 | = "camlidl_plplot_core_c_plimage_bytecode" "camlidl_plplot_core_c_plimage" 926 | external plstyl : int array -> int array -> unit 927 | = "camlidl_plplot_core_c_plstyl" 928 | external plsurf3d : 929 | float array -> 930 | float array -> float array array -> plplot3d_style -> float array -> unit 931 | = "camlidl_plplot_core_c_plsurf3d" 932 | external plsvect : float array -> float array -> bool -> unit 933 | = "camlidl_plplot_core_c_plsvect" 934 | external plsvpa : float -> float -> float -> float -> unit 935 | = "camlidl_plplot_core_c_plsvpa" 936 | external plsxax : int -> int -> unit = "camlidl_plplot_core_c_plsxax" 937 | external plsxwin : int -> unit = "camlidl_plplot_core_plsxwin" 938 | external plsyax : int -> int -> unit = "camlidl_plplot_core_c_plsyax" 939 | external plsym : float array -> float array -> int -> unit 940 | = "camlidl_plplot_core_c_plsym" 941 | external plszax : int -> int -> unit = "camlidl_plplot_core_c_plszax" 942 | external pltext : unit -> unit = "camlidl_plplot_core_c_pltext" 943 | external pltimefmt : string -> unit = "camlidl_plplot_core_c_pltimefmt" 944 | external plvasp : float -> unit = "camlidl_plplot_core_c_plvasp" 945 | external plvpas : float -> float -> float -> float -> float -> unit 946 | = "camlidl_plplot_core_c_plvpas" 947 | external plvpor : float -> float -> float -> float -> unit 948 | = "camlidl_plplot_core_c_plvpor" 949 | external plvsta : unit -> unit = "camlidl_plplot_core_c_plvsta" 950 | external plw3d : 951 | float -> 952 | float -> 953 | float -> 954 | float -> 955 | float -> float -> float -> float -> float -> float -> float -> unit 956 | = "camlidl_plplot_core_c_plw3d_bytecode" "camlidl_plplot_core_c_plw3d" 957 | external plwidth : float -> unit = "camlidl_plplot_core_c_plwidth" 958 | external plwind : float -> float -> float -> float -> unit 959 | = "camlidl_plplot_core_c_plwind" 960 | external plxormod : bool -> bool = "camlidl_plplot_core_c_plxormod" 961 | external plsetopt : string -> string -> unit 962 | = "camlidl_plplot_core_c_plsetopt" 963 | external plMinMax2dGrid : float array array -> float * float 964 | = "camlidl_plplot_core_plMinMax2dGrid" 965 | external plcont : 966 | float array array -> int -> int -> int -> int -> float array -> unit 967 | = "camlidl_plplot_core_ml_plcont_bytecode" "camlidl_plplot_core_ml_plcont" 968 | external plshade : 969 | float array array -> 970 | float -> 971 | float -> 972 | float -> 973 | float -> 974 | float -> 975 | float -> int -> float -> float -> int -> float -> int -> float -> bool -> unit 976 | = "camlidl_plplot_core_ml_plshade_bytecode" 977 | "camlidl_plplot_core_ml_plshade" 978 | external plshades : 979 | float array array -> 980 | float -> 981 | float -> float -> float -> float array -> float -> int -> float -> bool -> unit 982 | = "camlidl_plplot_core_ml_plshades_bytecode" 983 | "camlidl_plplot_core_ml_plshades" 984 | external plimagefr : 985 | float array array -> 986 | float -> 987 | float -> float -> float -> float -> float -> float -> float -> unit 988 | = "camlidl_plplot_core_ml_plimagefr_bytecode" 989 | "camlidl_plplot_core_ml_plimagefr" 990 | external plvect : float array array -> float array array -> float -> unit 991 | = "camlidl_plplot_core_ml_plvect" 992 | external plmap : string -> float -> float -> float -> float -> unit 993 | = "camlidl_plplot_core_ml_plmap" 994 | external plmeridians : 995 | float -> float -> float -> float -> float -> float -> unit 996 | = "camlidl_plplot_core_ml_plmeridians_bytecode" 997 | "camlidl_plplot_core_ml_plmeridians" 998 | external plpoly3 : 999 | float array -> float array -> float array -> bool array -> bool -> unit 1000 | = "camlidl_plplot_core_ml_plpoly3" 1001 | external pltr0 : float -> float -> float * float 1002 | = "camlidl_plplot_core_ml_pltr0" 1003 | external plsvect_reset : unit -> unit = "camlidl_plplot_core_ml_plsvect_reset" 1004 | external plg_current_col0 : unit -> int 1005 | = "camlidl_plplot_core_plg_current_col0" 1006 | external plg_current_col1 : unit -> float 1007 | = "camlidl_plplot_core_plg_current_col1" 1008 | external plgwidth : unit -> float = "camlidl_plplot_core_plgwidth" 1009 | external plgchrht : unit -> float = "camlidl_plplot_core_plgchrht" 1010 | external plstripc : 1011 | string -> 1012 | string -> 1013 | float -> 1014 | float -> 1015 | float -> 1016 | float -> 1017 | float -> 1018 | float -> 1019 | float -> 1020 | bool -> 1021 | bool -> 1022 | int -> 1023 | int -> 1024 | int array -> int array -> string array -> string -> string -> string -> int 1025 | = "ml_plstripc_byte" "ml_plstripc" 1026 | external pltr1 : 1027 | float array -> float array -> float -> float -> float * float = "ml_pltr1" 1028 | external pltr2 : 1029 | float array array -> float array array -> float -> float -> float * float 1030 | = "ml_pltr2" 1031 | val plset_pltr : (float -> float -> float * float) -> unit 1032 | val plunset_pltr : unit -> unit 1033 | val plset_mapform : (float -> float -> float * float) -> unit 1034 | val plunset_mapform : unit -> unit 1035 | val plset_defined : (float -> float -> int) -> unit 1036 | val plunset_defined : unit -> unit 1037 | val plstransform : (float -> float -> (float * float)) -> unit 1038 | val plunset_transform : unit -> unit 1039 | type plplot_grid_method_type = 1040 | PL_GRID_CSA 1041 | | PL_GRID_DTLI 1042 | | PL_GRID_NNI 1043 | | PL_GRID_NNIDW 1044 | | PL_GRID_NNLI 1045 | | PL_GRID_NNAIDW 1046 | type plplot_parse_method_type = 1047 | PL_PARSE_PARTIAL 1048 | | PL_PARSE_FULL 1049 | | PL_PARSE_QUIET 1050 | | PL_PARSE_NODELETE 1051 | | PL_PARSE_SHOWALL 1052 | | PL_PARSE_OVERRIDE 1053 | | PL_PARSE_NOPROGRAM 1054 | | PL_PARSE_NODASH 1055 | | PL_PARSE_SKIP 1056 | val plslabelfunc : (plplot_axis_type -> float -> string) -> unit 1057 | val plunset_labelfunc : unit -> unit 1058 | val plsabort : (string -> unit) -> unit 1059 | val plunset_abort : unit -> unit 1060 | val plsexit : (string -> int) -> unit 1061 | val plunset_exit : unit -> unit 1062 | external plgriddata : 1063 | float array -> 1064 | float array -> 1065 | float array -> 1066 | float array -> 1067 | float array -> plplot_grid_method_type -> float -> float array array 1068 | = "ml_plgriddata_bytecode" "ml_plgriddata" 1069 | external plparseopts : string array -> plplot_parse_method_type list -> unit 1070 | = "ml_plparseopts" 1071 | 1072 | (** {3 Non-standard convenience functions (not part of the standard PLplot 1073 | API.} *) 1074 | 1075 | (** [plcalc_device x y] will give the device position, in normalized device 1076 | coordinates, of the world coordinates (x, y). *) 1077 | val plcalc_device : float -> float -> float * float 1078 | 1079 | (** [plfullcanvas ()] maximizes the plot viewport and window. Dimensions are 1080 | set to (0.0, 0.0) to (1.0, 1.0). *) 1081 | val plfullcanvas : unit -> unit 1082 | 1083 | (** Draw an unfilled polygon. The only functional difference between this and 1084 | {!plline} is that this function will close the given polygon, so there is no 1085 | need to duplicate points to have a closed figure. *) 1086 | val plpolyline : float array -> float array -> unit 1087 | 1088 | -------------------------------------------------------------------------------- /src/plplot_core.h: -------------------------------------------------------------------------------- 1 | /* File generated from plplot_core.idl */ 2 | 3 | #ifndef _CAMLIDL_PLPLOT_CORE_H 4 | #define _CAMLIDL_PLPLOT_CORE_H 5 | 6 | #ifdef __cplusplus 7 | #define _CAMLIDL_EXTERN_C extern "C" 8 | #else 9 | #define _CAMLIDL_EXTERN_C extern 10 | #endif 11 | 12 | #ifdef _WIN32 13 | #pragma pack(push,8) /* necessary for COM interfaces */ 14 | #endif 15 | 16 | enum plplot3d_style_enum { 17 | PL_DIFFUSE = 0, 18 | PL_DRAW_LINEX = 1, 19 | PL_DRAW_LINEY = 2, 20 | PL_DRAW_LINEXY = 3, 21 | PL_MAG_COLOR = 4, 22 | PL_BASE_CONT = 8, 23 | PL_TOP_CONT = 16, 24 | PL_SURF_CONT = 32, 25 | PL_DRAW_SIDES = 64, 26 | PL_FACETED = 128, 27 | PL_MESH = 256, 28 | }; 29 | 30 | typedef int plplot3d_style; 31 | 32 | enum plplot_bin_enum { 33 | PL_BIN_DEFAULT = 0, 34 | PL_BIN_CENTRED = 1, 35 | PL_BIN_NOEXPAND = 2, 36 | PL_BIN_NOEMPTY = 4, 37 | }; 38 | 39 | typedef int plplot_bin_style; 40 | 41 | enum plplot_hist_enum { 42 | PL_HIST_DEFAULT = 0, 43 | PL_HIST_NOSCALING = 1, 44 | PL_HIST_IGNORE_OUTLIERS = 2, 45 | PL_HIST_NOEXPAND = 8, 46 | PL_HIST_NOEMPTY = 16, 47 | }; 48 | 49 | typedef int plplot_hist_style; 50 | 51 | enum plplot_run_level_enum { 52 | PL_UNINITIALIZED = 0, 53 | PL_INITIALIZED = 1, 54 | PL_VIEWPORT_DEFINED = 2, 55 | PL_WORLD_COORDINATES_DEFINED = 3, 56 | }; 57 | 58 | typedef int plplot_run_level; 59 | 60 | enum plplot_position_enum { 61 | PL_POSITION_LEFT = 1, 62 | PL_POSITION_RIGHT = 2, 63 | PL_POSITION_TOP = 4, 64 | PL_POSITION_BOTTOM = 8, 65 | PL_POSITION_INSIDE = 16, 66 | PL_POSITION_OUTSIDE = 32, 67 | PL_POSITION_VIEWPORT = 64, 68 | PL_POSITION_SUBPAGE = 128, 69 | }; 70 | 71 | typedef int plplot_position_opt; 72 | 73 | enum plplot_legend_enum { 74 | PL_LEGEND_NONE = 1, 75 | PL_LEGEND_COLOR_BOX = 2, 76 | PL_LEGEND_LINE = 4, 77 | PL_LEGEND_SYMBOL = 8, 78 | PL_LEGEND_TEXT_LEFT = 16, 79 | PL_LEGEND_BACKGROUND = 32, 80 | PL_LEGEND_BOUNDING_BOX = 64, 81 | PL_LEGEND_ROW_MAJOR = 128, 82 | }; 83 | 84 | typedef int plplot_legend_opt; 85 | 86 | enum plplot_colorbar_enum { 87 | PL_COLORBAR_LABEL_LEFT = 1, 88 | PL_COLORBAR_LABEL_RIGHT = 2, 89 | PL_COLORBAR_LABEL_TOP = 4, 90 | PL_COLORBAR_LABEL_BOTTOM = 8, 91 | PL_COLORBAR_IMAGE = 16, 92 | PL_COLORBAR_SHADE = 32, 93 | PL_COLORBAR_GRADIENT = 64, 94 | PL_COLORBAR_CAP_NONE = 128, 95 | PL_COLORBAR_CAP_LOW = 256, 96 | PL_COLORBAR_CAP_HIGH = 512, 97 | PL_COLORBAR_SHADE_LABEL = 1024, 98 | PL_COLORBAR_ORIENT_RIGHT = 2048, 99 | PL_COLORBAR_ORIENT_TOP = 4096, 100 | PL_COLORBAR_ORIENT_LEFT = 8192, 101 | PL_COLORBAR_ORIENT_BOTTOM = 16384, 102 | PL_COLORBAR_BACKGROUND = 32768, 103 | PL_COLORBAR_BOUNDING_BOX = 65536, 104 | }; 105 | 106 | typedef int plplot_colorbar_opt; 107 | 108 | enum plplot_fci_family_enum { 109 | PL_FCI_FAMILY_UNCHANGED = -1, 110 | PL_FCI_SANS = 0, 111 | PL_FCI_SERIF = 1, 112 | PL_FCI_MONO = 2, 113 | PL_FCI_SCRIPT = 3, 114 | PL_FCI_SYMBOL = 4, 115 | }; 116 | 117 | enum plplot_fci_style_enum { 118 | PL_FCI_STYLE_UNCHANGED = -1, 119 | PL_FCI_UPRIGHT = 0, 120 | PL_FCI_ITALIC = 1, 121 | PL_FCI_OBLIQUE = 2, 122 | }; 123 | 124 | enum plplot_fci_weight_enum { 125 | PL_FCI_WEIGHT_UNCHANGED = -1, 126 | PL_FCI_MEDIUM = 0, 127 | PL_FCI_BOLD = 1, 128 | }; 129 | 130 | enum plplot_draw_mode_enum { 131 | PL_DRAWMODE_UNKNOWN = 0, 132 | PL_DRAWMODE_DEFAULT = 1, 133 | PL_DRAWMODE_REPLACE = 2, 134 | PL_DRAWMODE_XOR = 4, 135 | }; 136 | 137 | typedef int nonzero_error_int; 138 | 139 | void plplot_check_nonzero_result(int result); 140 | _CAMLIDL_EXTERN_C void c_pl_setcontlabelformat(/*in*/ int lexp, /*in*/ int sigdig); 141 | 142 | _CAMLIDL_EXTERN_C void c_pl_setcontlabelparam(/*in*/ double offset, /*in*/ double size, /*in*/ double spacing, /*in*/ int active); 143 | 144 | _CAMLIDL_EXTERN_C void c_pladv(/*in*/ int page); 145 | 146 | _CAMLIDL_EXTERN_C void c_plarc(/*in*/ double x, /*in*/ double y, /*in*/ double a, /*in*/ double b, /*in*/ double angle1, /*in*/ double angle2, /*in*/ double rotate, /*in*/ int fill); 147 | 148 | _CAMLIDL_EXTERN_C void c_plaxes(/*in*/ double x0, /*in*/ double y0, /*in*/ char const *xopt, /*in*/ double xtick, /*in*/ int nxsub, /*in*/ char const *yopt, /*in*/ double ytick, /*in*/ int nysub); 149 | 150 | _CAMLIDL_EXTERN_C void c_plbin(/*in*/ int nbin, /*in*/ double *x, /*in*/ double *y, /*in*/ plplot_bin_style opt); 151 | 152 | _CAMLIDL_EXTERN_C void c_plbtime(/*out*/ int *year, /*out*/ int *month, /*out*/ int *day, /*out*/ int *hour, /*out*/ int *min, /*out*/ double *sec, /*in*/ double ctime); 153 | 154 | _CAMLIDL_EXTERN_C void c_plbop(void); 155 | 156 | _CAMLIDL_EXTERN_C void c_plbox(/*in*/ char const *xopt, /*in*/ double xtick, /*in*/ int nxsub, /*in*/ char const *yopt, /*in*/ double ytick, /*in*/ int nysub); 157 | 158 | _CAMLIDL_EXTERN_C void c_plbox3(/*in*/ char const *xopt, /*in*/ char const *xlabel, /*in*/ double xtick, /*in*/ int nsubx, /*in*/ char const *yopt, /*in*/ char const *ylabel, /*in*/ double ytick, /*in*/ int nsuby, /*in*/ char const *zopt, /*in*/ char const *zlabel, /*in*/ double ztick, /*in*/ int nsubz); 159 | 160 | _CAMLIDL_EXTERN_C void c_plcalc_world(/*in*/ double rx, /*in*/ double ry, /*out*/ double *wx, /*out*/ double *wy, /*out*/ int *window); 161 | 162 | _CAMLIDL_EXTERN_C void c_plclear(void); 163 | 164 | _CAMLIDL_EXTERN_C void c_plcol0(/*in*/ int icol0); 165 | 166 | _CAMLIDL_EXTERN_C void c_plcol1(/*in*/ double col1); 167 | 168 | _CAMLIDL_EXTERN_C void c_plconfigtime(/*in*/ double scale, /*in*/ double offset1, /*in*/ double offset2, /*in*/ int ccontrol, /*in*/ int ifbtime_offset, /*in*/ int year, /*in*/ int month, /*in*/ int day, /*in*/ int hour, /*in*/ int min, /*in*/ double sec); 169 | 170 | _CAMLIDL_EXTERN_C void c_plcpstrm(/*in*/ int iplsr, /*in*/ int flags); 171 | 172 | _CAMLIDL_EXTERN_C void c_plctime(/*in*/ int year, /*in*/ int month, /*in*/ int day, /*in*/ int hour, /*in*/ int min, /*in*/ double sec, /*out*/ double *ctime); 173 | 174 | _CAMLIDL_EXTERN_C void c_plend(void); 175 | 176 | _CAMLIDL_EXTERN_C void c_plend1(void); 177 | 178 | _CAMLIDL_EXTERN_C void c_plenv(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ int just, /*in*/ int axis); 179 | 180 | _CAMLIDL_EXTERN_C void c_plenv0(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ int just, /*in*/ int axis); 181 | 182 | _CAMLIDL_EXTERN_C void c_pleop(void); 183 | 184 | _CAMLIDL_EXTERN_C void c_plerrx(/*in*/ int n, /*in*/ double *xmin, /*in*/ double *xmax, /*in*/ double *y); 185 | 186 | _CAMLIDL_EXTERN_C void c_plerry(/*in*/ int n, /*in*/ double *x, /*in*/ double *ymin, /*in*/ double *ymax); 187 | 188 | _CAMLIDL_EXTERN_C void c_plfamadv(void); 189 | 190 | _CAMLIDL_EXTERN_C void c_plfill(/*in*/ int n, /*in*/ double *x, /*in*/ double *y); 191 | 192 | _CAMLIDL_EXTERN_C void c_plfill3(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double *z); 193 | 194 | _CAMLIDL_EXTERN_C void c_plflush(void); 195 | 196 | _CAMLIDL_EXTERN_C void c_plfont(/*in*/ int ifont); 197 | 198 | _CAMLIDL_EXTERN_C void c_plfontld(/*in*/ int fnt); 199 | 200 | _CAMLIDL_EXTERN_C void c_plgchr(/*out*/ double *p_def, /*out*/ double *p_ht); 201 | 202 | _CAMLIDL_EXTERN_C void c_plgcmap1_range(/*out*/ double *min_color, /*out*/ double *max_color); 203 | 204 | _CAMLIDL_EXTERN_C void c_plgcol0(/*in*/ int icol0, /*out*/ int *r, /*out*/ int *g, /*out*/ int *b); 205 | 206 | _CAMLIDL_EXTERN_C void c_plgcol0a(/*in*/ int icol0, /*out*/ int *r, /*out*/ int *g, /*out*/ int *b, /*out*/ double *a); 207 | 208 | _CAMLIDL_EXTERN_C void c_plgcolbg(/*out*/ int *r, /*out*/ int *g, /*out*/ int *b); 209 | 210 | _CAMLIDL_EXTERN_C void c_plgcolbga(/*out*/ int *r, /*out*/ int *g, /*out*/ int *b, /*out*/ double *a); 211 | 212 | _CAMLIDL_EXTERN_C void c_plgcompression(/*out*/ int *compression); 213 | 214 | _CAMLIDL_EXTERN_C void c_plgdev(/*out*/ char *p_dev); 215 | 216 | _CAMLIDL_EXTERN_C void c_plgdidev(/*out*/ double *p_mar, /*out*/ double *p_aspect, /*out*/ double *p_jx, /*out*/ double *p_jy); 217 | 218 | _CAMLIDL_EXTERN_C void c_plgdiori(/*out*/ double *p_rot); 219 | 220 | _CAMLIDL_EXTERN_C void c_plgdiplt(/*out*/ double *p_xmin, /*out*/ double *p_ymin, /*out*/ double *p_xmax, /*out*/ double *p_ymax); 221 | 222 | _CAMLIDL_EXTERN_C int c_plgdrawmode(void); 223 | 224 | _CAMLIDL_EXTERN_C void c_plgfci(/*out*/ long long *pfci); 225 | 226 | _CAMLIDL_EXTERN_C void c_plgfam(/*out*/ int *p_fam, /*out*/ int *p_num, /*out*/ int *p_bmax); 227 | 228 | _CAMLIDL_EXTERN_C void c_plgfnam(/*out*/ char *fnam); 229 | 230 | _CAMLIDL_EXTERN_C void c_plgfont(/*out*/ int *p_family, /*out*/ int *p_style, /*out*/ int *p_weight); 231 | 232 | _CAMLIDL_EXTERN_C void c_plglevel(/*out*/ plplot_run_level *p_level); 233 | 234 | _CAMLIDL_EXTERN_C void c_plgpage(/*out*/ double *p_xp, /*out*/ double *p_yp, /*out*/ int *p_xleng, /*out*/ int *p_yleng, /*out*/ int *p_xoff, /*out*/ int *p_yoff); 235 | 236 | _CAMLIDL_EXTERN_C void c_plgra(void); 237 | 238 | _CAMLIDL_EXTERN_C void c_plgradient(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double angle); 239 | 240 | _CAMLIDL_EXTERN_C void c_plgspa(/*out*/ double *xmin, /*out*/ double *xmax, /*out*/ double *ymin, /*out*/ double *ymax); 241 | 242 | _CAMLIDL_EXTERN_C void c_plgstrm(/*out*/ int *p_strm); 243 | 244 | _CAMLIDL_EXTERN_C void c_plgver(/*out*/ char *p_ver); 245 | 246 | _CAMLIDL_EXTERN_C void c_plgvpd(/*out*/ double *p_xmin, /*out*/ double *p_xmax, /*out*/ double *p_ymin, /*out*/ double *p_ymax); 247 | 248 | _CAMLIDL_EXTERN_C void c_plgvpw(/*out*/ double *p_xmin, /*out*/ double *p_xmax, /*out*/ double *p_ymin, /*out*/ double *p_ymax); 249 | 250 | _CAMLIDL_EXTERN_C void c_plgxax(/*out*/ int *p_digmax, /*out*/ int *p_digits); 251 | 252 | _CAMLIDL_EXTERN_C void c_plgyax(/*out*/ int *p_digmax, /*out*/ int *p_digits); 253 | 254 | _CAMLIDL_EXTERN_C void c_plgzax(/*out*/ int *p_digmax, /*out*/ int *p_digits); 255 | 256 | _CAMLIDL_EXTERN_C void c_plhist(/*in*/ int n, /*in*/ double *data, /*in*/ double datmin, /*in*/ double datmax, /*in*/ int nbin, /*in*/ plplot_hist_style opt); 257 | 258 | _CAMLIDL_EXTERN_C void c_plhlsrgb(/*in*/ double h, /*in*/ double l, /*in*/ double s, /*out*/ double *p_r, /*out*/ double *p_g, /*out*/ double *p_b); 259 | 260 | _CAMLIDL_EXTERN_C void c_plinit(void); 261 | 262 | _CAMLIDL_EXTERN_C void c_pljoin(/*in*/ double x1, /*in*/ double y1, /*in*/ double x2, /*in*/ double y2); 263 | 264 | _CAMLIDL_EXTERN_C void c_pllab(/*in*/ char const *xlabel, /*in*/ char const *ylabel, /*in*/ char const *tlabel); 265 | 266 | _CAMLIDL_EXTERN_C void c_pllightsource(/*in*/ double x, /*in*/ double y, /*in*/ double z); 267 | 268 | _CAMLIDL_EXTERN_C void c_plline(/*in*/ int n, /*in*/ double *x, /*in*/ double *y); 269 | 270 | _CAMLIDL_EXTERN_C void c_plline3(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double *z); 271 | 272 | _CAMLIDL_EXTERN_C void c_pllsty(/*in*/ int lin); 273 | 274 | _CAMLIDL_EXTERN_C void c_plmesh(/*in*/ double *x, /*in*/ double *y, /*in*/ double **z, /*in*/ int nx, /*in*/ int ny, /*in*/ plplot3d_style opt); 275 | 276 | _CAMLIDL_EXTERN_C void c_plmeshc(/*in*/ double *x, /*in*/ double *y, /*in*/ double **z, /*in*/ int nx, /*in*/ int ny, /*in*/ plplot3d_style opt, /*in*/ double *clevel, /*in*/ int nlevel); 277 | 278 | _CAMLIDL_EXTERN_C void c_plmkstrm(/*out*/ int *p_strm); 279 | 280 | _CAMLIDL_EXTERN_C void c_plmtex(/*in*/ char const *side, /*in*/ double disp, /*in*/ double pos, /*in*/ double just, /*in*/ char const *text); 281 | 282 | _CAMLIDL_EXTERN_C void c_plmtex3(/*in*/ char const *side, /*in*/ double disp, /*in*/ double pos, /*in*/ double just, /*in*/ char const *text); 283 | 284 | _CAMLIDL_EXTERN_C void c_plot3d(/*in*/ double *x, /*in*/ double *y, /*in*/ double **z, /*in*/ int nx, /*in*/ int ny, /*in*/ plplot3d_style opt, /*in*/ int side); 285 | 286 | _CAMLIDL_EXTERN_C void c_plot3dc(/*in*/ double *x, /*in*/ double *y, /*in*/ double **z, /*in*/ int nx, /*in*/ int ny, /*in*/ plplot3d_style opt, /*in*/ double *clevel, /*in*/ int nlevel); 287 | 288 | _CAMLIDL_EXTERN_C void c_plpat(/*in*/ int nlin, /*in*/ int *inc, /*in*/ int *del); 289 | 290 | _CAMLIDL_EXTERN_C void c_plpath(/*in*/ int n, /*in*/ double x1, /*in*/ double y1, /*in*/ double x2, /*in*/ double y2); 291 | 292 | _CAMLIDL_EXTERN_C void c_plpoin(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ int code); 293 | 294 | _CAMLIDL_EXTERN_C void c_plpoin3(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double *z, /*in*/ int code); 295 | 296 | _CAMLIDL_EXTERN_C void c_plprec(/*in*/ int setp, /*in*/ int prec); 297 | 298 | _CAMLIDL_EXTERN_C void c_plpsty(/*in*/ int patt); 299 | 300 | _CAMLIDL_EXTERN_C void c_plptex(/*in*/ double x, /*in*/ double y, /*in*/ double dx, /*in*/ double dy, /*in*/ double just, /*in*/ char const *text); 301 | 302 | _CAMLIDL_EXTERN_C void c_plptex3(/*in*/ double wx, /*in*/ double wy, /*in*/ double wz, /*in*/ double dx, /*in*/ double dy, /*in*/ double dz, /*in*/ double sx, /*in*/ double sy, /*in*/ double sz, /*in*/ double just, /*in*/ char const *text); 303 | 304 | _CAMLIDL_EXTERN_C double c_plrandd(void); 305 | 306 | _CAMLIDL_EXTERN_C void c_plreplot(void); 307 | 308 | _CAMLIDL_EXTERN_C void c_plrgbhls(/*in*/ double r, /*in*/ double g, /*in*/ double b, /*out*/ double *p_h, /*out*/ double *p_l, /*out*/ double *p_s); 309 | 310 | _CAMLIDL_EXTERN_C void c_plschr(/*in*/ double def, /*in*/ double scale); 311 | 312 | _CAMLIDL_EXTERN_C void c_plscmap0(/*in*/ int *r, /*in*/ int *g, /*in*/ int *b, /*in*/ int ncol0); 313 | 314 | _CAMLIDL_EXTERN_C void c_plscmap0a(/*in*/ int *r, /*in*/ int *g, /*in*/ int *b, /*in*/ double *a, /*in*/ int ncol0); 315 | 316 | _CAMLIDL_EXTERN_C void c_plscmap0n(/*in*/ int ncol0); 317 | 318 | _CAMLIDL_EXTERN_C void c_plscmap1(/*in*/ int *r, /*in*/ int *g, /*in*/ int *b, /*in*/ int ncol1); 319 | 320 | _CAMLIDL_EXTERN_C void c_plscmap1a(/*in*/ int *r, /*in*/ int *g, /*in*/ int *b, /*in*/ double *a, /*in*/ int ncol1); 321 | 322 | _CAMLIDL_EXTERN_C void c_plscmap1l(/*in*/ int itype, /*in*/ int npts, /*in*/ double *intensity, /*in*/ double *coord1, /*in*/ double *coord2, /*in*/ double *coord3, /*in*/ int *alt_hue_path); 323 | 324 | _CAMLIDL_EXTERN_C void c_plscmap1la(/*in*/ int itype, /*in*/ int npts, /*in*/ double *intensity, /*in*/ double *coord1, /*in*/ double *coord2, /*in*/ double *coord3, /*in*/ double *a, /*in*/ int *alt_hue_path); 325 | 326 | _CAMLIDL_EXTERN_C void c_plscmap1n(/*in*/ int ncol1); 327 | 328 | _CAMLIDL_EXTERN_C void c_plscmap1_range(/*in*/ double min_color, /*in*/ double max_color); 329 | 330 | _CAMLIDL_EXTERN_C void c_plscol0(/*in*/ int icol0, /*in*/ int r, /*in*/ int g, /*in*/ int b); 331 | 332 | _CAMLIDL_EXTERN_C void c_plscol0a(/*in*/ int icol0, /*in*/ int r, /*in*/ int g, /*in*/ int b, /*in*/ double a); 333 | 334 | _CAMLIDL_EXTERN_C void c_plscolbg(/*in*/ int r, /*in*/ int g, /*in*/ int b); 335 | 336 | _CAMLIDL_EXTERN_C void c_plscolbga(/*in*/ int r, /*in*/ int g, /*in*/ int b, /*in*/ double a); 337 | 338 | _CAMLIDL_EXTERN_C void c_plscolor(/*in*/ int color); 339 | 340 | _CAMLIDL_EXTERN_C void c_plscompression(/*in*/ int compression); 341 | 342 | _CAMLIDL_EXTERN_C void c_plsdev(/*in*/ char const *devname); 343 | 344 | _CAMLIDL_EXTERN_C void c_plsdidev(/*in*/ double mar, /*in*/ double aspect, /*in*/ double jx, /*in*/ double jy); 345 | 346 | _CAMLIDL_EXTERN_C void c_plsdimap(/*in*/ int dimxmin, /*in*/ int dimxmax, /*in*/ int dimymin, /*in*/ int dimymax, /*in*/ double dimxpmm, /*in*/ double dimypmm); 347 | 348 | _CAMLIDL_EXTERN_C void c_plsdiori(/*in*/ double rot); 349 | 350 | _CAMLIDL_EXTERN_C void c_plsdiplt(/*in*/ double xmin, /*in*/ double ymin, /*in*/ double xmax, /*in*/ double ymax); 351 | 352 | _CAMLIDL_EXTERN_C void c_plsdiplz(/*in*/ double xmin, /*in*/ double ymin, /*in*/ double xmax, /*in*/ double ymax); 353 | 354 | _CAMLIDL_EXTERN_C void c_plseed(/*in*/ unsigned int s); 355 | 356 | _CAMLIDL_EXTERN_C void c_plsesc(/*in*/ char esc); 357 | 358 | _CAMLIDL_EXTERN_C void c_plsfam(/*in*/ int fam, /*in*/ int num, /*in*/ int bmax); 359 | 360 | _CAMLIDL_EXTERN_C void c_plsfci(/*in*/ long long fci); 361 | 362 | _CAMLIDL_EXTERN_C void c_plsfnam(/*in*/ char const *fnam); 363 | 364 | _CAMLIDL_EXTERN_C void c_plsfont(/*in*/ int family, /*in*/ int style, /*in*/ int weight); 365 | 366 | _CAMLIDL_EXTERN_C void c_plsmaj(/*in*/ double def, /*in*/ double scale); 367 | 368 | _CAMLIDL_EXTERN_C void c_plsmin(/*in*/ double def, /*in*/ double scale); 369 | 370 | _CAMLIDL_EXTERN_C void c_plsdrawmode(/*in*/ int mode); 371 | 372 | _CAMLIDL_EXTERN_C void c_plsori(/*in*/ int ori); 373 | 374 | _CAMLIDL_EXTERN_C void c_plspage(/*in*/ double xp, /*in*/ double yp, /*in*/ int xleng, /*in*/ int yleng, /*in*/ int xoff, /*in*/ int yoff); 375 | 376 | _CAMLIDL_EXTERN_C void c_plspal0(/*in*/ char const *filename); 377 | 378 | _CAMLIDL_EXTERN_C void c_plspal1(/*in*/ char const *filename, /*in*/ int interpolate); 379 | 380 | _CAMLIDL_EXTERN_C void c_plspause(/*in*/ int pause); 381 | 382 | _CAMLIDL_EXTERN_C void c_plsstrm(/*in*/ int strm); 383 | 384 | _CAMLIDL_EXTERN_C void c_plssub(/*in*/ int nx, /*in*/ int ny); 385 | 386 | _CAMLIDL_EXTERN_C void c_plssym(/*in*/ double def, /*in*/ double scale); 387 | 388 | _CAMLIDL_EXTERN_C void c_plstar(/*in*/ int nx, /*in*/ int ny); 389 | 390 | _CAMLIDL_EXTERN_C void c_plstart(/*in*/ char const *devname, /*in*/ int nx, /*in*/ int ny); 391 | 392 | _CAMLIDL_EXTERN_C void c_plstring(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ char const *string); 393 | 394 | _CAMLIDL_EXTERN_C void c_plstring3(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double *z, /*in*/ char const *string); 395 | 396 | _CAMLIDL_EXTERN_C void c_plstripa(/*in*/ int id, /*in*/ int pen, /*in*/ double x, /*in*/ double y); 397 | 398 | _CAMLIDL_EXTERN_C void c_plstripd(/*in*/ int id); 399 | 400 | _CAMLIDL_EXTERN_C void c_plimage(/*in*/ double **idata, /*in*/ int nx, /*in*/ int ny, /*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ double zmin, /*in*/ double zmax, /*in*/ double Dxmin, /*in*/ double Dxmax, /*in*/ double Dymin, /*in*/ double Dymax); 401 | 402 | _CAMLIDL_EXTERN_C void c_plstyl(/*in*/ int nms, /*in*/ int *mark, /*in*/ int *space); 403 | 404 | _CAMLIDL_EXTERN_C void c_plsurf3d(/*in*/ double *x, /*in*/ double *y, /*in*/ double **z, /*in*/ int nx, /*in*/ int ny, /*in*/ plplot3d_style opt, /*in*/ double *clevel, /*in*/ int nlevel); 405 | 406 | _CAMLIDL_EXTERN_C void c_plsvect(/*in*/ double *arrowx, /*in*/ double *arrowy, /*in*/ int npts, /*in*/ int fill); 407 | 408 | _CAMLIDL_EXTERN_C void c_plsvpa(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax); 409 | 410 | _CAMLIDL_EXTERN_C void c_plsxax(/*in*/ int digmax, /*in*/ int digits); 411 | 412 | _CAMLIDL_EXTERN_C void plsxwin(/*in*/ int window_id); 413 | 414 | _CAMLIDL_EXTERN_C void c_plsyax(/*in*/ int digmax, /*in*/ int digits); 415 | 416 | _CAMLIDL_EXTERN_C void c_plsym(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ int code); 417 | 418 | _CAMLIDL_EXTERN_C void c_plszax(/*in*/ int digmax, /*in*/ int digits); 419 | 420 | _CAMLIDL_EXTERN_C void c_pltext(void); 421 | 422 | _CAMLIDL_EXTERN_C void c_pltimefmt(/*in*/ char const *fmt); 423 | 424 | _CAMLIDL_EXTERN_C void c_plvasp(/*in*/ double aspect); 425 | 426 | _CAMLIDL_EXTERN_C void c_plvpas(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ double aspect); 427 | 428 | _CAMLIDL_EXTERN_C void c_plvpor(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax); 429 | 430 | _CAMLIDL_EXTERN_C void c_plvsta(void); 431 | 432 | _CAMLIDL_EXTERN_C void c_plw3d(/*in*/ double basex, /*in*/ double basey, /*in*/ double height, /*in*/ double xmin0, /*in*/ double xmax0, /*in*/ double ymin0, /*in*/ double ymax0, /*in*/ double zmin0, /*in*/ double zmax0, /*in*/ double alt, /*in*/ double az); 433 | 434 | _CAMLIDL_EXTERN_C void c_plwidth(/*in*/ double width); 435 | 436 | _CAMLIDL_EXTERN_C void c_plwind(/*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax); 437 | 438 | _CAMLIDL_EXTERN_C void c_plxormod(/*in*/ int mode, /*out*/ int *status); 439 | 440 | _CAMLIDL_EXTERN_C nonzero_error_int c_plsetopt(/*in*/ char const *opt, /*in*/ char const *optarg); 441 | 442 | _CAMLIDL_EXTERN_C void plMinMax2dGrid(/*in*/ double **f, /*in*/ int nx, /*in*/ int ny, /*out*/ double *fmax, /*out*/ double *fmin); 443 | 444 | _CAMLIDL_EXTERN_C void ml_plcont(/*in*/ double **f, /*in*/ int nx, /*in*/ int ny, /*in*/ int kx, /*in*/ int lx, /*in*/ int ky, /*in*/ int ly, /*in*/ double *clevel, /*in*/ int nlevel); 445 | 446 | _CAMLIDL_EXTERN_C void ml_plshade(/*in*/ double **a, /*in*/ int nx, /*in*/ int ny, /*in*/ double left, /*in*/ double right, /*in*/ double bottom, /*in*/ double top, /*in*/ double shade_min, /*in*/ double shade_max, /*in*/ int sh_cmap, /*in*/ double sh_color, /*in*/ double sh_width, /*in*/ int min_color, /*in*/ double min_width, /*in*/ int max_color, /*in*/ double max_width, /*in*/ int rectangular); 447 | 448 | _CAMLIDL_EXTERN_C void ml_plshades(/*in*/ double **a, /*in*/ int nx, /*in*/ int ny, /*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ double *clevel, /*in*/ int nlevel, /*in*/ double fill_width, /*in*/ int cont_color, /*in*/ double cont_width, /*in*/ int rectangular); 449 | 450 | _CAMLIDL_EXTERN_C void ml_plimagefr(/*in*/ double **idata, /*in*/ int nx, /*in*/ int ny, /*in*/ double xmin, /*in*/ double xmax, /*in*/ double ymin, /*in*/ double ymax, /*in*/ double zmin, /*in*/ double zmax, /*in*/ double valuemin, /*in*/ double valuemax); 451 | 452 | _CAMLIDL_EXTERN_C void ml_plvect(/*in*/ double **u, /*in*/ double **v, /*in*/ int nx, /*in*/ int ny, /*in*/ double scale); 453 | 454 | _CAMLIDL_EXTERN_C void ml_plmap(/*in*/ char const *type, /*in*/ double minlong, /*in*/ double maxlong, /*in*/ double minlat, /*in*/ double maxlat); 455 | 456 | _CAMLIDL_EXTERN_C void ml_plmeridians(/*in*/ double dlong, /*in*/ double dlat, /*in*/ double minlong, /*in*/ double maxlong, /*in*/ double minlat, /*in*/ double maxlat); 457 | 458 | _CAMLIDL_EXTERN_C void ml_plpoly3(/*in*/ int n, /*in*/ double *x, /*in*/ double *y, /*in*/ double *z, /*in*/ int ndraw, /*in*/ int *draw, /*in*/ int ifcc); 459 | 460 | _CAMLIDL_EXTERN_C void ml_pltr0(/*in*/ double x, /*in*/ double y, /*out*/ double *tx, /*out*/ double *ty); 461 | 462 | _CAMLIDL_EXTERN_C void ml_plsvect_reset(void); 463 | 464 | _CAMLIDL_EXTERN_C int plg_current_col0(void); 465 | 466 | _CAMLIDL_EXTERN_C double plg_current_col1(void); 467 | 468 | _CAMLIDL_EXTERN_C double plgwidth(void); 469 | 470 | _CAMLIDL_EXTERN_C double plgchrht(void); 471 | 472 | #ifdef _WIN32 473 | #pragma pack(pop) 474 | #endif 475 | 476 | 477 | #endif /* !_CAMLIDL_PLPLOT_CORE_H */ 478 | -------------------------------------------------------------------------------- /src/plplot_core.ml: -------------------------------------------------------------------------------- 1 | (* File generated from plplot_core.idl *) 2 | 3 | type plplot3d_style_enum = 4 | | PL_DIFFUSE 5 | | PL_DRAW_LINEX 6 | | PL_DRAW_LINEY 7 | | PL_DRAW_LINEXY 8 | | PL_MAG_COLOR 9 | | PL_BASE_CONT 10 | | PL_TOP_CONT 11 | | PL_SURF_CONT 12 | | PL_DRAW_SIDES 13 | | PL_FACETED 14 | | PL_MESH 15 | and plplot3d_style = plplot3d_style_enum list 16 | and plplot_bin_enum = 17 | | PL_BIN_DEFAULT 18 | | PL_BIN_CENTRED 19 | | PL_BIN_NOEXPAND 20 | | PL_BIN_NOEMPTY 21 | and plplot_bin_style = plplot_bin_enum list 22 | and plplot_hist_enum = 23 | | PL_HIST_DEFAULT 24 | | PL_HIST_NOSCALING 25 | | PL_HIST_IGNORE_OUTLIERS 26 | | PL_HIST_NOEXPAND 27 | | PL_HIST_NOEMPTY 28 | and plplot_hist_style = plplot_hist_enum list 29 | and plplot_run_level_enum = 30 | | PL_UNINITIALIZED 31 | | PL_INITIALIZED 32 | | PL_VIEWPORT_DEFINED 33 | | PL_WORLD_COORDINATES_DEFINED 34 | and plplot_run_level = plplot_run_level_enum 35 | and plplot_position_enum = 36 | | PL_POSITION_LEFT 37 | | PL_POSITION_RIGHT 38 | | PL_POSITION_TOP 39 | | PL_POSITION_BOTTOM 40 | | PL_POSITION_INSIDE 41 | | PL_POSITION_OUTSIDE 42 | | PL_POSITION_VIEWPORT 43 | | PL_POSITION_SUBPAGE 44 | and plplot_position_opt = plplot_position_enum list 45 | and plplot_legend_enum = 46 | | PL_LEGEND_NONE 47 | | PL_LEGEND_COLOR_BOX 48 | | PL_LEGEND_LINE 49 | | PL_LEGEND_SYMBOL 50 | | PL_LEGEND_TEXT_LEFT 51 | | PL_LEGEND_BACKGROUND 52 | | PL_LEGEND_BOUNDING_BOX 53 | | PL_LEGEND_ROW_MAJOR 54 | and plplot_legend_opt = plplot_legend_enum list 55 | and plplot_colorbar_enum = 56 | | PL_COLORBAR_LABEL_LEFT 57 | | PL_COLORBAR_LABEL_RIGHT 58 | | PL_COLORBAR_LABEL_TOP 59 | | PL_COLORBAR_LABEL_BOTTOM 60 | | PL_COLORBAR_IMAGE 61 | | PL_COLORBAR_SHADE 62 | | PL_COLORBAR_GRADIENT 63 | | PL_COLORBAR_CAP_NONE 64 | | PL_COLORBAR_CAP_LOW 65 | | PL_COLORBAR_CAP_HIGH 66 | | PL_COLORBAR_SHADE_LABEL 67 | | PL_COLORBAR_ORIENT_RIGHT 68 | | PL_COLORBAR_ORIENT_TOP 69 | | PL_COLORBAR_ORIENT_LEFT 70 | | PL_COLORBAR_ORIENT_BOTTOM 71 | | PL_COLORBAR_BACKGROUND 72 | | PL_COLORBAR_BOUNDING_BOX 73 | and plplot_colorbar_opt = plplot_colorbar_enum list 74 | and plplot_fci_family_enum = 75 | | PL_FCI_FAMILY_UNCHANGED 76 | | PL_FCI_SANS 77 | | PL_FCI_SERIF 78 | | PL_FCI_MONO 79 | | PL_FCI_SCRIPT 80 | | PL_FCI_SYMBOL 81 | and plplot_fci_style_enum = 82 | | PL_FCI_STYLE_UNCHANGED 83 | | PL_FCI_UPRIGHT 84 | | PL_FCI_ITALIC 85 | | PL_FCI_OBLIQUE 86 | and plplot_fci_weight_enum = 87 | | PL_FCI_WEIGHT_UNCHANGED 88 | | PL_FCI_MEDIUM 89 | | PL_FCI_BOLD 90 | and plplot_draw_mode_enum = 91 | | PL_DRAWMODE_UNKNOWN 92 | | PL_DRAWMODE_DEFAULT 93 | | PL_DRAWMODE_REPLACE 94 | | PL_DRAWMODE_XOR 95 | and nonzero_error_int = int 96 | 97 | external pl_setcontlabelformat : int -> int -> unit 98 | = "camlidl_plplot_core_c_pl_setcontlabelformat" 99 | 100 | external pl_setcontlabelparam : float -> float -> float -> int -> unit 101 | = "camlidl_plplot_core_c_pl_setcontlabelparam" 102 | 103 | external pladv : int -> unit 104 | = "camlidl_plplot_core_c_pladv" 105 | 106 | external plarc : float -> float -> float -> float -> float -> float -> float -> bool -> unit 107 | = "camlidl_plplot_core_c_plarc_bytecode" "camlidl_plplot_core_c_plarc" 108 | 109 | external plaxes : float -> float -> string -> float -> int -> string -> float -> int -> unit 110 | = "camlidl_plplot_core_c_plaxes_bytecode" "camlidl_plplot_core_c_plaxes" 111 | 112 | external plbin : float array -> float array -> plplot_bin_style -> unit 113 | = "camlidl_plplot_core_c_plbin" 114 | 115 | external plbtime : float -> int * int * int * int * int * float 116 | = "camlidl_plplot_core_c_plbtime" 117 | 118 | external plbop : unit -> unit 119 | = "camlidl_plplot_core_c_plbop" 120 | 121 | external plbox : string -> float -> int -> string -> float -> int -> unit 122 | = "camlidl_plplot_core_c_plbox_bytecode" "camlidl_plplot_core_c_plbox" 123 | 124 | external plbox3 : string -> string -> float -> int -> string -> string -> float -> int -> string -> string -> float -> int -> unit 125 | = "camlidl_plplot_core_c_plbox3_bytecode" "camlidl_plplot_core_c_plbox3" 126 | 127 | external plcalc_world : float -> float -> float * float * int 128 | = "camlidl_plplot_core_c_plcalc_world" 129 | 130 | external plclear : unit -> unit 131 | = "camlidl_plplot_core_c_plclear" 132 | 133 | external plcol0 : int -> unit 134 | = "camlidl_plplot_core_c_plcol0" 135 | 136 | external plcol1 : float -> unit 137 | = "camlidl_plplot_core_c_plcol1" 138 | 139 | external plconfigtime : float -> float -> float -> int -> bool -> int -> int -> int -> int -> int -> float -> unit 140 | = "camlidl_plplot_core_c_plconfigtime_bytecode" "camlidl_plplot_core_c_plconfigtime" 141 | 142 | external plcpstrm : int -> bool -> unit 143 | = "camlidl_plplot_core_c_plcpstrm" 144 | 145 | external plctime : int -> int -> int -> int -> int -> float -> float 146 | = "camlidl_plplot_core_c_plctime_bytecode" "camlidl_plplot_core_c_plctime" 147 | 148 | external plend : unit -> unit 149 | = "camlidl_plplot_core_c_plend" 150 | 151 | external plend1 : unit -> unit 152 | = "camlidl_plplot_core_c_plend1" 153 | 154 | external plenv : float -> float -> float -> float -> int -> int -> unit 155 | = "camlidl_plplot_core_c_plenv_bytecode" "camlidl_plplot_core_c_plenv" 156 | 157 | external plenv0 : float -> float -> float -> float -> int -> int -> unit 158 | = "camlidl_plplot_core_c_plenv0_bytecode" "camlidl_plplot_core_c_plenv0" 159 | 160 | external pleop : unit -> unit 161 | = "camlidl_plplot_core_c_pleop" 162 | 163 | external plerrx : float array -> float array -> float array -> unit 164 | = "camlidl_plplot_core_c_plerrx" 165 | 166 | external plerry : float array -> float array -> float array -> unit 167 | = "camlidl_plplot_core_c_plerry" 168 | 169 | external plfamadv : unit -> unit 170 | = "camlidl_plplot_core_c_plfamadv" 171 | 172 | external plfill : float array -> float array -> unit 173 | = "camlidl_plplot_core_c_plfill" 174 | 175 | external plfill3 : float array -> float array -> float array -> unit 176 | = "camlidl_plplot_core_c_plfill3" 177 | 178 | external plflush : unit -> unit 179 | = "camlidl_plplot_core_c_plflush" 180 | 181 | external plfont : int -> unit 182 | = "camlidl_plplot_core_c_plfont" 183 | 184 | external plfontld : int -> unit 185 | = "camlidl_plplot_core_c_plfontld" 186 | 187 | external plgchr : unit -> float * float 188 | = "camlidl_plplot_core_c_plgchr" 189 | 190 | external plgcmap1_range : unit -> float * float 191 | = "camlidl_plplot_core_c_plgcmap1_range" 192 | 193 | external plgcol0 : int -> int * int * int 194 | = "camlidl_plplot_core_c_plgcol0" 195 | 196 | external plgcol0a : int -> int * int * int * float 197 | = "camlidl_plplot_core_c_plgcol0a" 198 | 199 | external plgcolbg : unit -> int * int * int 200 | = "camlidl_plplot_core_c_plgcolbg" 201 | 202 | external plgcolbga : unit -> int * int * int * float 203 | = "camlidl_plplot_core_c_plgcolbga" 204 | 205 | external plgcompression : unit -> int 206 | = "camlidl_plplot_core_c_plgcompression" 207 | 208 | external plgdev : unit -> string 209 | = "camlidl_plplot_core_c_plgdev" 210 | 211 | external plgdidev : unit -> float * float * float * float 212 | = "camlidl_plplot_core_c_plgdidev" 213 | 214 | external plgdiori : unit -> float 215 | = "camlidl_plplot_core_c_plgdiori" 216 | 217 | external plgdiplt : unit -> float * float * float * float 218 | = "camlidl_plplot_core_c_plgdiplt" 219 | 220 | external plgdrawmode : unit -> plplot_draw_mode_enum 221 | = "camlidl_plplot_core_c_plgdrawmode" 222 | 223 | external plgfci : unit -> int64 224 | = "camlidl_plplot_core_c_plgfci" 225 | 226 | external plgfam : unit -> int * int * int 227 | = "camlidl_plplot_core_c_plgfam" 228 | 229 | external plgfnam : unit -> string 230 | = "camlidl_plplot_core_c_plgfnam" 231 | 232 | external plgfont : unit -> int * int * int 233 | = "camlidl_plplot_core_c_plgfont" 234 | 235 | external plglevel : unit -> plplot_run_level 236 | = "camlidl_plplot_core_c_plglevel" 237 | 238 | external plgpage : unit -> float * float * int * int * int * int 239 | = "camlidl_plplot_core_c_plgpage" 240 | 241 | external plgra : unit -> unit 242 | = "camlidl_plplot_core_c_plgra" 243 | 244 | external plgradient : float array -> float array -> float -> unit 245 | = "camlidl_plplot_core_c_plgradient" 246 | 247 | external plgspa : unit -> float * float * float * float 248 | = "camlidl_plplot_core_c_plgspa" 249 | 250 | external plgstrm : unit -> int 251 | = "camlidl_plplot_core_c_plgstrm" 252 | 253 | external plgver : unit -> string 254 | = "camlidl_plplot_core_c_plgver" 255 | 256 | external plgvpd : unit -> float * float * float * float 257 | = "camlidl_plplot_core_c_plgvpd" 258 | 259 | external plgvpw : unit -> float * float * float * float 260 | = "camlidl_plplot_core_c_plgvpw" 261 | 262 | external plgxax : unit -> int * int 263 | = "camlidl_plplot_core_c_plgxax" 264 | 265 | external plgyax : unit -> int * int 266 | = "camlidl_plplot_core_c_plgyax" 267 | 268 | external plgzax : unit -> int * int 269 | = "camlidl_plplot_core_c_plgzax" 270 | 271 | external plhist : float array -> float -> float -> int -> plplot_hist_style -> unit 272 | = "camlidl_plplot_core_c_plhist" 273 | 274 | external plhlsrgb : float -> float -> float -> float * float * float 275 | = "camlidl_plplot_core_c_plhlsrgb" 276 | 277 | external plinit : unit -> unit 278 | = "camlidl_plplot_core_c_plinit" 279 | 280 | external pljoin : float -> float -> float -> float -> unit 281 | = "camlidl_plplot_core_c_pljoin" 282 | 283 | external pllab : string -> string -> string -> unit 284 | = "camlidl_plplot_core_c_pllab" 285 | 286 | external pllightsource : float -> float -> float -> unit 287 | = "camlidl_plplot_core_c_pllightsource" 288 | 289 | external plline : float array -> float array -> unit 290 | = "camlidl_plplot_core_c_plline" 291 | 292 | external plline3 : float array -> float array -> float array -> unit 293 | = "camlidl_plplot_core_c_plline3" 294 | 295 | external pllsty : int -> unit 296 | = "camlidl_plplot_core_c_pllsty" 297 | 298 | external plmesh : float array -> float array -> float array array -> plplot3d_style -> unit 299 | = "camlidl_plplot_core_c_plmesh" 300 | 301 | external plmeshc : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 302 | = "camlidl_plplot_core_c_plmeshc" 303 | 304 | external plmkstrm : unit -> int 305 | = "camlidl_plplot_core_c_plmkstrm" 306 | 307 | external plmtex : string -> float -> float -> float -> string -> unit 308 | = "camlidl_plplot_core_c_plmtex" 309 | 310 | external plmtex3 : string -> float -> float -> float -> string -> unit 311 | = "camlidl_plplot_core_c_plmtex3" 312 | 313 | external plot3d : float array -> float array -> float array array -> plplot3d_style -> bool -> unit 314 | = "camlidl_plplot_core_c_plot3d" 315 | 316 | external plot3dc : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 317 | = "camlidl_plplot_core_c_plot3dc" 318 | 319 | external plpat : int array -> int array -> unit 320 | = "camlidl_plplot_core_c_plpat" 321 | 322 | external plpath : int -> float -> float -> float -> float -> unit 323 | = "camlidl_plplot_core_c_plpath" 324 | 325 | external plpoin : float array -> float array -> int -> unit 326 | = "camlidl_plplot_core_c_plpoin" 327 | 328 | external plpoin3 : float array -> float array -> float array -> int -> unit 329 | = "camlidl_plplot_core_c_plpoin3" 330 | 331 | external plprec : int -> int -> unit 332 | = "camlidl_plplot_core_c_plprec" 333 | 334 | external plpsty : int -> unit 335 | = "camlidl_plplot_core_c_plpsty" 336 | 337 | external plptex : float -> float -> float -> float -> float -> string -> unit 338 | = "camlidl_plplot_core_c_plptex_bytecode" "camlidl_plplot_core_c_plptex" 339 | 340 | external plptex3 : float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> string -> unit 341 | = "camlidl_plplot_core_c_plptex3_bytecode" "camlidl_plplot_core_c_plptex3" 342 | 343 | external plrandd : unit -> float 344 | = "camlidl_plplot_core_c_plrandd" 345 | 346 | external plreplot : unit -> unit 347 | = "camlidl_plplot_core_c_plreplot" 348 | 349 | external plrgbhls : float -> float -> float -> float * float * float 350 | = "camlidl_plplot_core_c_plrgbhls" 351 | 352 | external plschr : float -> float -> unit 353 | = "camlidl_plplot_core_c_plschr" 354 | 355 | external plscmap0 : int array -> int array -> int array -> unit 356 | = "camlidl_plplot_core_c_plscmap0" 357 | 358 | external plscmap0a : int array -> int array -> int array -> float array -> unit 359 | = "camlidl_plplot_core_c_plscmap0a" 360 | 361 | external plscmap0n : int -> unit 362 | = "camlidl_plplot_core_c_plscmap0n" 363 | 364 | external plscmap1 : int array -> int array -> int array -> unit 365 | = "camlidl_plplot_core_c_plscmap1" 366 | 367 | external plscmap1a : int array -> int array -> int array -> float array -> unit 368 | = "camlidl_plplot_core_c_plscmap1a" 369 | 370 | external plscmap1l : bool -> float array -> float array -> float array -> float array -> bool array option -> unit 371 | = "camlidl_plplot_core_c_plscmap1l_bytecode" "camlidl_plplot_core_c_plscmap1l" 372 | 373 | external plscmap1la : bool -> float array -> float array -> float array -> float array -> float array -> bool array option -> unit 374 | = "camlidl_plplot_core_c_plscmap1la_bytecode" "camlidl_plplot_core_c_plscmap1la" 375 | 376 | external plscmap1n : int -> unit 377 | = "camlidl_plplot_core_c_plscmap1n" 378 | 379 | external plscmap1_range : float -> float -> unit 380 | = "camlidl_plplot_core_c_plscmap1_range" 381 | 382 | external plscol0 : int -> int -> int -> int -> unit 383 | = "camlidl_plplot_core_c_plscol0" 384 | 385 | external plscol0a : int -> int -> int -> int -> float -> unit 386 | = "camlidl_plplot_core_c_plscol0a" 387 | 388 | external plscolbg : int -> int -> int -> unit 389 | = "camlidl_plplot_core_c_plscolbg" 390 | 391 | external plscolbga : int -> int -> int -> float -> unit 392 | = "camlidl_plplot_core_c_plscolbga" 393 | 394 | external plscolor : int -> unit 395 | = "camlidl_plplot_core_c_plscolor" 396 | 397 | external plscompression : int -> unit 398 | = "camlidl_plplot_core_c_plscompression" 399 | 400 | external plsdev : string -> unit 401 | = "camlidl_plplot_core_c_plsdev" 402 | 403 | external plsdidev : float -> float -> float -> float -> unit 404 | = "camlidl_plplot_core_c_plsdidev" 405 | 406 | external plsdimap : int -> int -> int -> int -> float -> float -> unit 407 | = "camlidl_plplot_core_c_plsdimap_bytecode" "camlidl_plplot_core_c_plsdimap" 408 | 409 | external plsdiori : float -> unit 410 | = "camlidl_plplot_core_c_plsdiori" 411 | 412 | external plsdiplt : float -> float -> float -> float -> unit 413 | = "camlidl_plplot_core_c_plsdiplt" 414 | 415 | external plsdiplz : float -> float -> float -> float -> unit 416 | = "camlidl_plplot_core_c_plsdiplz" 417 | 418 | external plseed : int64 -> unit 419 | = "camlidl_plplot_core_c_plseed" 420 | 421 | external plsesc : char -> unit 422 | = "camlidl_plplot_core_c_plsesc" 423 | 424 | external plsfam : int -> int -> int -> unit 425 | = "camlidl_plplot_core_c_plsfam" 426 | 427 | external plsfci : int64 -> unit 428 | = "camlidl_plplot_core_c_plsfci" 429 | 430 | external plsfnam : string -> unit 431 | = "camlidl_plplot_core_c_plsfnam" 432 | 433 | external plsfont : plplot_fci_family_enum -> plplot_fci_style_enum -> plplot_fci_weight_enum -> unit 434 | = "camlidl_plplot_core_c_plsfont" 435 | 436 | external plsmaj : float -> float -> unit 437 | = "camlidl_plplot_core_c_plsmaj" 438 | 439 | external plsmin : float -> float -> unit 440 | = "camlidl_plplot_core_c_plsmin" 441 | 442 | external plsdrawmode : plplot_draw_mode_enum -> unit 443 | = "camlidl_plplot_core_c_plsdrawmode" 444 | 445 | external plsori : int -> unit 446 | = "camlidl_plplot_core_c_plsori" 447 | 448 | external plspage : float -> float -> int -> int -> int -> int -> unit 449 | = "camlidl_plplot_core_c_plspage_bytecode" "camlidl_plplot_core_c_plspage" 450 | 451 | external plspal0 : string -> unit 452 | = "camlidl_plplot_core_c_plspal0" 453 | 454 | external plspal1 : string -> bool -> unit 455 | = "camlidl_plplot_core_c_plspal1" 456 | 457 | external plspause : bool -> unit 458 | = "camlidl_plplot_core_c_plspause" 459 | 460 | external plsstrm : int -> unit 461 | = "camlidl_plplot_core_c_plsstrm" 462 | 463 | external plssub : int -> int -> unit 464 | = "camlidl_plplot_core_c_plssub" 465 | 466 | external plssym : float -> float -> unit 467 | = "camlidl_plplot_core_c_plssym" 468 | 469 | external plstar : int -> int -> unit 470 | = "camlidl_plplot_core_c_plstar" 471 | 472 | external plstart : string -> int -> int -> unit 473 | = "camlidl_plplot_core_c_plstart" 474 | 475 | external plstring : float array -> float array -> string -> unit 476 | = "camlidl_plplot_core_c_plstring" 477 | 478 | external plstring3 : float array -> float array -> float array -> string -> unit 479 | = "camlidl_plplot_core_c_plstring3" 480 | 481 | external plstripa : int -> int -> float -> float -> unit 482 | = "camlidl_plplot_core_c_plstripa" 483 | 484 | external plstripd : int -> unit 485 | = "camlidl_plplot_core_c_plstripd" 486 | 487 | external plimage : float array array -> float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> unit 488 | = "camlidl_plplot_core_c_plimage_bytecode" "camlidl_plplot_core_c_plimage" 489 | 490 | external plstyl : int array -> int array -> unit 491 | = "camlidl_plplot_core_c_plstyl" 492 | 493 | external plsurf3d : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 494 | = "camlidl_plplot_core_c_plsurf3d" 495 | 496 | external plsvect : float array -> float array -> bool -> unit 497 | = "camlidl_plplot_core_c_plsvect" 498 | 499 | external plsvpa : float -> float -> float -> float -> unit 500 | = "camlidl_plplot_core_c_plsvpa" 501 | 502 | external plsxax : int -> int -> unit 503 | = "camlidl_plplot_core_c_plsxax" 504 | 505 | external plsxwin : int -> unit 506 | = "camlidl_plplot_core_plsxwin" 507 | 508 | external plsyax : int -> int -> unit 509 | = "camlidl_plplot_core_c_plsyax" 510 | 511 | external plsym : float array -> float array -> int -> unit 512 | = "camlidl_plplot_core_c_plsym" 513 | 514 | external plszax : int -> int -> unit 515 | = "camlidl_plplot_core_c_plszax" 516 | 517 | external pltext : unit -> unit 518 | = "camlidl_plplot_core_c_pltext" 519 | 520 | external pltimefmt : string -> unit 521 | = "camlidl_plplot_core_c_pltimefmt" 522 | 523 | external plvasp : float -> unit 524 | = "camlidl_plplot_core_c_plvasp" 525 | 526 | external plvpas : float -> float -> float -> float -> float -> unit 527 | = "camlidl_plplot_core_c_plvpas" 528 | 529 | external plvpor : float -> float -> float -> float -> unit 530 | = "camlidl_plplot_core_c_plvpor" 531 | 532 | external plvsta : unit -> unit 533 | = "camlidl_plplot_core_c_plvsta" 534 | 535 | external plw3d : float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> unit 536 | = "camlidl_plplot_core_c_plw3d_bytecode" "camlidl_plplot_core_c_plw3d" 537 | 538 | external plwidth : float -> unit 539 | = "camlidl_plplot_core_c_plwidth" 540 | 541 | external plwind : float -> float -> float -> float -> unit 542 | = "camlidl_plplot_core_c_plwind" 543 | 544 | external plxormod : bool -> bool 545 | = "camlidl_plplot_core_c_plxormod" 546 | 547 | external plsetopt : string -> string -> unit 548 | = "camlidl_plplot_core_c_plsetopt" 549 | 550 | external plMinMax2dGrid : float array array -> float * float 551 | = "camlidl_plplot_core_plMinMax2dGrid" 552 | 553 | external plcont : float array array -> int -> int -> int -> int -> float array -> unit 554 | = "camlidl_plplot_core_ml_plcont_bytecode" "camlidl_plplot_core_ml_plcont" 555 | 556 | external plshade : float array array -> float -> float -> float -> float -> float -> float -> int -> float -> float -> int -> float -> int -> float -> bool -> unit 557 | = "camlidl_plplot_core_ml_plshade_bytecode" "camlidl_plplot_core_ml_plshade" 558 | 559 | external plshades : float array array -> float -> float -> float -> float -> float array -> float -> int -> float -> bool -> unit 560 | = "camlidl_plplot_core_ml_plshades_bytecode" "camlidl_plplot_core_ml_plshades" 561 | 562 | external plimagefr : float array array -> float -> float -> float -> float -> float -> float -> float -> float -> unit 563 | = "camlidl_plplot_core_ml_plimagefr_bytecode" "camlidl_plplot_core_ml_plimagefr" 564 | 565 | external plvect : float array array -> float array array -> float -> unit 566 | = "camlidl_plplot_core_ml_plvect" 567 | 568 | external plmap : string -> float -> float -> float -> float -> unit 569 | = "camlidl_plplot_core_ml_plmap" 570 | 571 | external plmeridians : float -> float -> float -> float -> float -> float -> unit 572 | = "camlidl_plplot_core_ml_plmeridians_bytecode" "camlidl_plplot_core_ml_plmeridians" 573 | 574 | external plpoly3 : float array -> float array -> float array -> bool array -> bool -> unit 575 | = "camlidl_plplot_core_ml_plpoly3" 576 | 577 | external pltr0 : float -> float -> float * float 578 | = "camlidl_plplot_core_ml_pltr0" 579 | 580 | external plsvect_reset : unit -> unit 581 | = "camlidl_plplot_core_ml_plsvect_reset" 582 | 583 | external plg_current_col0 : unit -> int 584 | = "camlidl_plplot_core_plg_current_col0" 585 | 586 | external plg_current_col1 : unit -> float 587 | = "camlidl_plplot_core_plg_current_col1" 588 | 589 | external plgwidth : unit -> float 590 | = "camlidl_plplot_core_plgwidth" 591 | 592 | external plgchrht : unit -> float 593 | = "camlidl_plplot_core_plgchrht" 594 | 595 | external plstripc : string -> string -> float -> float -> float -> float -> float -> float -> float -> bool -> bool -> int -> int -> int array -> int array -> string array -> string -> string -> string -> int = "ml_plstripc_byte" "ml_plstripc" 596 | external pltr1 : float array -> float array -> float -> float -> float * float = "ml_pltr1" 597 | external pltr2 : float array array -> float array array -> float -> float -> float * float = "ml_pltr2" 598 | let plset_pltr (f : float -> float -> (float * float)) = Callback.register "caml_plplot_plotter" f 599 | let plunset_pltr () = Callback.register "caml_plplot_plotter" 0 600 | let plset_mapform (f : float -> float -> (float * float)) = Callback.register "caml_plplot_mapform" f 601 | let plunset_mapform () = Callback.register "caml_plplot_mapform" 0 602 | let plset_defined (f : float -> float -> int) = Callback.register "caml_plplot_defined" f 603 | let plunset_defined () = Callback.register "caml_plplot_defined" 0 604 | external ml_plstransform : unit -> unit = "ml_plstransform" 605 | let plstransform (f : float -> float -> (float * float)) = Callback.register "caml_plplot_transform" f; ml_plstransform () 606 | let plunset_transform () = Callback.register "caml_plplot_transform" 0; ml_plstransform () 607 | type plplot_grid_method_type = PL_GRID_CSA | PL_GRID_DTLI | PL_GRID_NNI | PL_GRID_NNIDW | PL_GRID_NNLI | PL_GRID_NNAIDW 608 | type plplot_parse_method_type = PL_PARSE_PARTIAL | PL_PARSE_FULL | PL_PARSE_QUIET | PL_PARSE_NODELETE | PL_PARSE_SHOWALL | PL_PARSE_OVERRIDE | PL_PARSE_NOPROGRAM | PL_PARSE_NODASH | PL_PARSE_SKIP 609 | type plplot_axis_type = PL_X_AXIS | PL_Y_AXIS | PL_Z_AXIS 610 | external ml_plslabelfunc : unit -> unit = "ml_plslabelfunc" 611 | let plslabelfunc (f : plplot_axis_type -> float -> string) = Callback.register "caml_plplot_customlabel" f; ml_plslabelfunc () 612 | let plunset_labelfunc () = Callback.register "caml_plplot_customlabel" 0; ml_plslabelfunc () 613 | external ml_plsabort : unit -> unit = "ml_plsabort" 614 | let plsabort (f : string -> unit) = Callback.register "caml_plplot_abort" f; ml_plsabort () 615 | let plunset_abort () = Callback.register "caml_plplot_abort" 0; ml_plsabort () 616 | external ml_plsexit : unit -> unit = "ml_plsexit" 617 | let plsexit (f : string -> int) = Callback.register "caml_plplot_exit" f; ml_plsexit () 618 | let plunset_exit () = Callback.register "caml_plplot_exit" 0; ml_plsexit () 619 | external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata" 620 | external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts" 621 | external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> float array -> int array -> int array -> float array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend" 622 | external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> float -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar" 623 | -------------------------------------------------------------------------------- /src/plplot_core.mli: -------------------------------------------------------------------------------- 1 | (* File generated from plplot_core.idl *) 2 | 3 | type plplot3d_style_enum = 4 | | PL_DIFFUSE 5 | | PL_DRAW_LINEX 6 | | PL_DRAW_LINEY 7 | | PL_DRAW_LINEXY 8 | | PL_MAG_COLOR 9 | | PL_BASE_CONT 10 | | PL_TOP_CONT 11 | | PL_SURF_CONT 12 | | PL_DRAW_SIDES 13 | | PL_FACETED 14 | | PL_MESH 15 | and plplot3d_style = plplot3d_style_enum list 16 | and plplot_bin_enum = 17 | | PL_BIN_DEFAULT 18 | | PL_BIN_CENTRED 19 | | PL_BIN_NOEXPAND 20 | | PL_BIN_NOEMPTY 21 | and plplot_bin_style = plplot_bin_enum list 22 | and plplot_hist_enum = 23 | | PL_HIST_DEFAULT 24 | | PL_HIST_NOSCALING 25 | | PL_HIST_IGNORE_OUTLIERS 26 | | PL_HIST_NOEXPAND 27 | | PL_HIST_NOEMPTY 28 | and plplot_hist_style = plplot_hist_enum list 29 | and plplot_run_level_enum = 30 | | PL_UNINITIALIZED 31 | | PL_INITIALIZED 32 | | PL_VIEWPORT_DEFINED 33 | | PL_WORLD_COORDINATES_DEFINED 34 | and plplot_run_level = plplot_run_level_enum 35 | and plplot_position_enum = 36 | | PL_POSITION_LEFT 37 | | PL_POSITION_RIGHT 38 | | PL_POSITION_TOP 39 | | PL_POSITION_BOTTOM 40 | | PL_POSITION_INSIDE 41 | | PL_POSITION_OUTSIDE 42 | | PL_POSITION_VIEWPORT 43 | | PL_POSITION_SUBPAGE 44 | and plplot_position_opt = plplot_position_enum list 45 | and plplot_legend_enum = 46 | | PL_LEGEND_NONE 47 | | PL_LEGEND_COLOR_BOX 48 | | PL_LEGEND_LINE 49 | | PL_LEGEND_SYMBOL 50 | | PL_LEGEND_TEXT_LEFT 51 | | PL_LEGEND_BACKGROUND 52 | | PL_LEGEND_BOUNDING_BOX 53 | | PL_LEGEND_ROW_MAJOR 54 | and plplot_legend_opt = plplot_legend_enum list 55 | and plplot_colorbar_enum = 56 | | PL_COLORBAR_LABEL_LEFT 57 | | PL_COLORBAR_LABEL_RIGHT 58 | | PL_COLORBAR_LABEL_TOP 59 | | PL_COLORBAR_LABEL_BOTTOM 60 | | PL_COLORBAR_IMAGE 61 | | PL_COLORBAR_SHADE 62 | | PL_COLORBAR_GRADIENT 63 | | PL_COLORBAR_CAP_NONE 64 | | PL_COLORBAR_CAP_LOW 65 | | PL_COLORBAR_CAP_HIGH 66 | | PL_COLORBAR_SHADE_LABEL 67 | | PL_COLORBAR_ORIENT_RIGHT 68 | | PL_COLORBAR_ORIENT_TOP 69 | | PL_COLORBAR_ORIENT_LEFT 70 | | PL_COLORBAR_ORIENT_BOTTOM 71 | | PL_COLORBAR_BACKGROUND 72 | | PL_COLORBAR_BOUNDING_BOX 73 | and plplot_colorbar_opt = plplot_colorbar_enum list 74 | and plplot_fci_family_enum = 75 | | PL_FCI_FAMILY_UNCHANGED 76 | | PL_FCI_SANS 77 | | PL_FCI_SERIF 78 | | PL_FCI_MONO 79 | | PL_FCI_SCRIPT 80 | | PL_FCI_SYMBOL 81 | and plplot_fci_style_enum = 82 | | PL_FCI_STYLE_UNCHANGED 83 | | PL_FCI_UPRIGHT 84 | | PL_FCI_ITALIC 85 | | PL_FCI_OBLIQUE 86 | and plplot_fci_weight_enum = 87 | | PL_FCI_WEIGHT_UNCHANGED 88 | | PL_FCI_MEDIUM 89 | | PL_FCI_BOLD 90 | and plplot_draw_mode_enum = 91 | | PL_DRAWMODE_UNKNOWN 92 | | PL_DRAWMODE_DEFAULT 93 | | PL_DRAWMODE_REPLACE 94 | | PL_DRAWMODE_XOR 95 | and nonzero_error_int = int 96 | 97 | external pl_setcontlabelformat : int -> int -> unit 98 | = "camlidl_plplot_core_c_pl_setcontlabelformat" 99 | 100 | external pl_setcontlabelparam : float -> float -> float -> int -> unit 101 | = "camlidl_plplot_core_c_pl_setcontlabelparam" 102 | 103 | external pladv : int -> unit 104 | = "camlidl_plplot_core_c_pladv" 105 | 106 | external plarc : float -> float -> float -> float -> float -> float -> float -> bool -> unit 107 | = "camlidl_plplot_core_c_plarc_bytecode" "camlidl_plplot_core_c_plarc" 108 | 109 | external plaxes : float -> float -> string -> float -> int -> string -> float -> int -> unit 110 | = "camlidl_plplot_core_c_plaxes_bytecode" "camlidl_plplot_core_c_plaxes" 111 | 112 | external plbin : float array -> float array -> plplot_bin_style -> unit 113 | = "camlidl_plplot_core_c_plbin" 114 | 115 | external plbtime : float -> int * int * int * int * int * float 116 | = "camlidl_plplot_core_c_plbtime" 117 | 118 | external plbop : unit -> unit 119 | = "camlidl_plplot_core_c_plbop" 120 | 121 | external plbox : string -> float -> int -> string -> float -> int -> unit 122 | = "camlidl_plplot_core_c_plbox_bytecode" "camlidl_plplot_core_c_plbox" 123 | 124 | external plbox3 : string -> string -> float -> int -> string -> string -> float -> int -> string -> string -> float -> int -> unit 125 | = "camlidl_plplot_core_c_plbox3_bytecode" "camlidl_plplot_core_c_plbox3" 126 | 127 | external plcalc_world : float -> float -> float * float * int 128 | = "camlidl_plplot_core_c_plcalc_world" 129 | 130 | external plclear : unit -> unit 131 | = "camlidl_plplot_core_c_plclear" 132 | 133 | external plcol0 : int -> unit 134 | = "camlidl_plplot_core_c_plcol0" 135 | 136 | external plcol1 : float -> unit 137 | = "camlidl_plplot_core_c_plcol1" 138 | 139 | external plconfigtime : float -> float -> float -> int -> bool -> int -> int -> int -> int -> int -> float -> unit 140 | = "camlidl_plplot_core_c_plconfigtime_bytecode" "camlidl_plplot_core_c_plconfigtime" 141 | 142 | external plcpstrm : int -> bool -> unit 143 | = "camlidl_plplot_core_c_plcpstrm" 144 | 145 | external plctime : int -> int -> int -> int -> int -> float -> float 146 | = "camlidl_plplot_core_c_plctime_bytecode" "camlidl_plplot_core_c_plctime" 147 | 148 | external plend : unit -> unit 149 | = "camlidl_plplot_core_c_plend" 150 | 151 | external plend1 : unit -> unit 152 | = "camlidl_plplot_core_c_plend1" 153 | 154 | external plenv : float -> float -> float -> float -> int -> int -> unit 155 | = "camlidl_plplot_core_c_plenv_bytecode" "camlidl_plplot_core_c_plenv" 156 | 157 | external plenv0 : float -> float -> float -> float -> int -> int -> unit 158 | = "camlidl_plplot_core_c_plenv0_bytecode" "camlidl_plplot_core_c_plenv0" 159 | 160 | external pleop : unit -> unit 161 | = "camlidl_plplot_core_c_pleop" 162 | 163 | external plerrx : float array -> float array -> float array -> unit 164 | = "camlidl_plplot_core_c_plerrx" 165 | 166 | external plerry : float array -> float array -> float array -> unit 167 | = "camlidl_plplot_core_c_plerry" 168 | 169 | external plfamadv : unit -> unit 170 | = "camlidl_plplot_core_c_plfamadv" 171 | 172 | external plfill : float array -> float array -> unit 173 | = "camlidl_plplot_core_c_plfill" 174 | 175 | external plfill3 : float array -> float array -> float array -> unit 176 | = "camlidl_plplot_core_c_plfill3" 177 | 178 | external plflush : unit -> unit 179 | = "camlidl_plplot_core_c_plflush" 180 | 181 | external plfont : int -> unit 182 | = "camlidl_plplot_core_c_plfont" 183 | 184 | external plfontld : int -> unit 185 | = "camlidl_plplot_core_c_plfontld" 186 | 187 | external plgchr : unit -> float * float 188 | = "camlidl_plplot_core_c_plgchr" 189 | 190 | external plgcmap1_range : unit -> float * float 191 | = "camlidl_plplot_core_c_plgcmap1_range" 192 | 193 | external plgcol0 : int -> int * int * int 194 | = "camlidl_plplot_core_c_plgcol0" 195 | 196 | external plgcol0a : int -> int * int * int * float 197 | = "camlidl_plplot_core_c_plgcol0a" 198 | 199 | external plgcolbg : unit -> int * int * int 200 | = "camlidl_plplot_core_c_plgcolbg" 201 | 202 | external plgcolbga : unit -> int * int * int * float 203 | = "camlidl_plplot_core_c_plgcolbga" 204 | 205 | external plgcompression : unit -> int 206 | = "camlidl_plplot_core_c_plgcompression" 207 | 208 | external plgdev : unit -> string 209 | = "camlidl_plplot_core_c_plgdev" 210 | 211 | external plgdidev : unit -> float * float * float * float 212 | = "camlidl_plplot_core_c_plgdidev" 213 | 214 | external plgdiori : unit -> float 215 | = "camlidl_plplot_core_c_plgdiori" 216 | 217 | external plgdiplt : unit -> float * float * float * float 218 | = "camlidl_plplot_core_c_plgdiplt" 219 | 220 | external plgdrawmode : unit -> plplot_draw_mode_enum 221 | = "camlidl_plplot_core_c_plgdrawmode" 222 | 223 | external plgfci : unit -> int64 224 | = "camlidl_plplot_core_c_plgfci" 225 | 226 | external plgfam : unit -> int * int * int 227 | = "camlidl_plplot_core_c_plgfam" 228 | 229 | external plgfnam : unit -> string 230 | = "camlidl_plplot_core_c_plgfnam" 231 | 232 | external plgfont : unit -> int * int * int 233 | = "camlidl_plplot_core_c_plgfont" 234 | 235 | external plglevel : unit -> plplot_run_level 236 | = "camlidl_plplot_core_c_plglevel" 237 | 238 | external plgpage : unit -> float * float * int * int * int * int 239 | = "camlidl_plplot_core_c_plgpage" 240 | 241 | external plgra : unit -> unit 242 | = "camlidl_plplot_core_c_plgra" 243 | 244 | external plgradient : float array -> float array -> float -> unit 245 | = "camlidl_plplot_core_c_plgradient" 246 | 247 | external plgspa : unit -> float * float * float * float 248 | = "camlidl_plplot_core_c_plgspa" 249 | 250 | external plgstrm : unit -> int 251 | = "camlidl_plplot_core_c_plgstrm" 252 | 253 | external plgver : unit -> string 254 | = "camlidl_plplot_core_c_plgver" 255 | 256 | external plgvpd : unit -> float * float * float * float 257 | = "camlidl_plplot_core_c_plgvpd" 258 | 259 | external plgvpw : unit -> float * float * float * float 260 | = "camlidl_plplot_core_c_plgvpw" 261 | 262 | external plgxax : unit -> int * int 263 | = "camlidl_plplot_core_c_plgxax" 264 | 265 | external plgyax : unit -> int * int 266 | = "camlidl_plplot_core_c_plgyax" 267 | 268 | external plgzax : unit -> int * int 269 | = "camlidl_plplot_core_c_plgzax" 270 | 271 | external plhist : float array -> float -> float -> int -> plplot_hist_style -> unit 272 | = "camlidl_plplot_core_c_plhist" 273 | 274 | external plhlsrgb : float -> float -> float -> float * float * float 275 | = "camlidl_plplot_core_c_plhlsrgb" 276 | 277 | external plinit : unit -> unit 278 | = "camlidl_plplot_core_c_plinit" 279 | 280 | external pljoin : float -> float -> float -> float -> unit 281 | = "camlidl_plplot_core_c_pljoin" 282 | 283 | external pllab : string -> string -> string -> unit 284 | = "camlidl_plplot_core_c_pllab" 285 | 286 | external pllightsource : float -> float -> float -> unit 287 | = "camlidl_plplot_core_c_pllightsource" 288 | 289 | external plline : float array -> float array -> unit 290 | = "camlidl_plplot_core_c_plline" 291 | 292 | external plline3 : float array -> float array -> float array -> unit 293 | = "camlidl_plplot_core_c_plline3" 294 | 295 | external pllsty : int -> unit 296 | = "camlidl_plplot_core_c_pllsty" 297 | 298 | external plmesh : float array -> float array -> float array array -> plplot3d_style -> unit 299 | = "camlidl_plplot_core_c_plmesh" 300 | 301 | external plmeshc : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 302 | = "camlidl_plplot_core_c_plmeshc" 303 | 304 | external plmkstrm : unit -> int 305 | = "camlidl_plplot_core_c_plmkstrm" 306 | 307 | external plmtex : string -> float -> float -> float -> string -> unit 308 | = "camlidl_plplot_core_c_plmtex" 309 | 310 | external plmtex3 : string -> float -> float -> float -> string -> unit 311 | = "camlidl_plplot_core_c_plmtex3" 312 | 313 | external plot3d : float array -> float array -> float array array -> plplot3d_style -> bool -> unit 314 | = "camlidl_plplot_core_c_plot3d" 315 | 316 | external plot3dc : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 317 | = "camlidl_plplot_core_c_plot3dc" 318 | 319 | external plpat : int array -> int array -> unit 320 | = "camlidl_plplot_core_c_plpat" 321 | 322 | external plpath : int -> float -> float -> float -> float -> unit 323 | = "camlidl_plplot_core_c_plpath" 324 | 325 | external plpoin : float array -> float array -> int -> unit 326 | = "camlidl_plplot_core_c_plpoin" 327 | 328 | external plpoin3 : float array -> float array -> float array -> int -> unit 329 | = "camlidl_plplot_core_c_plpoin3" 330 | 331 | external plprec : int -> int -> unit 332 | = "camlidl_plplot_core_c_plprec" 333 | 334 | external plpsty : int -> unit 335 | = "camlidl_plplot_core_c_plpsty" 336 | 337 | external plptex : float -> float -> float -> float -> float -> string -> unit 338 | = "camlidl_plplot_core_c_plptex_bytecode" "camlidl_plplot_core_c_plptex" 339 | 340 | external plptex3 : float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> string -> unit 341 | = "camlidl_plplot_core_c_plptex3_bytecode" "camlidl_plplot_core_c_plptex3" 342 | 343 | external plrandd : unit -> float 344 | = "camlidl_plplot_core_c_plrandd" 345 | 346 | external plreplot : unit -> unit 347 | = "camlidl_plplot_core_c_plreplot" 348 | 349 | external plrgbhls : float -> float -> float -> float * float * float 350 | = "camlidl_plplot_core_c_plrgbhls" 351 | 352 | external plschr : float -> float -> unit 353 | = "camlidl_plplot_core_c_plschr" 354 | 355 | external plscmap0 : int array -> int array -> int array -> unit 356 | = "camlidl_plplot_core_c_plscmap0" 357 | 358 | external plscmap0a : int array -> int array -> int array -> float array -> unit 359 | = "camlidl_plplot_core_c_plscmap0a" 360 | 361 | external plscmap0n : int -> unit 362 | = "camlidl_plplot_core_c_plscmap0n" 363 | 364 | external plscmap1 : int array -> int array -> int array -> unit 365 | = "camlidl_plplot_core_c_plscmap1" 366 | 367 | external plscmap1a : int array -> int array -> int array -> float array -> unit 368 | = "camlidl_plplot_core_c_plscmap1a" 369 | 370 | external plscmap1l : bool -> float array -> float array -> float array -> float array -> bool array option -> unit 371 | = "camlidl_plplot_core_c_plscmap1l_bytecode" "camlidl_plplot_core_c_plscmap1l" 372 | 373 | external plscmap1la : bool -> float array -> float array -> float array -> float array -> float array -> bool array option -> unit 374 | = "camlidl_plplot_core_c_plscmap1la_bytecode" "camlidl_plplot_core_c_plscmap1la" 375 | 376 | external plscmap1n : int -> unit 377 | = "camlidl_plplot_core_c_plscmap1n" 378 | 379 | external plscmap1_range : float -> float -> unit 380 | = "camlidl_plplot_core_c_plscmap1_range" 381 | 382 | external plscol0 : int -> int -> int -> int -> unit 383 | = "camlidl_plplot_core_c_plscol0" 384 | 385 | external plscol0a : int -> int -> int -> int -> float -> unit 386 | = "camlidl_plplot_core_c_plscol0a" 387 | 388 | external plscolbg : int -> int -> int -> unit 389 | = "camlidl_plplot_core_c_plscolbg" 390 | 391 | external plscolbga : int -> int -> int -> float -> unit 392 | = "camlidl_plplot_core_c_plscolbga" 393 | 394 | external plscolor : int -> unit 395 | = "camlidl_plplot_core_c_plscolor" 396 | 397 | external plscompression : int -> unit 398 | = "camlidl_plplot_core_c_plscompression" 399 | 400 | external plsdev : string -> unit 401 | = "camlidl_plplot_core_c_plsdev" 402 | 403 | external plsdidev : float -> float -> float -> float -> unit 404 | = "camlidl_plplot_core_c_plsdidev" 405 | 406 | external plsdimap : int -> int -> int -> int -> float -> float -> unit 407 | = "camlidl_plplot_core_c_plsdimap_bytecode" "camlidl_plplot_core_c_plsdimap" 408 | 409 | external plsdiori : float -> unit 410 | = "camlidl_plplot_core_c_plsdiori" 411 | 412 | external plsdiplt : float -> float -> float -> float -> unit 413 | = "camlidl_plplot_core_c_plsdiplt" 414 | 415 | external plsdiplz : float -> float -> float -> float -> unit 416 | = "camlidl_plplot_core_c_plsdiplz" 417 | 418 | external plseed : int64 -> unit 419 | = "camlidl_plplot_core_c_plseed" 420 | 421 | external plsesc : char -> unit 422 | = "camlidl_plplot_core_c_plsesc" 423 | 424 | external plsfam : int -> int -> int -> unit 425 | = "camlidl_plplot_core_c_plsfam" 426 | 427 | external plsfci : int64 -> unit 428 | = "camlidl_plplot_core_c_plsfci" 429 | 430 | external plsfnam : string -> unit 431 | = "camlidl_plplot_core_c_plsfnam" 432 | 433 | external plsfont : plplot_fci_family_enum -> plplot_fci_style_enum -> plplot_fci_weight_enum -> unit 434 | = "camlidl_plplot_core_c_plsfont" 435 | 436 | external plsmaj : float -> float -> unit 437 | = "camlidl_plplot_core_c_plsmaj" 438 | 439 | external plsmin : float -> float -> unit 440 | = "camlidl_plplot_core_c_plsmin" 441 | 442 | external plsdrawmode : plplot_draw_mode_enum -> unit 443 | = "camlidl_plplot_core_c_plsdrawmode" 444 | 445 | external plsori : int -> unit 446 | = "camlidl_plplot_core_c_plsori" 447 | 448 | external plspage : float -> float -> int -> int -> int -> int -> unit 449 | = "camlidl_plplot_core_c_plspage_bytecode" "camlidl_plplot_core_c_plspage" 450 | 451 | external plspal0 : string -> unit 452 | = "camlidl_plplot_core_c_plspal0" 453 | 454 | external plspal1 : string -> bool -> unit 455 | = "camlidl_plplot_core_c_plspal1" 456 | 457 | external plspause : bool -> unit 458 | = "camlidl_plplot_core_c_plspause" 459 | 460 | external plsstrm : int -> unit 461 | = "camlidl_plplot_core_c_plsstrm" 462 | 463 | external plssub : int -> int -> unit 464 | = "camlidl_plplot_core_c_plssub" 465 | 466 | external plssym : float -> float -> unit 467 | = "camlidl_plplot_core_c_plssym" 468 | 469 | external plstar : int -> int -> unit 470 | = "camlidl_plplot_core_c_plstar" 471 | 472 | external plstart : string -> int -> int -> unit 473 | = "camlidl_plplot_core_c_plstart" 474 | 475 | external plstring : float array -> float array -> string -> unit 476 | = "camlidl_plplot_core_c_plstring" 477 | 478 | external plstring3 : float array -> float array -> float array -> string -> unit 479 | = "camlidl_plplot_core_c_plstring3" 480 | 481 | external plstripa : int -> int -> float -> float -> unit 482 | = "camlidl_plplot_core_c_plstripa" 483 | 484 | external plstripd : int -> unit 485 | = "camlidl_plplot_core_c_plstripd" 486 | 487 | external plimage : float array array -> float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> unit 488 | = "camlidl_plplot_core_c_plimage_bytecode" "camlidl_plplot_core_c_plimage" 489 | 490 | external plstyl : int array -> int array -> unit 491 | = "camlidl_plplot_core_c_plstyl" 492 | 493 | external plsurf3d : float array -> float array -> float array array -> plplot3d_style -> float array -> unit 494 | = "camlidl_plplot_core_c_plsurf3d" 495 | 496 | external plsvect : float array -> float array -> bool -> unit 497 | = "camlidl_plplot_core_c_plsvect" 498 | 499 | external plsvpa : float -> float -> float -> float -> unit 500 | = "camlidl_plplot_core_c_plsvpa" 501 | 502 | external plsxax : int -> int -> unit 503 | = "camlidl_plplot_core_c_plsxax" 504 | 505 | external plsxwin : int -> unit 506 | = "camlidl_plplot_core_plsxwin" 507 | 508 | external plsyax : int -> int -> unit 509 | = "camlidl_plplot_core_c_plsyax" 510 | 511 | external plsym : float array -> float array -> int -> unit 512 | = "camlidl_plplot_core_c_plsym" 513 | 514 | external plszax : int -> int -> unit 515 | = "camlidl_plplot_core_c_plszax" 516 | 517 | external pltext : unit -> unit 518 | = "camlidl_plplot_core_c_pltext" 519 | 520 | external pltimefmt : string -> unit 521 | = "camlidl_plplot_core_c_pltimefmt" 522 | 523 | external plvasp : float -> unit 524 | = "camlidl_plplot_core_c_plvasp" 525 | 526 | external plvpas : float -> float -> float -> float -> float -> unit 527 | = "camlidl_plplot_core_c_plvpas" 528 | 529 | external plvpor : float -> float -> float -> float -> unit 530 | = "camlidl_plplot_core_c_plvpor" 531 | 532 | external plvsta : unit -> unit 533 | = "camlidl_plplot_core_c_plvsta" 534 | 535 | external plw3d : float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> float -> unit 536 | = "camlidl_plplot_core_c_plw3d_bytecode" "camlidl_plplot_core_c_plw3d" 537 | 538 | external plwidth : float -> unit 539 | = "camlidl_plplot_core_c_plwidth" 540 | 541 | external plwind : float -> float -> float -> float -> unit 542 | = "camlidl_plplot_core_c_plwind" 543 | 544 | external plxormod : bool -> bool 545 | = "camlidl_plplot_core_c_plxormod" 546 | 547 | external plsetopt : string -> string -> unit 548 | = "camlidl_plplot_core_c_plsetopt" 549 | 550 | external plMinMax2dGrid : float array array -> float * float 551 | = "camlidl_plplot_core_plMinMax2dGrid" 552 | 553 | external plcont : float array array -> int -> int -> int -> int -> float array -> unit 554 | = "camlidl_plplot_core_ml_plcont_bytecode" "camlidl_plplot_core_ml_plcont" 555 | 556 | external plshade : float array array -> float -> float -> float -> float -> float -> float -> int -> float -> float -> int -> float -> int -> float -> bool -> unit 557 | = "camlidl_plplot_core_ml_plshade_bytecode" "camlidl_plplot_core_ml_plshade" 558 | 559 | external plshades : float array array -> float -> float -> float -> float -> float array -> float -> int -> float -> bool -> unit 560 | = "camlidl_plplot_core_ml_plshades_bytecode" "camlidl_plplot_core_ml_plshades" 561 | 562 | external plimagefr : float array array -> float -> float -> float -> float -> float -> float -> float -> float -> unit 563 | = "camlidl_plplot_core_ml_plimagefr_bytecode" "camlidl_plplot_core_ml_plimagefr" 564 | 565 | external plvect : float array array -> float array array -> float -> unit 566 | = "camlidl_plplot_core_ml_plvect" 567 | 568 | external plmap : string -> float -> float -> float -> float -> unit 569 | = "camlidl_plplot_core_ml_plmap" 570 | 571 | external plmeridians : float -> float -> float -> float -> float -> float -> unit 572 | = "camlidl_plplot_core_ml_plmeridians_bytecode" "camlidl_plplot_core_ml_plmeridians" 573 | 574 | external plpoly3 : float array -> float array -> float array -> bool array -> bool -> unit 575 | = "camlidl_plplot_core_ml_plpoly3" 576 | 577 | external pltr0 : float -> float -> float * float 578 | = "camlidl_plplot_core_ml_pltr0" 579 | 580 | external plsvect_reset : unit -> unit 581 | = "camlidl_plplot_core_ml_plsvect_reset" 582 | 583 | external plg_current_col0 : unit -> int 584 | = "camlidl_plplot_core_plg_current_col0" 585 | 586 | external plg_current_col1 : unit -> float 587 | = "camlidl_plplot_core_plg_current_col1" 588 | 589 | external plgwidth : unit -> float 590 | = "camlidl_plplot_core_plgwidth" 591 | 592 | external plgchrht : unit -> float 593 | = "camlidl_plplot_core_plgchrht" 594 | 595 | external plstripc : string -> string -> float -> float -> float -> float -> float -> float -> float -> bool -> bool -> int -> int -> int array -> int array -> string array -> string -> string -> string -> int = "ml_plstripc_byte" "ml_plstripc" 596 | external pltr1 : float array -> float array -> float -> float -> float * float = "ml_pltr1" 597 | external pltr2 : float array array -> float array array -> float -> float -> float * float = "ml_pltr2" 598 | val plset_pltr : (float -> float -> (float * float)) -> unit 599 | val plunset_pltr : unit -> unit 600 | val plset_mapform : (float -> float -> (float * float)) -> unit 601 | val plunset_mapform : unit -> unit 602 | val plset_defined : (float -> float -> int) -> unit 603 | val plunset_defined : unit -> unit 604 | val plstransform : (float -> float -> (float * float)) -> unit 605 | val plunset_transform : unit -> unit 606 | type plplot_grid_method_type = PL_GRID_CSA | PL_GRID_DTLI | PL_GRID_NNI | PL_GRID_NNIDW | PL_GRID_NNLI | PL_GRID_NNAIDW 607 | type plplot_parse_method_type = PL_PARSE_PARTIAL | PL_PARSE_FULL | PL_PARSE_QUIET | PL_PARSE_NODELETE | PL_PARSE_SHOWALL | PL_PARSE_OVERRIDE | PL_PARSE_NOPROGRAM | PL_PARSE_NODASH | PL_PARSE_SKIP 608 | type plplot_axis_type = PL_X_AXIS | PL_Y_AXIS | PL_Z_AXIS 609 | val plslabelfunc : (plplot_axis_type -> float -> string) -> unit 610 | val plunset_labelfunc : unit -> unit 611 | val plsabort : (string -> unit) -> unit 612 | val plunset_abort : unit -> unit 613 | val plsexit : (string -> int) -> unit 614 | val plunset_exit : unit -> unit 615 | external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata" 616 | external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts" 617 | external pllegend : plplot_legend_opt -> plplot_position_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> float array -> int array -> int array -> float array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend" 618 | external plcolorbar : plplot_colorbar_opt -> plplot_position_opt -> float -> float -> float -> float -> int -> int -> int -> float -> float -> int -> float -> plplot_colorbar_opt array -> string array -> string array -> float array -> int array -> float array array -> float * float = "ml_plcolorbar_byte" "ml_plcolorbar" 619 | -------------------------------------------------------------------------------- /src/plplot_impl.c: -------------------------------------------------------------------------------- 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 . 18 | // 19 | 20 | // The "usual" OCaml includes 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | #undef snprintf 33 | 34 | #include 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 | 45 | typedef void ( *ML_PLOTTER_FUNC )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ); 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. 89 | PLINT ml_defined( PLFLT x, PLFLT y ) 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. 231 | ML_PLOTTER_FUNC get_ml_plotter_func() 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 | } 248 | ML_DEFINED_FUNC get_ml_defined_func() 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 | } 265 | ML_MAPFORM_FUNC get_ml_mapform_func() 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 284 | value ml_plslabelfunc( value unit ) 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 306 | value ml_plsabort( value unit ) 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 | } 325 | value ml_plsexit( value unit ) 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 346 | value ml_plstransform( value unit ) 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, 419 | get_ml_defined_func(), 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, 451 | PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 452 | PLFLT *clevel, PLINT nlevel, PLFLT fill_width, 453 | PLINT cont_color, PLFLT cont_width, 454 | PLBOOL rectangular ) 455 | { 456 | c_plshades( a, nx, ny, 457 | get_ml_defined_func(), 458 | xmin, xmax, ymin, ymax, 459 | clevel, nlevel, fill_width, 460 | cont_color, cont_width, 461 | plfill, rectangular, 462 | get_ml_plotter_func(), 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, 475 | PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 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, 483 | get_ml_plotter_func(), 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, 496 | get_ml_plotter_func(), 497 | (void *) 1 ); 498 | } 499 | 500 | // 501 | // Wrapper to reset vector rendering 502 | // 503 | void ml_plsvect_reset() 504 | { 505 | c_plsvect( NULL, NULL, 0, 0 ); 506 | } 507 | 508 | // 509 | // void 510 | // c_plmap( void (*mapform)(PLINT, PLFLT *, PLFLT *), const char *type, 511 | // PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); 512 | // 513 | void ml_plmap( const char *type, 514 | PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ) 515 | { 516 | c_plmap( get_ml_mapform_func(), 517 | type, minlong, maxlong, minlat, maxlat ); 518 | } 519 | 520 | // 521 | // void 522 | // c_plmeridians( void (*mapform)(PLINT, PLFLT *, PLFLT *), 523 | // PLFLT dlong, PLFLT dlat, 524 | // PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); 525 | // 526 | void ml_plmeridians( PLFLT dlong, PLFLT dlat, 527 | PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ) 528 | { 529 | c_plmeridians( get_ml_mapform_func(), 530 | dlong, dlat, minlong, maxlong, minlat, maxlat ); 531 | } 532 | 533 | // 534 | // void 535 | // c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, 536 | // PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, 537 | // PLFLT **zg, PLINT type, PLFLT data); 538 | // 539 | // This one is currently wrapped by hand, as I am not sure how to get camlidl 540 | // to allocate zg in a way that makes plgriddata happy and doesn't require the 541 | // user to pre-allocate the space. 542 | value ml_plgriddata( value x, value y, value z, 543 | value xg, value yg, 544 | value type, value data ) 545 | { 546 | CAMLparam5( x, y, z, xg, yg ); 547 | CAMLxparam2( type, data ); 548 | 549 | // zg holds the OCaml float array array. 550 | // y_ml_array is a temporary structure which will be used to form each 551 | // float array making up zg. 552 | CAMLlocal2( zg, y_ml_array ); 553 | 554 | PLFLT **zg_local; 555 | 556 | int npts, nptsx, nptsy; 557 | int i, j; 558 | 559 | // Check to make sure x, y and z are all the same length. 560 | npts = Wosize_val( x ) / Double_wosize; 561 | if ( ( Wosize_val( y ) / Double_wosize != Wosize_val( z ) / Double_wosize ) || 562 | ( Wosize_val( y ) / Double_wosize != npts ) || 563 | ( Wosize_val( z ) / Double_wosize != npts ) 564 | ) 565 | { 566 | caml_failwith( "ml_plgriddata: x, y, z must all have the same dimensions" ); 567 | } 568 | 569 | nptsx = Wosize_val( xg ) / Double_wosize; 570 | nptsy = Wosize_val( yg ) / Double_wosize; 571 | 572 | // Allocate the 2D grid in a way that will make PLplot happy 573 | plAlloc2dGrid( &zg_local, nptsx, nptsy ); 574 | 575 | // Using "type + 1" because "type" is passed in as a variant type, so 576 | // the indexing starts from 0 rather than 1. 577 | c_plgriddata( (double *) x, (double *) y, (double *) z, npts, (double *) xg, nptsx, 578 | (double *) yg, nptsy, zg_local, Int_val( type ) + 1, 579 | Double_val( data ) ); 580 | 581 | // Allocate the X-dimension of the to-be-returned OCaml array 582 | zg = caml_alloc( nptsx, 0 ); 583 | 584 | for ( i = 0; i < nptsx; i++ ) 585 | { 586 | // Allocate each Y-dimension array of the OCaml array 587 | y_ml_array = caml_alloc( nptsy * Double_wosize, Double_array_tag ); 588 | for ( j = 0; j < nptsy; j++ ) 589 | { 590 | Store_double_field( y_ml_array, j, zg_local[i][j] ); 591 | } 592 | caml_modify( &Field( zg, i ), y_ml_array ); 593 | } 594 | 595 | // Free the memory used by the C array 596 | plFree2dGrid( zg_local, nptsx, nptsy ); 597 | 598 | CAMLreturn( zg ); 599 | } 600 | 601 | value ml_plgriddata_bytecode( value* argv, int argn ) 602 | { 603 | return ml_plgriddata( argv[0], argv[1], argv[2], argv[3], argv[4], 604 | argv[5], argv[6] ); 605 | } 606 | 607 | // 608 | // void 609 | // c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc); 610 | // 611 | // plpoly3 is wrapped by hand because draw has a length of (n - 1) and camlidl 612 | // does not have a way to indicate this automatically. 613 | void ml_plpoly3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT ndraw, PLBOOL *draw, PLBOOL ifcc ) 614 | { 615 | plpoly3( n, x, y, z, draw, ifcc ); 616 | } 617 | 618 | // Raise Invalid_argument if the given value is <> 0 619 | void plplot_check_nonzero_result( int result ) 620 | { 621 | if ( result != 0 ) 622 | { 623 | char exception_message[MAX_EXCEPTION_MESSAGE_LENGTH]; 624 | sprintf( exception_message, "Error, return code %d", result ); 625 | caml_invalid_argument( exception_message ); 626 | } 627 | return; 628 | } 629 | 630 | // Translate the integer version of the OCaml variant to the appropriate 631 | // PLplot constant. 632 | int translate_parse_option( int parse_option ) 633 | { 634 | int translated_option; 635 | switch ( parse_option ) 636 | { 637 | case 0: translated_option = PL_PARSE_PARTIAL; break; 638 | case 1: translated_option = PL_PARSE_FULL; break; 639 | case 2: translated_option = PL_PARSE_QUIET; break; 640 | case 3: translated_option = PL_PARSE_NODELETE; break; 641 | case 4: translated_option = PL_PARSE_SHOWALL; break; 642 | case 5: translated_option = PL_PARSE_OVERRIDE; break; 643 | case 6: translated_option = PL_PARSE_NOPROGRAM; break; 644 | case 7: translated_option = PL_PARSE_NODASH; break; 645 | case 8: translated_option = PL_PARSE_SKIP; break; 646 | default: translated_option = -1; 647 | } 648 | return translated_option; 649 | } 650 | 651 | // Copy a string array 652 | #define INIT_STRING_ARRAY( o ) \ 653 | int o ## _length; \ 654 | o ## _length = Wosize_val( o ); \ 655 | const char *c_ ## o[o ## _length]; \ 656 | for ( i = 0; i < o ## _length; i++ ) { c_ ## o[i] = String_val( Field( o, i ) ); } 657 | 658 | // Copy an int array, o, of n element to the C array c 659 | #define INIT_INT_ARRAY( o ) \ 660 | int o ## _length; \ 661 | o ## _length = Wosize_val( o ); \ 662 | int c_ ## o[o ## _length]; \ 663 | for ( i = 0; i < ( o ## _length ); i++ ) { ( c_ ## o )[i] = Int_val( Field( ( o ), i ) ); } 664 | 665 | // Copy an int array, o, of n element to the C array c 666 | #define INIT_INT_ARRAYS( o ) \ 667 | int o ## _length, o ## _inner; \ 668 | o ## _length = Wosize_val( o ); \ 669 | int *c_ ## o[o ## _length]; \ 670 | for ( i = 0; i < ( o ## _length ); i++ ) { \ 671 | INIT_INT_ARRAY( o ## _subarray ); \ 672 | ( c_ ## o )[i] = c_ ## o ## _subarray; \ 673 | } 674 | 675 | int lor_ml_list( value list, ML_VARIANT_FUNC variant_f ) 676 | { 677 | CAMLparam1( list ); 678 | int result; 679 | 680 | result = 0; 681 | while ( list != Val_emptylist ) 682 | { 683 | // Accumulate the elements of the list 684 | result = result | variant_f( Int_val( Field( list, 0 ) ) ); 685 | // Point to the tail of the list for the next loop 686 | list = Field( list, 1 ); 687 | } 688 | 689 | CAMLreturn( result ); 690 | } 691 | 692 | value ml_plparseopts( value argv, value parse_method ) 693 | { 694 | CAMLparam2( argv, parse_method ); 695 | int i; 696 | int result; 697 | int combined_parse_method; 698 | // Make a copy of the command line argument strings 699 | INIT_STRING_ARRAY( argv ) 700 | 701 | // OR the elements of the parse_method list together 702 | combined_parse_method = lor_ml_list( parse_method, translate_parse_option ); 703 | 704 | result = plparseopts( &argv_length, c_argv, combined_parse_method ); 705 | if ( result != 0 ) 706 | { 707 | char exception_message[MAX_EXCEPTION_MESSAGE_LENGTH]; 708 | sprintf( exception_message, "Invalid arguments in plparseopts, error %d", result ); 709 | caml_invalid_argument( exception_message ); 710 | } 711 | CAMLreturn( Val_unit ); 712 | } 713 | 714 | value ml_plstripc( value xspec, value yspec, value xmin, value xmax, value xjump, 715 | value ymin, value ymax, value xlpos, value ylpos, value y_ascl, 716 | value acc, value colbox, value collab, value colline, value styline, 717 | value legline, value labx, value laby, value labtop ) 718 | { 719 | // Function parameters 720 | CAMLparam5( xspec, yspec, xmin, xmax, xjump ); 721 | CAMLxparam5( ymin, ymax, xlpos, ylpos, y_ascl ); 722 | CAMLxparam5( acc, colbox, collab, colline, styline ); 723 | CAMLxparam4( legline, labx, laby, labtop ); 724 | // Line attribute array copies 725 | int colline_copy[4]; 726 | int styline_copy[4]; 727 | const char* legend_copy[4]; 728 | int i; 729 | for ( i = 0; i < 4; i++ ) 730 | { 731 | colline_copy[i] = Int_val( Field( colline, i ) ); 732 | styline_copy[i] = Int_val( Field( styline, i ) ); 733 | legend_copy[i] = String_val( Field( legline, i ) ); 734 | } 735 | // The returned value 736 | int id; 737 | plstripc( &id, String_val( xspec ), String_val( yspec ), 738 | Double_val( xmin ), Double_val( xmax ), 739 | Double_val( xjump ), Double_val( ymin ), Double_val( ymax ), 740 | Double_val( xlpos ), Double_val( ylpos ), Bool_val( y_ascl ), 741 | Bool_val( acc ), Int_val( colbox ), Int_val( collab ), 742 | colline_copy, styline_copy, legend_copy, 743 | String_val( labx ), String_val( laby ), String_val( labtop ) ); 744 | // Make me do something! 745 | CAMLreturn( Val_int( id ) ); 746 | } 747 | 748 | value ml_plstripc_byte( value* argv, int argn ) 749 | { 750 | return ml_plstripc( argv[0], argv[1], argv[2], argv[3], argv[4], 751 | argv[5], argv[6], argv[7], argv[8], argv[9], 752 | argv[10], argv[11], argv[12], argv[13], argv[14], 753 | argv[15], argv[16], argv[17], argv[18] ); 754 | } 755 | 756 | int translate_legend_option( int legend_option ) 757 | { 758 | int translated_option; 759 | switch ( legend_option ) 760 | { 761 | case 0: translated_option = PL_LEGEND_NONE; break; 762 | case 1: translated_option = PL_LEGEND_COLOR_BOX; break; 763 | case 2: translated_option = PL_LEGEND_LINE; break; 764 | case 3: translated_option = PL_LEGEND_SYMBOL; break; 765 | case 4: translated_option = PL_LEGEND_TEXT_LEFT; break; 766 | case 5: translated_option = PL_LEGEND_BACKGROUND; break; 767 | case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break; 768 | case 7: translated_option = PL_LEGEND_ROW_MAJOR; break; 769 | default: translated_option = -1; 770 | } 771 | return translated_option; 772 | } 773 | 774 | int translate_colorbar_option( int colorbar_option ) 775 | { 776 | int translated_option; 777 | switch ( colorbar_option ) 778 | { 779 | case 0: translated_option = PL_COLORBAR_LABEL_LEFT; break; 780 | case 1: translated_option = PL_COLORBAR_LABEL_RIGHT; break; 781 | case 2: translated_option = PL_COLORBAR_LABEL_TOP; break; 782 | case 3: translated_option = PL_COLORBAR_LABEL_BOTTOM; break; 783 | case 4: translated_option = PL_COLORBAR_IMAGE; break; 784 | case 5: translated_option = PL_COLORBAR_SHADE; break; 785 | case 6: translated_option = PL_COLORBAR_GRADIENT; break; 786 | case 7: translated_option = PL_COLORBAR_CAP_NONE; break; 787 | case 8: translated_option = PL_COLORBAR_CAP_LOW; break; 788 | case 9: translated_option = PL_COLORBAR_CAP_HIGH; break; 789 | case 10: translated_option = PL_COLORBAR_SHADE_LABEL; break; 790 | case 11: translated_option = PL_COLORBAR_ORIENT_RIGHT; break; 791 | case 12: translated_option = PL_COLORBAR_ORIENT_TOP; break; 792 | case 13: translated_option = PL_COLORBAR_ORIENT_LEFT; break; 793 | case 14: translated_option = PL_COLORBAR_ORIENT_BOTTOM; break; 794 | case 15: translated_option = PL_COLORBAR_BACKGROUND; break; 795 | case 16: translated_option = PL_COLORBAR_BOUNDING_BOX; break; 796 | default: translated_option = -1; 797 | } 798 | return translated_option; 799 | } 800 | 801 | int translate_position_option( int position_option ) 802 | { 803 | int translated_option; 804 | switch ( position_option ) 805 | { 806 | case 0: translated_option = PL_POSITION_LEFT; break; 807 | case 1: translated_option = PL_POSITION_RIGHT; break; 808 | case 2: translated_option = PL_POSITION_TOP; break; 809 | case 3: translated_option = PL_POSITION_BOTTOM; break; 810 | case 4: translated_option = PL_POSITION_INSIDE; break; 811 | case 5: translated_option = PL_POSITION_OUTSIDE; break; 812 | case 6: translated_option = PL_POSITION_VIEWPORT; break; 813 | case 7: translated_option = PL_POSITION_SUBPAGE; break; 814 | default: translated_option = -1; 815 | } 816 | return translated_option; 817 | } 818 | 819 | value ml_pllegend( value opt, value position, value x, value y, value plot_width, 820 | value bg_color, 821 | value bb_color, value bb_style, 822 | value nrow, value ncolumn, 823 | value opt_array, 824 | value text_offset, value text_scale, value text_spacing, 825 | value text_justification, value text_colors, value text, 826 | value box_colors, value box_patterns, value box_scales, 827 | value box_line_widths, 828 | value line_colors, value line_styles, value line_widths, 829 | value symbol_colors, value symbol_scales, 830 | value symbol_numbers, value symbols ) 831 | { 832 | CAMLparam5( position, opt, x, y, plot_width ); 833 | CAMLxparam5( bg_color, bb_color, bb_style, nrow, ncolumn ); 834 | CAMLxparam5( opt_array, text_offset, text_scale, text_spacing, text_justification ); 835 | CAMLxparam5( text_colors, text, box_colors, box_patterns, box_scales ); 836 | CAMLxparam5( box_line_widths, line_colors, line_styles, line_widths, symbol_colors ); 837 | CAMLxparam3( symbol_scales, symbol_numbers, symbols ); 838 | CAMLlocal1( result ); 839 | result = caml_alloc( 2, 0 ); 840 | 841 | // Counter 842 | int i; 843 | // General legend options 844 | int c_position, c_opt; 845 | // Number of legend entries 846 | int n_legend; 847 | n_legend = Wosize_val( opt_array ); 848 | // Options for each legend entry 849 | int c_opt_array[n_legend]; 850 | 851 | // Assume that the dimensions all line up on the OCaml side, so we don't 852 | // need to do any further dimension checks. 853 | 854 | // Define and initialize all of the C arrays to pass in to pllegend 855 | INIT_STRING_ARRAY( text ) 856 | INIT_INT_ARRAY( text_colors ) 857 | INIT_INT_ARRAY( box_colors ) 858 | INIT_INT_ARRAY( box_patterns ) 859 | INIT_INT_ARRAY( line_colors ) 860 | INIT_INT_ARRAY( line_styles ) 861 | INIT_INT_ARRAY( symbol_colors ) 862 | INIT_INT_ARRAY( symbol_numbers ) 863 | INIT_STRING_ARRAY( symbols ) 864 | 865 | // Translate the legend configuration options 866 | c_opt = lor_ml_list( opt, translate_legend_option ); 867 | c_position = lor_ml_list( position, translate_position_option ); 868 | 869 | for ( i = 0; i < n_legend; i++ ) 870 | { 871 | c_opt_array[i] = 872 | lor_ml_list( Field( opt_array, i ), translate_legend_option ); 873 | } 874 | 875 | // The returned width and height of the legend 876 | PLFLT width, height; 877 | 878 | pllegend( &width, &height, c_opt, c_position, Double_val( x ), Double_val( y ), 879 | Double_val( plot_width ), Int_val( bg_color ), 880 | Int_val( bb_color ), Int_val( bb_style ), 881 | Int_val( nrow ), Int_val( ncolumn ), 882 | n_legend, c_opt_array, 883 | Double_val( text_offset ), Double_val( text_scale ), 884 | Double_val( text_spacing ), 885 | Double_val( text_justification ), 886 | c_text_colors, c_text, 887 | c_box_colors, c_box_patterns, (double *) box_scales, 888 | (double *) box_line_widths, 889 | c_line_colors, c_line_styles, (double *) line_widths, 890 | c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, 891 | c_symbols ); 892 | 893 | // Return a tuple with the legend's size 894 | Store_field( result, 0, caml_copy_double( width ) ); 895 | Store_field( result, 1, caml_copy_double( height ) ); 896 | 897 | CAMLreturn( result ); 898 | } 899 | 900 | value ml_pllegend_byte( value* argv, int argn ) 901 | { 902 | return ml_pllegend( argv[0], argv[1], argv[2], argv[3], argv[4], 903 | argv[5], argv[6], argv[7], argv[8], argv[9], 904 | argv[10], argv[11], argv[12], argv[13], argv[14], 905 | argv[15], argv[16], argv[17], argv[18], argv[19], 906 | argv[20], argv[21], argv[22], argv[23], argv[24], 907 | argv[25], argv[26], argv[27] ); 908 | } 909 | 910 | value ml_plcolorbar( value opt, value position, value x, value y, 911 | value x_length, value y_length, 912 | value bg_color, value bb_color, value bb_style, 913 | value low_cap_color, value high_cap_color, 914 | value cont_color, value cont_width, 915 | value label_opts, value label, 916 | value axis_opts, 917 | value ticks, value sub_ticks, 918 | value values ) 919 | { 920 | CAMLparam5( opt, position, x, y, x_length ); 921 | CAMLxparam5( y_length, bg_color, bb_color, bb_style, low_cap_color ); 922 | CAMLxparam5( high_cap_color, cont_color, cont_width, label_opts, label ); 923 | CAMLxparam4( axis_opts, ticks, sub_ticks, values ); 924 | CAMLlocal1( result ); 925 | result = caml_alloc( 2, 0 ); 926 | 927 | // Counter 928 | int i; 929 | // General colorbar options 930 | int c_opt, c_position; 931 | // Number of labels 932 | int n_labels; 933 | n_labels = Wosize_val( label_opts ); 934 | // Number of axes and value ranges 935 | int n_axes; 936 | n_axes = Wosize_val( axis_opts ); 937 | 938 | // Translate configuration options 939 | c_opt = lor_ml_list( opt, translate_colorbar_option ); 940 | c_position = lor_ml_list( position, translate_position_option ); 941 | 942 | // Assume that the dimensions all line up on the OCaml side, so we don't 943 | // need to do any further dimension checks. 944 | 945 | // Define and initialize all of the C arrays to pass into plcolorbar 946 | INIT_STRING_ARRAY( label ) 947 | INIT_STRING_ARRAY( axis_opts ) 948 | INIT_INT_ARRAY( sub_ticks ); 949 | 950 | // Label options 951 | int c_label_opts[ n_labels ]; 952 | for ( i = 0; i < n_labels; i++ ) 953 | { 954 | c_label_opts[i] = lor_ml_list( Field( label_opts, i ), translate_colorbar_option ); 955 | } 956 | 957 | // Copy the axis/range values 958 | double **c_values; 959 | int n_values[ n_axes ]; 960 | c_values = malloc( n_axes * sizeof ( double * ) ); 961 | // TODO: Add allocation failure check 962 | for ( i = 0; i < n_axes; i++ ) 963 | { 964 | c_values[i] = (double *) Field( values, i ); 965 | n_values[i] = Wosize_val( Field( values, i ) ) / Double_wosize; 966 | } 967 | 968 | // Return values 969 | PLFLT width, height; 970 | 971 | plcolorbar( &width, &height, 972 | c_opt, c_position, Double_val( x ), Double_val( y ), 973 | Double_val( x_length ), Double_val( y_length ), 974 | Int_val( bg_color ), Int_val( bb_color ), Int_val( bb_style ), 975 | Double_val( low_cap_color ), Double_val( high_cap_color ), 976 | Int_val( cont_color ), Double_val( cont_width ), 977 | n_labels, c_label_opts, c_label, 978 | n_axes, c_axis_opts, 979 | (double *) ticks, c_sub_ticks, 980 | n_values, (const PLFLT * const *) c_values ); 981 | 982 | // Return a tuple with the colorbar's size 983 | Store_field( result, 0, caml_copy_double( width ) ); 984 | Store_field( result, 1, caml_copy_double( height ) ); 985 | 986 | CAMLreturn( result ); 987 | } 988 | 989 | value ml_plcolorbar_byte( value *argv, int argn ) 990 | { 991 | return ml_plcolorbar( argv[0], argv[1], argv[2], argv[3], argv[4], 992 | argv[5], argv[6], argv[7], argv[8], argv[9], 993 | argv[10], argv[11], argv[12], argv[13], argv[14], 994 | argv[15], argv[16], argv[17], argv[18] ); 995 | } 996 | 997 | // pltr* function implementations 998 | void ml_pltr0( double x, double y, double* tx, double* ty ) 999 | { 1000 | pltr0( x, y, tx, ty, NULL ); 1001 | } 1002 | 1003 | value ml_pltr1( value xg, value yg, value x, value y ) 1004 | { 1005 | CAMLparam4( xg, yg, x, y ); 1006 | CAMLlocal1( tx_ty ); 1007 | tx_ty = caml_alloc( 2, 0 ); 1008 | double tx; 1009 | double ty; 1010 | PLcGrid grid; 1011 | grid.xg = (double *) xg; 1012 | grid.yg = (double *) yg; 1013 | grid.nx = Wosize_val( xg ) / Double_wosize; 1014 | grid.ny = Wosize_val( yg ) / Double_wosize; 1015 | pltr1( Double_val( x ), Double_val( y ), &tx, &ty, ( PLPointer ) & grid ); 1016 | 1017 | // Allocate a tuple and return it with the results 1018 | Store_field( tx_ty, 0, caml_copy_double( tx ) ); 1019 | Store_field( tx_ty, 1, caml_copy_double( ty ) ); 1020 | CAMLreturn( tx_ty ); 1021 | } 1022 | 1023 | value ml_pltr2( value xg, value yg, value x, value y ) 1024 | { 1025 | CAMLparam4( xg, yg, x, y ); 1026 | CAMLlocal1( tx_ty ); 1027 | tx_ty = caml_alloc( 2, 0 ); 1028 | double ** c_xg; 1029 | double ** c_yg; 1030 | int i; 1031 | int length1; 1032 | int length2; 1033 | PLcGrid2 grid; 1034 | double tx; 1035 | double ty; 1036 | 1037 | // TODO: As of now, you will probably get a segfault of the xg and yg 1038 | // dimensions don't match up properly. 1039 | // Build the grid. 1040 | // Length of "outer" array 1041 | length1 = Wosize_val( xg ); 1042 | // Length of the "inner" arrays 1043 | length2 = Wosize_val( Field( xg, 0 ) ) / Double_wosize; 1044 | c_xg = malloc( length1 * sizeof ( double* ) ); 1045 | for ( i = 0; i < length1; i++ ) 1046 | { 1047 | c_xg[i] = (double *) Field( xg, i ); 1048 | } 1049 | c_yg = malloc( length1 * sizeof ( double* ) ); 1050 | for ( i = 0; i < length1; i++ ) 1051 | { 1052 | c_yg[i] = (double *) Field( yg, i ); 1053 | } 1054 | grid.xg = c_xg; 1055 | grid.yg = c_yg; 1056 | grid.nx = length1; 1057 | grid.ny = length2; 1058 | 1059 | pltr2( Double_val( x ), Double_val( y ), &tx, &ty, ( PLPointer ) & grid ); 1060 | 1061 | // Clean up 1062 | free( c_xg ); 1063 | free( c_yg ); 1064 | 1065 | // Allocate a tuple and return it with the results 1066 | Store_field( tx_ty, 0, caml_copy_double( tx ) ); 1067 | Store_field( tx_ty, 1, caml_copy_double( ty ) ); 1068 | CAMLreturn( tx_ty ); 1069 | } 1070 | 1071 | // XXX Non-core functions follow XXX 1072 | //* 1073 | // The following functions are here for (my?) convenience. As far as I can 1074 | // tell, they are not defined in the core PLplot library. 1075 | // 1076 | 1077 | // Get the current color map 0 color index 1078 | int plg_current_col0( void ) 1079 | { 1080 | return plsc->icol0; 1081 | } 1082 | 1083 | // Get the current color map 1 color index 1084 | PLFLT plg_current_col1( void ) 1085 | { 1086 | return plsc->icol1; 1087 | } 1088 | 1089 | // Get the current pen width. TODO: Remove this, as I think this information 1090 | // can be retrieved from another proper PLplot function. 1091 | PLFLT plgwidth( void ) 1092 | { 1093 | return plsc->width; 1094 | } 1095 | 1096 | // Get the current character (text) height in mm. TODO: Remove this, as I 1097 | // think this information can be retrieved from another proper PLplot 1098 | // function 1099 | PLFLT plgchrht( void ) 1100 | { 1101 | return plsc->chrht; 1102 | } 1103 | --------------------------------------------------------------------------------