00001 /* 00002 * mex2c_main_lib 00003 * 00004 * This is a shell around the matlab/mex "mexFunction" conventional 00005 * function entry point. This shell allows 00006 * functions written for compilation and execution 00007 * under the mex environment to be used standalone from C, 00008 * without the rest of the matlab environment, hence the name 00009 * mex2c. The cli part indicates the arguments to the mexfunction 00010 * are passed in by a command-line interface. 00011 * This works by using the command line to instantiate the Matrix 00012 * data structures that are used by the mexFunction entry point. 00013 * 00014 * version 1, Michael Turmon, 2010 00015 */ 00016 00017 /*LINTLIBRARY*/ 00018 00019 #include <unistd.h> 00020 #include <stdlib.h> 00021 #include <stdio.h> 00022 #include <string.h> 00023 #include <math.h> 00024 #include <setjmp.h> /* for mexFunction exit via mexErrMsgTxt */ 00025 00026 /* 00027 * mex includes 00028 */ 00029 #include "mex.h" /* mex data structures */ 00030 #include "mexhead.h" /* mex utilities */ 00031 00032 00033 /* global variables to hold program state */ 00034 char *mex2c_progname; /* name of this program, for error messages; 00035 is also used for mexFunctionName() in 00036 mex_stubs.c */ 00037 char mex2c_phase[256]; /* for error messages: where are we */ 00038 00039 // the error handler and dispatcher wrapper for CLI and mex-as-library 00040 #include "mex2c_dispatcher.c" 00041 00042 00043