Author: jonathan
Date: Thu Nov 27 16:52:55 2008
New Revision: 33284

Modified:
   branches/bcanno/include/parrot/packfile.h

Log:
[core] Define structs for bytecode annotation storage.

Modified: branches/bcanno/include/parrot/packfile.h
==============================================================================
--- branches/bcanno/include/parrot/packfile.h   (original)
+++ branches/bcanno/include/parrot/packfile.h   Thu Nov 27 16:52:55 2008
@@ -115,6 +115,7 @@
     PF_CONST_SEG,
     PF_BYTEC_SEG,
     PF_DEBUG_SEG,
+    PF_ANNOTATIONS_SEG,
 
     PF_MAX_SEG
 } pack_file_types;
@@ -209,6 +210,42 @@
     PackFile_ByteCode      *code;   /* where this segment belongs to */
 } PackFile_Debug;
 
+
+/* Key types for annotation segment. */
+#define PF_ANNOTATION_KEY_TYPE_INT 0
+#define PF_ANNOTATION_KEY_TYPE_STR 1
+#define PF_ANNOTATION_KEY_TYPE_NUM 2
+#define PF_ANNOTATION_KEY_TYPE_PMC 3
+
+typedef struct PackFile_Annotations_Key {
+    opcode_t name;
+    opcode_t type;
+} PackFile_Annotations_Key;
+
+typedef struct PackFile_Annotations_Group {
+    opcode_t bytecode_offset;
+    opcode_t entries_offset;
+} PackFile_Annotations_Group;
+
+typedef struct PackFile_Annotations_Entry {
+    opcode_t bytecode_offset;
+    opcode_t key;
+    union {
+        opcode_t integer;
+        opcode_t constant;
+    } value;
+} PackFile_Annotations_Entry;
+
+typedef struct PackFile_Annotations {
+    PackFile_Segment            base;
+    opcode_t                    num_keys;
+    PackFile_Annotations_Key    **keys;
+    opcode_t                    num_groups;
+    PackFile_Annotations_Group  **groups;
+    opcode_t                    num_entries;
+    PackFile_Annotations_Entry  **entries;
+} PackFile_Annotations;
+
 typedef struct PackFile_Directory {
     PackFile_Segment   base;
     size_t             num_segments;

Reply via email to