int mxGetN(const mxArray *ptr) { InternalType * pIT = (InternalType *)ptr; if (pIT == NULL) { return 0; } GenericType * pGT = pIT->getAs<GenericType>(); if (pGT == 0) { return 0; } return pGT->getCols(); }
void mxSetM(mxArray *ptr, int M) { InternalType *pIT = (InternalType *)ptr; if (pIT == NULL) { return; } GenericType *pGT = pIT->getAs<GenericType>(); if (pGT == NULL) { return; } pGT->resize(M, pGT->getCols()); }
int getOptionals(void* _pvCtx, char* pstFuncName, rhs_opts opts[]) { GatewayStruct* pStr = (GatewayStruct*)_pvCtx; types::optional_list opt = *pStr->m_pOpt; int i = 0; /* reset first field since opts is declared static in calling function */ while (opts[i].pstName != NULL) { opts[i].iPos = -1; i++; } for (i = 0 ; i < opt.size() ; i++) { int typeOfOpt = -1; char* pstOpts = wide_string_to_UTF8(opt[i].first.c_str()); int index = findOptional(_pvCtx, pstOpts, opts); FREE(pstOpts); if (index < 0) { sciprint(_("%ls: Unrecognized optional arguments %ls.\n"), pStr->m_pstName, opt[i].first.c_str()); printOptionalNames(_pvCtx, opts); return 0; } opts[index].iPos = i + 1; GenericType* pGT = (GenericType*)opt[i].second; getVarType(_pvCtx, (int*)pGT, &typeOfOpt); opts[index].iType = typeOfOpt; if (typeOfOpt == sci_implicit_poly) { InternalType* pIT = NULL; ImplicitList* pIL = pGT->getAs<ImplicitList>(); pIT = pIL->extractFullMatrix(); Double* impResult = (Double*)pIT; opts[index].iRows = impResult->getRows(); opts[index].iCols = impResult->getCols(); opts[index].piAddr = (int*)impResult; opts[index].iType = sci_matrix; } else { opts[index].iRows = pGT->getRows(); opts[index].iCols = pGT->getCols(); opts[index].piAddr = (int*)pGT; } } // int index = -1; //GatewayStruct* pStr = (GatewayStruct*)_pvCtx; // wchar_t* pwstProperty = to_wide_string(pstProperty); // for(int i = 0 ; i < pStr->m_pOpt->size() ; i++) // { // std::pair<std::wstring, InternalType*> current = (*pStr->m_pOpt)[i]; // if(wcscmp(current.first.c_str(), pwstProperty) == 0) // { // index = i; // break; // } // } // FREE(pwstProperty); return 1; }