CPmain.java 885 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Body of CPmain interface.
  3. // This file implements the code of the CPmain.cp file.
  4. // kjg November 1998.
  5. package CP.CPmain;
  6. public class CPmain
  7. {
  8. /*
  9. * Now empty. Methods have moved to ProgArgs.
  10. */
  11. public static String[] args;
  12. public static void PutArgs(String[] a)
  13. // This method is known to the CPascal compiler, but is
  14. // unknown to CPascal source programs. An initialization
  15. // call to this method is the first thing in the synthetic
  16. // main method of any module which imports CPmain.
  17. {
  18. args = a;
  19. }
  20. public static int ArgNumber()
  21. {
  22. return args.length;
  23. }
  24. public static void GetArg(int num, char[] str)
  25. {
  26. int i;
  27. for (i = 0; i < str.length && i < args[num].length(); i++) {
  28. str[i] = args[num].charAt(i);
  29. }
  30. if (i == str.length)
  31. i--;
  32. str[i] = '\0';
  33. }
  34. } // end of public class CPmain