src/Tools/Code/code_target.ML
changeset 39102 4ae1d212100f
parent 39058 551fe1af03b0
child 39142 f63715f00fdd
equal deleted inserted replaced
39071:928c5a5bdc93 39102:4ae1d212100f
    41   val assert_target: theory -> string -> string
    41   val assert_target: theory -> string -> string
    42   val the_literals: theory -> string -> literals
    42   val the_literals: theory -> string -> literals
    43   type serialization
    43   type serialization
    44   val parse_args: 'a parser -> Token.T list -> 'a
    44   val parse_args: 'a parser -> Token.T list -> 'a
    45   val serialization: (int -> Path.T option -> 'a -> unit)
    45   val serialization: (int -> Path.T option -> 'a -> unit)
    46     -> (string list -> int -> 'a -> string * string option list)
    46     -> (string list -> int -> 'a -> string * (string -> string option))
    47     -> 'a -> serialization
    47     -> 'a -> serialization
    48   val set_default_code_width: int -> theory -> theory
    48   val set_default_code_width: int -> theory -> theory
    49 
    49 
    50   val allow_abort: string -> theory -> theory
    50   val allow_abort: string -> theory -> theory
    51   type tyco_syntax = Code_Printer.tyco_syntax
    51   type tyco_syntax = Code_Printer.tyco_syntax
    69 
    69 
    70 
    70 
    71 (** abstract nonsense **)
    71 (** abstract nonsense **)
    72 
    72 
    73 datatype destination = Export of Path.T option | Produce | Present of string list;
    73 datatype destination = Export of Path.T option | Produce | Present of string list;
    74 type serialization = int -> destination -> (string * string option list) option;
    74 type serialization = int -> destination -> (string * (string -> string option)) option;
    75 
    75 
    76 fun serialization output _ content width (Export some_path) = (output width some_path content; NONE)
    76 fun serialization output _ content width (Export some_path) = (output width some_path content; NONE)
    77   | serialization _ string content width Produce = SOME (string [] width content)
    77   | serialization _ string content width Produce = SOME (string [] width content)
    78   | serialization _ string content width (Present stmt_names) = SOME (string stmt_names width content);
    78   | serialization _ string content width (Present stmt_names) = SOME (string stmt_names width content);
    79 
    79 
   357 
   357 
   358 fun export_code_for thy some_path target some_width some_module_name args naming program names =
   358 fun export_code_for thy some_path target some_width some_module_name args naming program names =
   359   export some_path (mount_serializer thy target some_width some_module_name args naming program names);
   359   export some_path (mount_serializer thy target some_width some_module_name args naming program names);
   360 
   360 
   361 fun produce_code_for thy target some_width module_name args naming program names =
   361 fun produce_code_for thy target some_width module_name args naming program names =
   362   produce (mount_serializer thy target some_width (assert_module_name module_name) args naming program names);
   362   let
       
   363     val (s, deresolve) = produce (mount_serializer thy target some_width (assert_module_name module_name) args naming program names)
       
   364   in (s, map deresolve names) end;
   363 
   365 
   364 fun present_code_for thy target some_width module_name args naming program (names, selects) =
   366 fun present_code_for thy target some_width module_name args naming program (names, selects) =
   365   present selects (mount_serializer thy target some_width (assert_module_name module_name) args naming program names);
   367   present selects (mount_serializer thy target some_width (assert_module_name module_name) args naming program names);
   366 
   368 
   367 fun check_code_for thy target strict args naming program names_cs =
   369 fun check_code_for thy target strict args naming program names_cs =