A shell that runs x86_64 assembly
c
x86-64
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.

shell_sym.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright Yann Weber <asmsh@yannweb.net>
  2. This file is part of asmsh.
  3. asmsh is free software: you can redistribute it and/or modify it under the
  4. terms of the GNU General Public License as published by the Free Software
  5. Foundation, either version 3 of the License, or any later version.
  6. asmsh is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. details.
  10. You should have received a copy of the GNU General Public License along
  11. with asmsh. If not, see <https://www.gnu.org/licenses/>.
  12. */
  13. #ifndef ASMSH_SHELL_ENV_H
  14. #define ASMSH_SHELL_ENV_H
  15. #include "config.h"
  16. #include <unistd.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #define ASMSH_VARNAME_MAX 31
  20. #define ASMSH_SYMALLOC 64
  21. typedef struct asmsh_sym_s asmsh_sym_t;
  22. typedef struct asmsh_symtable_s asmsh_symtable_t;
  23. struct asmsh_sym_s
  24. {
  25. char name[ASMSH_VARNAME_MAX + 1];
  26. void *val;
  27. };
  28. struct asmsh_symtable_s
  29. {
  30. short freeval;
  31. asmsh_sym_t *syms;
  32. size_t syms_sz;
  33. size_t alloc;
  34. };
  35. /** if freeval value given to add are freed on clean */
  36. int asmsh_symtable_init(asmsh_symtable_t *table, short freeval);
  37. void asmsh_symtable_clean(asmsh_symtable_t *table);
  38. int asmsh_symtable_add(asmsh_symtable_t *table, const char *name, void *val);
  39. int asmsh_symtable_del(asmsh_symtable_t *table, const char *name);
  40. const asmsh_sym_t *asmsh_symtable_get(asmsh_symtable_t *table, const char *name);
  41. #include "shell.h"
  42. #endif