List variables and folders.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Sends the list of all variables and folders through the link port.
  2. // This program does what HeapWalk(H_WALK_SYM); does on AMS 2.04 and
  3. // later, but also works on any AMS version.
  4. #define USE_TI89 // Compile for TI-89
  5. #define USE_TI92PLUS // Compile for TI-92 Plus
  6. #define USE_V200 // Compile for V200
  7. #define SAVE_SCREEN // Save/Restore LCD Contents
  8. #define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization
  9. #define NO_CALC_DETECT
  10. #define ENABLE_ERROR_RETURN
  11. #define MIN_AMS 100 // Compile for AMS 1.00 or higher
  12. #include <tigcclib.h> // Include All Header Files
  13. void _main(void)
  14. {
  15. SYM_ENTRY *symptr;
  16. unsigned char buffer[256];
  17. #ifdef SAVE_SYMPG // Saving the SymPG isn't necessary in _main, nobody else does it.
  18. SymPG_S save;
  19. TRY
  20. memcpy(&save, pSymPG, sizeof(SymPG_S));
  21. #endif
  22. if ((symptr = SymFindFirst(NULL,2)) != NULL)
  23. {
  24. strcpy(buffer, "\r\nName/Flags/hVal (dec)\r\n");
  25. LIO_SendData(buffer, strlen((char*)buffer));
  26. do
  27. {
  28. short flags = symptr->flags.flags_n;
  29. if ((flags&SF_FOLDER))
  30. sprintf((char *)buffer, "FOLDER: %-8s %04X %hd\r\n", symptr->name,
  31. flags, symptr->handle);
  32. else
  33. sprintf((char *)buffer, "%8s\\%-8s %04X %hd\r\n", SymFindFolderName(),
  34. symptr->name, flags, symptr->handle);
  35. LIO_SendData(buffer, strlen((char *)buffer));
  36. symptr = SymFindNext();
  37. } while (symptr != NULL);
  38. }
  39. #ifdef SAVE_SYMPG // See above.
  40. FINALLY
  41. memcpy(pSymPG, &save, sizeof(SymPG_S));
  42. ENDFINAL
  43. #endif
  44. }