File: pr_dump.ml

package info (click to toggle)
camlp4 2.04-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,576 kB
  • ctags: 3,108
  • sloc: ml: 26,444; makefile: 736; sh: 203
file content (50 lines) | stat: -rw-r--r-- 1,708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(* camlp4r *)
(***********************************************************************)
(*                                                                     *)
(*                             Camlp4                                  *)
(*                                                                     *)
(*        Daniel de Rauglaudre, projet Cristal, INRIA Rocquencourt     *)
(*                                                                     *)
(*  Copyright 1998 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(***********************************************************************)

(* $Id: pr_dump.ml,v 2.1 1999/11/23 21:05:04 ddr Exp $ *)

value interf ast =
  let pt = Ast2pt.interf (List.map fst ast) in
  let oc =
    match Pcaml.output_file.val with
    [ Some f -> open_out_bin f
    | None -> stdout ]
  in
  do output_string oc Oconfig.ast_intf_magic_number;
     output_value oc Pcaml.input_file.val;
     output_value oc pt;
     flush oc;
     match Pcaml.output_file.val with
     [ Some _ -> close_out oc
     | None -> () ];
  return ()
;

value implem ast =
  let pt = Ast2pt.implem (List.map fst ast) in
  let oc =
    match Pcaml.output_file.val with
    [ Some f -> open_out_bin f
    | None -> stdout ]
  in
  do output_string oc Oconfig.ast_impl_magic_number;
     output_value oc Pcaml.input_file.val;
     output_value oc pt;
     flush oc;
     match Pcaml.output_file.val with
     [ Some _ -> close_out oc
     | None -> () ];
  return ()
;

Pcaml.print_interf.val := interf;
Pcaml.print_implem.val := implem;