Cross-references in list_head fields working.
[virt-mem.git] / extract / codegen / code_generation.mli
index 36140cd..c2e1271 100644 (file)
    to the kernel structures, and [kernel.ml] is the implementation.
 *)
 
-(** {2 Generate types} *)
+type code =
+    Camlp4.PreCast.Syntax.Ast.str_item * Camlp4.PreCast.Syntax.Ast.sig_item
+
+(** {2 Generate types}
+
+    Our internal types, representing kernel structures.
+*)
 
 val generate_types :
   (string
    * Struct_classify.shape_field_struct list
    * Struct_classify.content_field_struct list) list ->
-  Camlp4.PreCast.Syntax.Ast.str_item * Camlp4.PreCast.Syntax.Ast.sig_item
+  code
     (** [generate_types structures] generates the internal
        types used to store variants of each structure, including:
        - shape field structures
        - content field structures
     *)
 
-(** {2 Generate parsers} *)
+(** {2 Generate offset functions}
+
+    [offset_of_<struct>_<field> kernel_version] functions.
+
+    These actually play a very minor role: We just use them when
+    adjusting [list_head] pointers which cross between structure
+    types, so we only generate functions for those right now.
+*)
+
+val generate_offsets :
+  (string * ((Pahole_parser.info * Pahole_parser.structure) list
+            * (string * Pahole_parser.f_type) list)) list ->
+  code
+    (** [generate_offsets] generates the offset functions. *)
+
+(** {2 Generate parsers}
+
+    Functions which parse the different structures from bitstrings
+    into our internal types.
+*)
 
 val generate_parsers : (string * Struct_classify.parser_ list) list ->
-  Camlp4.PreCast.Syntax.Ast.str_item * Camlp4.PreCast.Syntax.Ast.sig_item
-  * (string, string) Hashtbl.t
+  code * (string, string) Hashtbl.t
     (** [generate_parsers] generates the parser functions.
 
        We cannot generate the complete code here because we
@@ -57,12 +81,14 @@ val generate_parsers : (string * Struct_classify.parser_ list) list ->
 val output_interf : output_file:string ->
   Camlp4.PreCast.Syntax.Ast.sig_item ->
   Camlp4.PreCast.Syntax.Ast.sig_item ->
+  Camlp4.PreCast.Syntax.Ast.sig_item ->
   unit
   (** Output the interface file. *)
 
 val output_implem : output_file:string ->
   Camlp4.PreCast.Syntax.Ast.str_item ->
   Camlp4.PreCast.Syntax.Ast.str_item ->
+  Camlp4.PreCast.Syntax.Ast.str_item ->
   (string, string) Hashtbl.t ->
   unit
   (** Output the implementation file. *)