You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
574 B

1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
  1. #include "reg_index_table.hpp"
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "api/api.hpp"
  5. using namespace iflytop;
  6. static reg_index_table_iterm_t iterms[] = {};
  7. namespace iflytop {
  8. void reg_index_table_get(reg_index_table_iterm_t** table, int32_t* size) {
  9. *size = sizeof(iterms) / sizeof(iterms[0]);
  10. *table = iterms;
  11. }
  12. int32_t str_to_reg_index(const char* val) {
  13. for (int32_t i = 0; i < sizeof(iterms) / sizeof(iterms[0]); i++) {
  14. if (strcmp(iterms[i].name, val) == 0) {
  15. return iterms[i].index;
  16. }
  17. }
  18. return atoi(val);
  19. }
  20. } // namespace iflytop