avdl_commands.c 785 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <string.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include "avdl_commands.h"
  5. // keywords for primitive data
  6. const char *primitive_keywords[] = {
  7. "int",
  8. "float",
  9. "char",
  10. };
  11. unsigned int primitive_keywords_count = sizeof(primitive_keywords) /sizeof(char *);
  12. // native keywords
  13. const char *keywords[] = {
  14. "echo",
  15. "def",
  16. "=",
  17. "+",
  18. "-",
  19. "*",
  20. "/",
  21. "%",
  22. ">=",
  23. "==",
  24. "<=",
  25. "&&",
  26. "||",
  27. "<",
  28. ">",
  29. "group",
  30. "class",
  31. "class_function",
  32. "function",
  33. "return",
  34. "if",
  35. "for",
  36. "asset",
  37. "extern",
  38. "multistring",
  39. "include",
  40. };
  41. unsigned int keywords_total = sizeof(keywords) /sizeof(char *);
  42. int agc_commands_isNative(const char *cmdname) {
  43. for (int i = 0; i < keywords_total; i++) {
  44. if (strcmp(keywords[i], cmdname) == 0) {
  45. return 1;
  46. }
  47. }
  48. return 0;
  49. }