Example #1
0
static bool_vector_type * alloc_iactive_vector_from_range(const stringlist_type * range, int startindex, int ens_size) {
  bool_vector_type * iactive;
  if (stringlist_get_size(range) > startindex) {
    char * arg_string = stringlist_alloc_joined_substring( range, startindex, stringlist_get_size(range), "");
    iactive = bool_vector_alloc(ens_size, false);
    string_util_update_active_mask( arg_string, iactive );
    free ( arg_string );
  } else {
    iactive = bool_vector_alloc(ens_size, true);
  }
  return iactive;
}
Example #2
0
bool string_util_update_active_list( const char * range_string , int_vector_type * active_list ) {
  int_vector_sort( active_list );
  {
    bool_vector_type * mask = alloc_mask( active_list );
    bool valid = false;

    if (string_util_update_active_mask( range_string , mask )) {
      int_vector_reset( active_list );
      {
        int i;
        for (i=0; i < bool_vector_size(mask); i++) {
          bool active = bool_vector_iget( mask , i );
          if (active)
            int_vector_append( active_list , i );
        }
      }
      valid = true;
    }
    bool_vector_free( mask );
    return valid;
  }
}
Example #3
0
bool string_util_init_active_mask( const char * range_string , bool_vector_type * active_mask ) {
  bool_vector_reset( active_mask );
  return string_util_update_active_mask( range_string , active_mask );
}