jpvarh.inc 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2011 by Jonas Maebe,
  4. members of the Free Pascal development team.
  5. This file declares support infrastructure for procvars under the JVM
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. type
  13. { tmethod record }
  14. TMethod = record
  15. code: JLRMethod;
  16. data: jlobject;
  17. end;
  18. { base type for procedure variables }
  19. FpcBaseProcVarType = class(jlobject,jlcloneable)
  20. method: TMethod;
  21. constructor create(inst: jlobject; const methodName: unicodestring; const argTypes: array of JLClass);overload;
  22. constructor create(const meth: tmethod);overload;
  23. procedure setFpcBaseProcVarTypeBySignature(const methodName: unicodestring; const argTypes: array of JLClass); virtual;
  24. procedure fpcDeepCopy(result: FpcBaseProcVarType); virtual;
  25. function clone: JLObject; override;
  26. strict protected
  27. type
  28. { TJObjectArray isn't declared here yet }
  29. TJLObjectDynArray = array of JLObject;
  30. function getClassProcArgs(const args: array of jlobject): TJLObjectDynArray;
  31. procedure invokeProc(const args: array of jlobject); virtual;
  32. function invokeBooleanFunc(const args: array of jlobject): jboolean; virtual;
  33. function invokeCharFunc(const args: array of jlobject): jchar; virtual;
  34. function invokeByteFunc(const args: array of jlobject): jbyte; virtual;
  35. function invokeShortFunc(const args: array of jlobject): jshort; virtual;
  36. function invokeIntFunc(const args: array of jlobject): jint; virtual;
  37. function invokeLongFunc(const args: array of jlobject): jlong; virtual;
  38. function invokeSingleFunc(const args: array of jlobject): jfloat; virtual;
  39. function invokeDoubleFunc(const args: array of jlobject): jdouble; virtual;
  40. function invokeObjectFunc(const args: array of jlobject): jlobject; virtual;
  41. end;
  42. FpcBaseNestedProcVarType = class(FpcBaseProcVarType)
  43. strict protected
  44. { add the nestedfpstruct to the list of parameters }
  45. function getNestedArgs(const args: array of jlobject): TJLObjectDynArray; virtual;
  46. public
  47. nestedfpstruct: jlobject;
  48. constructor create(inst, context: jlobject; const methodName: unicodestring; const argTypes: array of JLClass);
  49. procedure fpcDeepCopy(result: FpcBaseProcVarType); override;
  50. function clone: JLObject; override;
  51. strict protected
  52. procedure invokeProc(const args: array of jlobject); override;
  53. function invokeBooleanFunc(const args: array of jlobject): jboolean; override;
  54. function invokeCharFunc(const args: array of jlobject): jchar; override;
  55. function invokeByteFunc(const args: array of jlobject): jbyte; override;
  56. function invokeShortFunc(const args: array of jlobject): jshort; override;
  57. function invokeIntFunc(const args: array of jlobject): jint; override;
  58. function invokeLongFunc(const args: array of jlobject): jlong; override;
  59. function invokeSingleFunc(const args: array of jlobject): jfloat; override;
  60. function invokeDoubleFunc(const args: array of jlobject): jdouble; override;
  61. function invokeObjectFunc(const args: array of jlobject): jlobject; override;
  62. end;