Ejemplo n.º 1
0
Archivo: script.c Proyecto: tdihp/wrk
void script_errors(lua_State *L, errors *errors) {
    uint64_t e[] = {
        errors->connect,
        errors->read,
        errors->write,
        errors->status,
        errors->timeout
    };
    const table_field fields[] = {
        { "connect", LUA_TNUMBER, &e[0] },
        { "read",    LUA_TNUMBER, &e[1] },
        { "write",   LUA_TNUMBER, &e[2] },
        { "status",  LUA_TNUMBER, &e[3] },
        { "timeout", LUA_TNUMBER, &e[4] },
        { NULL,      0,           NULL  },
    };
    lua_newtable(L);
    set_fields(L, 2, fields);
    lua_setfield(L, 1, "errors");
}
Ejemplo n.º 2
0
void TabSfx::fill_data()
{
    data_loading = true;

    common::fill_files_combo("/sfx/", ui->filename_comboBox);
    ScenesMediator::get_instance()->playsfx_list = fio.load_scenes_play_sfx();
    int list_size = ScenesMediator::get_instance()->playsfx_list.size();

    if (list_size == 0) {
        change_fields_enabled(false);
    } else {
        change_fields_enabled(true);
        for (int i=0; i<list_size; i++) {
            ui->select_comboBox->addItem(QString(ScenesMediator::get_instance()->playsfx_list.at(i).name));
        }
        set_fields(0);

    }
    data_loading = false;
    ui->select_comboBox->setCurrentIndex(0);
}
Ejemplo n.º 3
0
Archivo: script.c Proyecto: tdihp/wrk
lua_State *script_create(char *scheme, char *host, char *port, char *path) {
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
    luaL_dostring(L, "wrk = require \"wrk\"");

    luaL_newmetatable(L, "wrk.stats");
    luaL_register(L, NULL, statslib);
    lua_pop(L, 1);

    const table_field fields[] = {
        { "scheme", LUA_TSTRING, scheme },
        { "host",   LUA_TSTRING, host   },
        { "port",   LUA_TSTRING, port   },
        { "path",   LUA_TSTRING, path   },
        { NULL,     0,           NULL   },
    };

    lua_getglobal(L, "wrk");
    set_fields(L, 1, fields);
    lua_pop(L, 1);

    return L;
}
Ejemplo n.º 4
0
void TabAnimation::on_select_comboBox_currentIndexChanged(int index)
{
    if (data_loading == true) { return; }
    set_fields(index);
}
Ejemplo n.º 5
0
int main(int argc , char **argv ) 
{ int optc ;
  _Bool ok ;
  _Bool delim_specified ;
  char *spec_list_string ;
  char *tmp ;
  char *tmp___0 ;
  char *tmp___1 ;
  size_t tmp___2 ;
  char *tmp___3 ;
  char *tmp___4 ;
  char *tmp___5 ;
  char *tmp___6 ;
  char *tmp___7 ;
  _Bool tmp___8 ;
  _Bool tmp___9 ;
  int *tmp___10 ;
  int tmp___11 ;
  int tmp___12 ;

  {
  delim_specified = (_Bool)0;
  set_program_name((char const   *)*(argv + 0));
  setlocale(6, "");
  bindtextdomain("coreutils", "/usr/local/share/locale");
  textdomain("coreutils");
  atexit(& close_stdout);
  operating_mode = (enum operating_mode )0;
  suppress_non_delimited = (_Bool)0;
  delim = (unsigned char )'\000';
  have_read_stdin = (_Bool)0;
  while (1) {
    optc = getopt_long(argc, (char * const  *)argv, "b:c:d:f:ns", longopts, (int *)((void *)0));
    if (! (optc != -1)) {
      break;
    } else {

    }
    switch (optc) {
    case 98: 
    case 99: 
    if ((unsigned int )operating_mode != 0U) {
      while (1) {
        tmp = gettext("only one type of list may be specified");
        error(0, 0, (char const   *)tmp);
        usage(1);
        break;
      }
    } else {

    }
    operating_mode = (enum operating_mode )1;
    spec_list_string = optarg;
    break;
    case 102: 
    if ((unsigned int )operating_mode != 0U) {
      while (1) {
        tmp___0 = gettext("only one type of list may be specified");
        error(0, 0, (char const   *)tmp___0);
        usage(1);
        break;
      }
    } else {

    }
    operating_mode = (enum operating_mode )2;
    spec_list_string = optarg;
    break;
    case 100: 
    if ((int )*(optarg + 0) != 0) {
      if ((int )*(optarg + 1) != 0) {
        while (1) {
          tmp___1 = gettext("the delimiter must be a single character");
          error(0, 0, (char const   *)tmp___1);
          usage(1);
          break;
        }
      } else {

      }
    } else {

    }
    delim = (unsigned char )*(optarg + 0);
    delim_specified = (_Bool)1;
    break;
    case 128: 
    output_delimiter_specified = (_Bool)1;
    if ((int )*(optarg + 0) == 0) {
      output_delimiter_length = 1UL;
    } else {
      tmp___2 = strlen((char const   *)optarg);
      output_delimiter_length = tmp___2;
    }
    output_delimiter_string = xstrdup((char const   *)optarg);
    break;
    case 110: 
    break;
    case 115: 
    suppress_non_delimited = (_Bool)1;
    break;
    case 129: 
    complement = (_Bool)1;
    break;
    case -130: 
    usage(0);
    break;
    case -131: 
    version_etc(stdout, "cut", "GNU coreutils", Version, "David M. Ihnat", "David MacKenzie", "Jim Meyering", (char *)((void *)0));
    exit(0);
    break;
    default: 
    usage(1);
    }
  }
  if ((unsigned int )operating_mode == 0U) {
    while (1) {
      tmp___3 = gettext("you must specify a list of bytes, characters, or fields");
      error(0, 0, (char const   *)tmp___3);
      usage(1);
      break;
    }
  } else {

  }
  if ((int )delim != 0) {
    if ((unsigned int )operating_mode != 2U) {
      while (1) {
        tmp___4 = gettext("an input delimiter may be specified only when operating on fields");
        error(0, 0, (char const   *)tmp___4);
        usage(1);
        break;
      }
    } else {

    }
  } else {

  }
  if (suppress_non_delimited) {
    if ((unsigned int )operating_mode != 2U) {
      while (1) {
        tmp___5 = gettext("suppressing non-delimited lines makes sense\n\tonly when operating on fields");
        error(0, 0, (char const   *)tmp___5);
        usage(1);
        break;
      }
    } else {

    }
  } else {

  }
  if (output_delimiter_specified) {
    range_start_ht = hash_initialize(31UL, (Hash_tuning const   *)((void *)0), & hash_int, & hash_compare_ints, (void (*)(void * ))((void *)0));
    if ((unsigned long )range_start_ht == (unsigned long )((void *)0)) {
      xalloc_die();
    } else {

    }
  } else {

  }
  tmp___8 = set_fields((char const   *)spec_list_string);
  if (! tmp___8) {
    if ((unsigned int )operating_mode == 2U) {
      while (1) {
        tmp___6 = gettext("missing list of fields");
        error(0, 0, (char const   *)tmp___6);
        usage(1);
        break;
      }
    } else {
      while (1) {
        tmp___7 = gettext("missing list of positions");
        error(0, 0, (char const   *)tmp___7);
        usage(1);
        break;
      }
    }
  } else {

  }
  if (! delim_specified) {
    delim = (unsigned char )'\t';
  } else {

  }
  if ((unsigned long )output_delimiter_string == (unsigned long )((void *)0)) {
    dummy[0] = (char )delim;
    dummy[1] = (char )'\000';
    output_delimiter_string = dummy;
    output_delimiter_length = 1UL;
  } else {

  }
  if (optind == argc) {
    ok = cut_file("-");
  } else {
    ok = (_Bool)1;
    while (optind < argc) {
      tmp___9 = cut_file((char const   *)*(argv + optind));
      ok = (_Bool )((int )ok & (int )tmp___9);
      optind ++;
    }
  }
  if (range_start_ht) {
    hash_free(range_start_ht);
  } else {

  }
  if (have_read_stdin) {
    tmp___11 = fclose(stdin);
    if (tmp___11 == -1) {
      tmp___10 = __errno_location();
      error(0, *tmp___10, "-");
      ok = (_Bool)0;
    } else {

    }
  } else {

  }
  if (ok) {
    tmp___12 = 0;
  } else {
    tmp___12 = 1;
  }
  exit(tmp___12);
}
}