JAVAHOST.H 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* javahost.h: Copyright (C) Codemist Ltd., 1996. */
  2. #define JAVA_MAGIC 0xCAFEBABE
  3. #define JAVA_THIS_MAJ 45
  4. #define JAVA_THIS_MIN 3
  5. /* The following structures define the internal format of a class file: */
  6. typedef int32 *(*JavaBuiltin)(int32 *);
  7. typedef enum Attribute_Sort
  8. { ATT_unknown,
  9. ATT_SourceFile,
  10. ATT_ConstantValue,
  11. ATT_Code,
  12. ATT_Exceptions,
  13. ATT_LineNumberTable,
  14. ATT_LocalVariableTable
  15. } Attribute_Sort;
  16. typedef struct Attribute_Info Attribute_Info;
  17. typedef struct SourceFile_Attribute
  18. { unsigned16 sourcefile_index;
  19. } SourceFile_Attribute;
  20. typedef struct ConstantValue_Attribute
  21. { unsigned16 constantvalue_index;
  22. } ConstantValue_Attribute;
  23. /* logically local to Code_Attribute */
  24. typedef struct Exception_Info
  25. { unsigned16 start_pc;
  26. unsigned16 end_pc;
  27. unsigned16 handler_pc;
  28. unsigned16 catch_type;
  29. } Exception_Info;
  30. typedef struct Code_Attribute
  31. { unsigned16 max_stack;
  32. unsigned16 max_locals;
  33. unsigned32 code_length;
  34. unsigned16 exception_table_length;
  35. unsigned16 attributes_count;
  36. unsigned8 *code;
  37. Exception_Info *exception_table;
  38. Attribute_Info *attributes;
  39. } Code_Attribute;
  40. typedef struct Exceptions_Attribute
  41. { unsigned16 number_of_exceptions;
  42. unsigned16 *exception_index_table;
  43. } Exceptions_Attribute;
  44. /* logically local to LineNumberTable_Attribute */
  45. typedef struct LineNumber_Info
  46. { unsigned16 start_pc;
  47. unsigned16 line_number;
  48. } LineNumber_Info;
  49. typedef struct LineNumberTable_Attribute
  50. { unsigned16 line_number_table_length;
  51. LineNumber_Info *line_number_table;
  52. } LineNumberTable_Attribute;
  53. /* logically local to LocalVariableTable_Attribute */
  54. typedef struct LocalVariable_Info
  55. { unsigned16 start_pc;
  56. unsigned16 length;
  57. unsigned16 name_index;
  58. unsigned16 signature_index;
  59. unsigned16 slot;
  60. } LocalVariable_Info;
  61. typedef struct LocalVariableTable_Attribute
  62. { unsigned16 local_variable_table_length;
  63. LocalVariable_Info *local_variable_table;
  64. } LocalVariableTable_Attribute;
  65. /*typedef*/ struct Attribute_Info
  66. { enum Attribute_Sort sort;
  67. union { SourceFile_Attribute *sourcefile;
  68. ConstantValue_Attribute *constantvalue;
  69. Code_Attribute *code;
  70. Exceptions_Attribute *exceptions;
  71. LineNumberTable_Attribute *linenumbertable;
  72. LocalVariableTable_Attribute *localvariabletable; } uattr;
  73. };
  74. typedef struct Cp_Info
  75. { unsigned8 tag;
  76. unsigned16 len;
  77. union { unsigned32 val; char *utf8; void *ptr; } u;
  78. } Cp_Info;
  79. /* Currently Field_Info and Method_Info are identical, but note they */
  80. /* allow different attributes. */
  81. typedef struct Field_Info
  82. { unsigned16 access_flags;
  83. unsigned16 name_index;
  84. unsigned16 signature_index;
  85. unsigned16 attributes_count;
  86. Attribute_Info *attributes;
  87. } Field_Info;
  88. typedef struct Method_Info
  89. { unsigned16 access_flags;
  90. unsigned16 name_index;
  91. unsigned16 signature_index;
  92. unsigned16 attributes_count;
  93. Attribute_Info *attributes;
  94. } Method_Info;
  95. typedef struct ClassFile {
  96. /* Internal representation of class file: see rdClassFile(). */
  97. unsigned16 access_flags;
  98. unsigned16 this_class;
  99. unsigned16 super_class;
  100. unsigned16 constant_pool_count;
  101. unsigned16 interfaces_count;
  102. unsigned16 fields_count;
  103. unsigned16 methods_count;
  104. unsigned16 attributes_count;
  105. Cp_Info *constant_pool;
  106. unsigned16 *interfaces;
  107. Field_Info *fields;
  108. Method_Info *methods;
  109. Attribute_Info *attributes;
  110. } ClassFile;
  111. /* Cp_Info tags: */
  112. #define CONSTANT_Class 7
  113. #define CONSTANT_FieldRef 9
  114. #define CONSTANT_MethodRef 10
  115. #define CONSTANT_InterfaceMethodRef 11
  116. #define CONSTANT_String 8
  117. #define CONSTANT_Integer 3
  118. #define CONSTANT_Float 4
  119. #define CONSTANT_Long 5
  120. #define CONSTANT_Double 6
  121. #define CONSTANT_NameAndType 12
  122. #define CONSTANT_Utf8 1
  123. #define CONSTANT_Unicode 2
  124. /* The next (illegal) tag represents the 2nd word of a long or double. */
  125. #define CONSTANT_Xhalf 42
  126. /* access_flags: */
  127. #define ACC_PUBLIC 0x0001
  128. #define ACC_PRIVATE 0x0002
  129. #define ACC_PROTECTED 0x0004
  130. #define ACC_STATIC 0x0008
  131. #define ACC_FINAL 0x0010
  132. #define ACC_SYNCHRONIZED 0x0020
  133. #define ACC_VOLATILE 0x0040
  134. #define ACC_TRANSIENT 0x0080
  135. #define ACC_NATIVE 0x0100
  136. #define ACC_INTERFACE 0x0200
  137. #define ACC_ABSTRACT 0x0400
  138. /* end of javahost.h */
  139.