Esempio n. 1
0
void factory_mp3d_homebrew::set_options(maxpool3d &holder, int opt_beg, int ni, mxArray const *vi[])
{
  // parse option/value pairs
  if ( ((ni-opt_beg)%2) != 0 )
    throw mp3d_ex("Imbalanced option/value pairs.");
  for (int i = opt_beg; i < ni; i+=2) {
    if      (isStrEqual(vi[i], "pool"))   set_pool(holder, vi[i+1]);
    else if (isStrEqual(vi[i], "stride")) set_stride(holder, vi[i+1]);
    else if (isStrEqual(vi[i], "pad"))    set_pad(holder, vi[i+1]);
    else                                  throw mp3d_ex("Unrecognized option/value pairs.");
  } // for i
}
conv3d::CALL_TYPE conv3d_blas_cpu::parse_and_set( int no, mxArray *vo[], int ni, mxArray const *vi[] )
{
  conv3d_blas_cpu::CALL_TYPE ct;
  int n_opt = -1;

  // fprop or bprop?
  if (no == 1) {
    if ( ni < 3 || !mxIsSingle(vi[0]) || !mxIsSingle(vi[1]) || !mxIsSingle(vi[2]) ) 
      mexErrMsgTxt(THE_CMD);

    ct = FPROP;
    n_opt = 3;
    X = (mxArray*) vi[0]; // we hereby guarantee that we won't change the inputs!
    F = (mxArray*) vi[1];
    B = (mxArray*) vi[2];
  } 
  else if (no == 3) {
    if ( ni < 4 ) 
      mexErrMsgTxt(THE_CMD);
    if ( !mxIsSingle(vi[0]) || !mxIsSingle(vi[1]) ||
         !mxIsSingle(vi[2]) || !mxIsSingle(vi[3]) )
      mexErrMsgTxt(THE_CMD);

    ct = BPROP;
    n_opt = 4;
    X  = (mxArray*) vi[0]; // we hereby guarantee that we won't change the inputs!
    F  = (mxArray*) vi[1];
    B  = (mxArray*) vi[2];
    dY = (mxArray*) vi[3];
  } 
  else {
    mexErrMsgTxt(THE_CMD);
  }

  // parse option/value pairs
  if ( ((ni-n_opt)%2) != 0 ) // imbalance option/value
    mexErrMsgTxt(THE_CMD);
  for (int i = n_opt; i < ni; i+=2) {
    if (isStrEqual(vi[i], "stride"))   this->set_stride(vi[i+1]);
    else if (isStrEqual(vi[i], "pad")) this->set_pad(vi[i+1]);
    else                               mexErrMsgTxt(THE_CMD);
  } // for i

  return ct;
}
Esempio n. 3
0
const char* SkinData_GetUTF8_internal(const char *pItemName,const char *pErrorMsg)
{  
  u32 hash=CalcItemHash(pItemName);
  
  for(u32 idx=0;idx<SkinDataCount;idx++){
    TLangData *pld=&SkinData[idx];
    if(hash==pld->ItemHash){
      if(isStrEqual(pItemName,pld->pItem)==true){
        return(pld->pValue);
      }
    }
  }
  
  _consolePrintf("Lang_GetUTF8: Can not found language item. [%s]\n",pItemName);
  return(pErrorMsg);
}
Esempio n. 4
0
const char* Lang_GetUTF8_internal(const char *pItemName,const char *pErrorMsg)
{
  if(LangDataCount==0){
    _consolePrintf("Fatal error: Lang_GetUTF8: Language file not loaded.\n");
    ShowLogHalt();
  }
  
  u32 hash=CalcItemHash(pItemName);
  
  for(u32 idx=0;idx<LangDataCount;idx++){
    TLangData *pld=&LangData[idx];
    if(hash==pld->ItemHash){
      if(isStrEqual(pItemName,pld->pItem)==true){
        return(pld->pValue);
      }
    }
  }
  
  _consolePrintf("Lang_GetUTF8: Can not found language item. [%s]\n",pItemName);
  return(pErrorMsg);
}