Example #1
0
 inline void append(int fx, 
                    bool isLE, 
                    double border_val)
 {
   /*---  feat#, isLE, border_val  ---*/
   ba.concat((AzByte *)(&fx), sizeof(fx)); 
   ba.concat((AzByte *)(&isLE), sizeof(isLE)); 
   ba.concat((AzByte *)(&border_val), sizeof(border_val)); 
 }
Example #2
0
 /*--------*/
 inline void ppBegin(const char *caller, 
                     const char *desc=NULL, 
                     const char *inp_dlm=NULL) {
   AzBytArr s; 
   if (level > 0) {
     s.concat(caller); 
   }
   else {
     s.concat(desc); 
   }
   printBegin(s.c_str(), inp_dlm); 
 }
Example #3
0
/*-------------------------------------------------------------*/
void AzParam::check(const AzOut &out, 
                     AzBytArr *s_unused)
{
  if (param == NULL) return; 

  AzStrPool sp_unused, sp_kw; 
  analyze(&sp_unused, &sp_kw); 

  bool error = false; 

  int ix; 
  for (ix = 0; ix < sp_unused.size(); ++ix) {
    if (sp_unused.getLen(ix) <= 0) continue; 

    /*---  this parameter wasn't used by anyone.  ---*/
    if (s_unused != NULL) {
      /*---  may be used by someone else  ---*/
      if (s_unused->length() > 0) s_unused->concat(dlm); 
      s_unused->concat(sp_unused.c_str(ix));     
    }
    else {
      /*---  it could be a typo  ---*/
      AzBytArr s; 
      s.concat("!Warning! Unknown parameter: \""); 
      s.concat(sp_unused.c_str(ix)); s.concat("\""); 
      AzPrint::writeln(out, s); 
    }
  }

  AzBytArr s_err; 
  int kw_num = sp_kw.size(); 
  sp_kw.commit(); 
  if (sp_kw.size() != kw_num) {
    for (ix = 0; ix < sp_kw.size(); ++ix) {
      AZint8 count = sp_kw.getCount(ix); 
      if (count > 1) {
        /*---  this keyword appears more than once.  ---*/
        if (s_err.length() <= 0) s_err.newline(); 
        s_err.concat("  Duplicated keyword: "); 
        s_err.concat(sp_kw.c_str(ix)); 
        s_err.newline(); 
        error = true; 
      }
    }
  }

  if (error) {
    throw new AzException(AzInputError, "AzParam::check", s_err.c_str()); 
  }
}
Example #4
0
/*--------------------------------------------------------*/
int AzTools::writeList(const char *fn, 
                        const AzStrArray *sp_list)
{
  int max_len = 0; 
  AzFile file(fn); 
  file.open("wb"); 
  int num = sp_list->size(); 
  int ix; 
  for (ix = 0; ix < num; ++ix) {
    AzBytArr s; 
    sp_list->get(ix, &s); 
    s.concat("\n");
    max_len = MAX(max_len, s.getLen());  
    s.writeText(&file);  
  }
  file.close(true); 
  return max_len; 
}
Example #5
0
 inline void finalize() {
   if (ba.getLen() == 0) {
     ba.concat('_'); /* root node (CONST) */
   }
 }
Example #6
0
 inline void append(const AzTreeRule *inp) {
   if (inp != NULL) {
     ba.concat(&inp->ba); 
   }
 }