1 //////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (C) 2001-2021 The Octave Project Developers 4 // 5 // See the file COPYRIGHT.md in the top-level directory of this 6 // distribution or <https://octave.org/copyright/>. 7 // 8 // This file is part of Octave. 9 // 10 // Octave is free software: you can redistribute it and/or modify it 11 // under the terms of the GNU General Public License as published by 12 // the Free Software Foundation, either version 3 of the License, or 13 // (at your option) any later version. 14 // 15 // Octave is distributed in the hope that it will be useful, but 16 // WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of the GNU General Public License 21 // along with Octave; see the file COPYING. If not, see 22 // <https://www.gnu.org/licenses/>. 23 // 24 //////////////////////////////////////////////////////////////////////// 25 26 /* 27 28 This code was originally distributed as part of Octave Forge under 29 the following terms: 30 31 Author: Paul Kienzle 32 I grant this code to the public domain. 33 2001-03-22 34 35 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 36 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 38 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 39 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 40 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 41 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 42 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 43 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 45 SUCH DAMAGE. 46 47 */ 48 49 /* mex.h is for use in C-programs only; do NOT include it in mex.cc */ 50 51 #if ! defined (octave_mex_h) 52 #define octave_mex_h 1 53 54 #include "octave-config.h" 55 56 #define HAVE_OCTAVE 57 58 typedef void mxArray; 59 60 /* -V4 stuff */ 61 #if defined (V4) 62 # define Matrix mxArray 63 # define REAL mxREAL 64 #endif 65 66 #define mxMAXNAME 64 67 68 #include "mexproto.h" 69 70 #if defined (__cplusplus) 71 extern "C" { 72 #endif 73 74 #if defined (V4) 75 void mexFunction (int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]); 76 #else 77 void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]); 78 #endif 79 80 /* V4 floating point routines renamed in V5. */ 81 #define mexIsNaN mxIsNaN 82 #define mexIsFinite mxIsFinite 83 #define mexIsInf mxIsInf 84 #define mexGetEps mxGetEps 85 #define mexGetInf mxGetInf 86 #define mexGetNaN mxGetNaN 87 88 #define mexGetGlobal(nm) mexGetArray (nm, "global") 89 #define mexGetMatrix(nm) mexGetArray (nm, "caller") 90 #define mexGetMatrixPtr(nm) mexGetArrayPtr (nm, "caller") 91 92 #define mexGetArray(nm, space) mexGetVariable (space, nm) 93 #define mexGetArrayPtr(nm, space) mexGetVariablePtr (space, nm) 94 95 #define mexPutMatrix(ptr) mexPutVariable ("caller", "", ptr) 96 #define mexPutArray(ptr, space) mexPutVariable (space, "", ptr) 97 98 #define mxCreateFull mxCreateDoubleMatrix 99 100 #define mxCreateScalarDouble mxCreateDoubleScalar 101 102 #define mxFreeMatrix mxDestroyArray 103 104 #define mxIsString mxIsChar 105 106 /* Apparently these are also defined. */ 107 108 #if ! defined (UINT64_T) 109 # define UINT64_T uint64_t 110 #endif 111 112 #if ! defined (uint64_T) 113 # define uint64_T uint64_t 114 #endif 115 116 #if ! defined (INT64_T) 117 # define INT64_T int64_t 118 #endif 119 120 #if ! defined (int64_T) 121 # define int64_T int64_t 122 #endif 123 124 #if ! defined (UINT32_T) 125 # define UINT32_T uint32_t 126 #endif 127 128 #if ! defined (uint32_T) 129 # define uint32_T uint32_t 130 #endif 131 132 #if ! defined (INT32_T) 133 # define INT32_T int32_t 134 #endif 135 136 #if ! defined (int32_T) 137 # define int32_T int32_t 138 #endif 139 140 #if ! defined (UINT16_T) 141 # define UINT16_T uint16_t 142 #endif 143 144 #if ! defined (uint16_T) 145 # define uint16_T uint16_t 146 #endif 147 148 #if ! defined (INT16_T) 149 # define INT16_T int16_t 150 #endif 151 152 #if ! defined (int16_T) 153 # define int16_T int16_t 154 #endif 155 156 #if ! defined (UINT8_T) 157 # define UINT8_T uint8_t 158 #endif 159 160 #if ! defined (uint8_T) 161 # define uint8_T uint8_t 162 #endif 163 164 #if ! defined (INT8_T) 165 # define INT8_T int8_t 166 #endif 167 168 #if ! defined (int8_T) 169 # define int8_T int8_t 170 #endif 171 172 #if defined (__cplusplus) 173 } 174 #endif 175 176 #endif 177