Argument Test.c 919 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // An example of passing arguments to C program
  2. // Try this program calling argtest(arg1,arg2,...)
  3. #define USE_TI89
  4. #define USE_TI92PLUS
  5. #define USE_V200
  6. #define MIN_AMS 100
  7. #include <graph.h>
  8. #include <printf.h>
  9. #include <kbd.h>
  10. #include <args.h>
  11. void _main(void)
  12. {
  13. ESI argptr;
  14. int argtype;
  15. long num;
  16. InitArgPtr (argptr);
  17. while ((argtype = GetArgType (argptr)) != END_TAG)
  18. {
  19. DrawStr (0, 30, " ", A_REPLACE);
  20. if (argtype == STR_TAG)
  21. DrawStr (0, 30, GetStrnArg (argptr), A_REPLACE);
  22. else if (argtype == POSINT_TAG || argtype == NEGINT_TAG)
  23. {
  24. num = GetIntArg (argptr);
  25. if (argtype == NEGINT_TAG)
  26. num = -num;
  27. printf_xy (0, 30, "%ld", num);
  28. }
  29. else
  30. {
  31. DrawStr (0, 30, "Wrong arg type!", A_REPLACE);
  32. ngetchx ();
  33. break;
  34. }
  35. ngetchx ();
  36. }
  37. }