Skip to content

Commit

Permalink
branch 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
teddychao committed Aug 24, 2023
1 parent ccbf3c8 commit 321e75c
Show file tree
Hide file tree
Showing 2,034 changed files with 91,547 additions and 172,175 deletions.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"
#include "son.h"
#include "machine.h"

int GetFilterMask(mxArray *rhsptr, TpFilterMask pMask)

{
mxArray *tmpPtr;
int error;
unsigned char *ptr;
const int *empty[2]={0,0};


tmpPtr=mxGetField(rhsptr,0,"lFlags");

if ((tmpPtr==NULL) || mxGetClassID(tmpPtr) != mxINT32_CLASS){
mexPrintf("Bad Filter: lFlags missing or not int32 class\n");
error=1;
}
else {
(*pMask).lFlags=mxGetScalar(tmpPtr);
}

tmpPtr=mxGetField(rhsptr,0,"aMask");
if (tmpPtr ==NULL){
mexPrintf("SONGetRealData Bad Filter: aMask missing\n");
error=1;
}
else {
if ((mxGetM(tmpPtr)!=32) ||( mxGetN(tmpPtr)!=4)){
mexPrintf("SONGetRealData Bad Filter:"
"aMask has wrong dimensions\n");
error=1;
}
if (mxGetClassID(tmpPtr) != mxUINT8_CLASS){
mexPrintf("SONGetRealData Bad Filter:"
"aMask must be uint8 class\n");
error=1;
}
}
if (error==1)
return SON_BAD_PARAM;

ptr=mxGetData(tmpPtr);// Mask

memcpy((*pMask).aMask,ptr,sizeof((*pMask).aMask));

return 1;
}
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"
#include "son.h"
#include "machine.h"

int GetFilterMask(mxArray *rhsptr, TpFilterMask pMask)

{
mxArray *tmpPtr;
int error;
unsigned char *ptr;
const int *empty[2]={0,0};


tmpPtr=mxGetField(rhsptr,0,"lFlags");

if ((tmpPtr==NULL) || mxGetClassID(tmpPtr) != mxINT32_CLASS){
mexPrintf("Bad Filter: lFlags missing or not int32 class\n");
error=1;
}
else {
(*pMask).lFlags=mxGetScalar(tmpPtr);
}

tmpPtr=mxGetField(rhsptr,0,"aMask");
if (tmpPtr ==NULL){
mexPrintf("SONGetRealData Bad Filter: aMask missing\n");
error=1;
}
else {
if ((mxGetM(tmpPtr)!=32) ||( mxGetN(tmpPtr)!=4)){
mexPrintf("SONGetRealData Bad Filter:"
"aMask has wrong dimensions\n");
error=1;
}
if (mxGetClassID(tmpPtr) != mxUINT8_CLASS){
mexPrintf("SONGetRealData Bad Filter:"
"aMask must be uint8 class\n");
error=1;
}
}
if (error==1)
return SON_BAD_PARAM;

ptr=mxGetData(tmpPtr);// Mask

memcpy((*pMask).aMask,ptr,sizeof((*pMask).aMask));

return 1;
}
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"

#include "son.h"
#include "machine.h"
#include "SONDef.h"

HINSTANCE hinstLib;
BOOL fFreeResult;

int _SONAppID(short fh, TSONCreator *p1, TSONCreator *p2)
{
FARPROC SONAppID;
int i;
SONAppID=GetProcAddress(hinstLib,"SONAppID");
if (SONAppID != NULL){
i=(*SONAppID)(fh, p1, p2);
return i;
}
mexErrMsgTxt("SONAppID not found in library\n");
}


void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
short fh, i;
TSONCreator creator={""};
char buf [9];
double *p;
const int dim[2]={1,8};

if (nrhs>=1)
fh=mxGetScalar(prhs[0]);

if (nrhs==2){
if (mxGetClassID(prhs[1])==mxCHAR_CLASS) {
mxGetString(prhs[1], &buf, 9);
memcpy(creator.acID, buf, 8);
}
else
mexErrMsgTxt("SONAppID: String required on input (arg 2)");
}


//Load and get pointer to the library SON32.DLL//
hinstLib = LoadLibrary(SON32);
if (hinstLib == NULL){
mexPrintf("%s not found",SON32);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
p=mxGetPr(plhs[0]);
p[0]=SON_BAD_PARAM;
return;
}

if (nrhs==1)
i=_SONAppID(fh, &creator, NULL); //read
else {
i=_SONAppID(fh, NULL, &creator); //write
_SONAppID(fh, &creator, NULL); //and read back
}

fFreeResult = FreeLibrary(hinstLib);

memcpy(&buf, creator.acID, 8);
buf[8]=0;
plhs[0]=mxCreateString(&buf);
return;
}
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"

#include "son.h"
#include "machine.h"
#include "SONDef.h"

HINSTANCE hinstLib;
BOOL fFreeResult;

int _SONAppID(short fh, TSONCreator *p1, TSONCreator *p2)
{
FARPROC SONAppID;
int i;
SONAppID=GetProcAddress(hinstLib,"SONAppID");
if (SONAppID != NULL){
i=(*SONAppID)(fh, p1, p2);
return i;
}
mexErrMsgTxt("SONAppID not found in library\n");
}


void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
short fh, i;
TSONCreator creator={""};
char buf [9];
double *p;
const int dim[2]={1,8};

if (nrhs>=1)
fh=mxGetScalar(prhs[0]);

if (nrhs==2){
if (mxGetClassID(prhs[1])==mxCHAR_CLASS) {
mxGetString(prhs[1], &buf, 9);
memcpy(creator.acID, buf, 8);
}
else
mexErrMsgTxt("SONAppID: String required on input (arg 2)");
}


//Load and get pointer to the library SON32.DLL//
hinstLib = LoadLibrary(SON32);
if (hinstLib == NULL){
mexPrintf("%s not found",SON32);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
p=mxGetPr(plhs[0]);
p[0]=SON_BAD_PARAM;
return;
}

if (nrhs==1)
i=_SONAppID(fh, &creator, NULL); //read
else {
i=_SONAppID(fh, NULL, &creator); //write
_SONAppID(fh, &creator, NULL); //and read back
}

fFreeResult = FreeLibrary(hinstLib);

memcpy(&buf, creator.acID, 8);
buf[8]=0;
plhs[0]=mxCreateString(&buf);
return;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SON32 "c:\\Spike5\\son32.dll"
int GetFilterMask();


#define SON32 "c:\\Spike5\\son32.dll"
int GetFilterMask();



Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"

#include "son.h"
#include "machine.h"
#include "SONDef.h"

HINSTANCE hinstLib;
BOOL fFreeResult;

int _SONFActive(TpFilterMask Mask)
{
FARPROC SONFActive;
int i;
SONFActive=GetProcAddress(hinstLib,"SONFActive");
if (SONFActive != NULL){
i=(*SONFActive)(Mask);
return i;
}
mexErrMsgTxt("SONFActive not found in library\n");
}


void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
TFilterMask FilterMask;
int i, *ret;
int dim[2]={1,1};
double *p;


if (nrhs<1)
mexErrMsgTxt("SONFEqual: Too few input arguments\n");

if (mxIsStruct(prhs[0])==1)
GetFilterMask(prhs[0], &FilterMask);

//Load and get pointer to the library SON32.DLL//
hinstLib = LoadLibrary(SON32);
if (hinstLib == NULL){
mexPrintf("%s not found",SON32);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
p=mxGetPr(plhs[0]);
p[0]=SON_BAD_PARAM;
return;
}


i=_SONFActive(&FilterMask);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
ret=mxGetData(plhs[0]);
*ret=i;
fFreeResult = FreeLibrary(hinstLib);
return;
}
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <matrix.h>
#include "mex.h"

#include "son.h"
#include "machine.h"
#include "SONDef.h"

HINSTANCE hinstLib;
BOOL fFreeResult;

int _SONFActive(TpFilterMask Mask)
{
FARPROC SONFActive;
int i;
SONFActive=GetProcAddress(hinstLib,"SONFActive");
if (SONFActive != NULL){
i=(*SONFActive)(Mask);
return i;
}
mexErrMsgTxt("SONFActive not found in library\n");
}


void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
TFilterMask FilterMask;
int i, *ret;
int dim[2]={1,1};
double *p;


if (nrhs<1)
mexErrMsgTxt("SONFEqual: Too few input arguments\n");

if (mxIsStruct(prhs[0])==1)
GetFilterMask(prhs[0], &FilterMask);

//Load and get pointer to the library SON32.DLL//
hinstLib = LoadLibrary(SON32);
if (hinstLib == NULL){
mexPrintf("%s not found",SON32);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
p=mxGetPr(plhs[0]);
p[0]=SON_BAD_PARAM;
return;
}


i=_SONFActive(&FilterMask);
plhs[0]=mxCreateNumericArray(2, dim, mxINT32_CLASS, mxREAL);
ret=mxGetData(plhs[0]);
*ret=i;
fFreeResult = FreeLibrary(hinstLib);
return;
}

0 comments on commit 321e75c

Please sign in to comment.