calls.java 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Test a bunch of different calls.
  2. class base
  3. {
  4. public int int_f ()
  5. {
  6. return 27;
  7. }
  8. }
  9. public class calls extends base
  10. {
  11. static
  12. {
  13. System.loadLibrary ("calls");
  14. }
  15. public native int docall ();
  16. public byte byte_f ()
  17. {
  18. return 23;
  19. }
  20. public char char_f (int z)
  21. {
  22. return (char) ('a' + z);
  23. }
  24. public int int_f ()
  25. {
  26. return 1023;
  27. }
  28. public static long long_f (long q)
  29. {
  30. return q + 2023;
  31. }
  32. public static long longpb_f (byte b1, long q1, byte b2, long q2,
  33. byte b3, long q3)
  34. {
  35. return q1 + q2 + q3 + 3023;
  36. }
  37. public void void_f ()
  38. {
  39. System.out.println ("void");
  40. }
  41. public static short short_f ()
  42. {
  43. return 2;
  44. }
  45. public double double_f ()
  46. {
  47. return -1.0;
  48. }
  49. public float float_f ()
  50. {
  51. return (float) 1.0;
  52. }
  53. public static void main (String[] args)
  54. {
  55. calls c = new calls ();
  56. if (c.docall () != 0)
  57. System.out.println ("fail");
  58. }
  59. }