1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/*
* MATLAB Compiler: 4.4 (R2006a)
* Date: Thu Jul 24 17:19:07 2008
* Arguments: "-B" "macro_default" "-m" "-W" "main" "-T" "link:exe" "-d"
* "../MEX" "innerProd.m"
*/
#include <stdio.h>
#include "mclmcr.h"
#ifdef __cplusplus
extern "C" {
#endif
extern mclComponentData __MCC_innerProd_component_data;
#ifdef __cplusplus
}
#endif
static HMCRINSTANCE _mcr_inst = NULL;
static int mclDefaultPrintHandler(const char *s)
{
return fwrite(s, sizeof(char), strlen(s), stdout);
}
static int mclDefaultErrorHandler(const char *s)
{
int written = 0, len = 0;
len = strlen(s);
written = fwrite(s, sizeof(char), len, stderr);
if (len > 0 && s[ len-1 ] != '\n')
written += fwrite("\n", sizeof(char), 1, stderr);
return written;
}
/* This symbol is defined in shared libraries. Define it here
* (to nothing) in case this isn't a shared library.
*/
#ifndef LIB_innerProd_C_API
#define LIB_innerProd_C_API /* No special import/export declaration */
#endif
LIB_innerProd_C_API
bool MW_CALL_CONV innerProdInitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler
)
{
if (_mcr_inst != NULL)
return true;
if (!mclmcrInitialize())
return false;
if (!mclInitializeComponentInstance(&_mcr_inst,
&__MCC_innerProd_component_data,
true, NoObjectType, ExeTarget,
error_handler, print_handler))
return false;
return true;
}
LIB_innerProd_C_API
bool MW_CALL_CONV innerProdInitialize(void)
{
return innerProdInitializeWithHandlers(mclDefaultErrorHandler,
mclDefaultPrintHandler);
}
LIB_innerProd_C_API
void MW_CALL_CONV innerProdTerminate(void)
{
if (_mcr_inst != NULL)
mclTerminateInstance(&_mcr_inst);
}
int run_main(int argc, const char **argv)
{
int _retval;
/* Generate and populate the path_to_component. */
char path_to_component[(PATH_MAX*2)+1];
separatePathName(argv[0], path_to_component, (PATH_MAX*2)+1);
__MCC_innerProd_component_data.path_to_component = path_to_component;
if (!innerProdInitialize()) {
return -1;
}
_retval = mclMain(_mcr_inst, argc, argv, "innerProd", 1);
if (_retval == 0 /* no error */) mclWaitForFiguresToDie(NULL);
innerProdTerminate();
mclTerminateApplication();
return _retval;
}
int main(int argc, const char **argv)
{
if (!mclInitializeApplication(
__MCC_innerProd_component_data.runtime_options,
__MCC_innerProd_component_data.runtime_option_count))
return 0;
return mclRunMain(run_main, argc, argv);
}
|