package piqilib

  1. Overview
  2. Docs
The Piqi library -- runtime support for multi-format Protobuf/JSON/XML/Piq data serialization and conversion

Install

Dune Dependency

Authors

Maintainers

Sources

v0.6.16.tar.gz
sha256=7490ab16b6f0f2496b58731c49eaa596985cbaff3be1edf3def8d61dae99fa53
md5=33121fae570f0949426bab875c809b78

doc/src/piqilib/piqi_config.ml.html

Source file piqi_config.ml

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
(*
   Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 Anton Lavrik

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*)

module U = Piqi_util
open U.Std


(* .piqi search paths *)
let paths = ref []


let add_path x =
  paths := !paths @ [x]


let piqi_path =
  try
    let s = Sys.getenv "PIQI_PATH" in
    let sep =
      match Sys.os_type with
        | "Win32" -> ';'
        | _ -> ':'
    in
    let l = U.string_split s sep in
    List.filter (fun s -> s <> "") l (* remove empty segments *)
  with
    Not_found -> []


(* set .piqi search path to contain CWD and $PIQI_PATH *)
let init_paths () =
  paths := !paths @ ("." :: piqi_path)


let reset_paths () =
  paths := []


(*
 * command-line options 
 *)


(* don't include built-in type definitions into piqi specifications that are
 * being processed *)
let flag_no_builtin_types = ref false


let flag_strict = ref false
let flag_no_warnings = ref false
let debug_level = ref 0
let flag_trace =
  try 
    ignore (Sys.getenv "PIQI_TRACE");
    ref true
  with Not_found ->
    ref false


let init_debug () =
  (* check location DB consistency on all debug levels *)
  if !debug_level >= 1 then Piqloc.check := true;
  (* turn on extra debugging about source line number tracking *)
  if !debug_level >= 3 then Piqloc.trace := true;
  if !debug_level >= 4 then Piqloc.crash_on_error := true;
  ()


(* this variable controls whether we parse and generate piq AST
 * for/during pretty-printing or for real use *)
let pp_mode = ref false


(* Piqi extensions automatically included when loading modules *)
let extensions = ref []

let add_include_extension (name :string) =
  extensions := !extensions @ [ name ]


(* for JSON and XML output: whether to generate piqi-any values using symbolic
 * JSON and/or XML representation (this is the default) or use full piqi-any
 * representation that wraps JSON or XML symbolic representation in a record
 * that includes the value itself, plus protobuf representation of the value,
 * typename and possibly something else *)
let gen_extended_piqi_any = ref false


(* whether to print a frame around a single output piq object *)
let piq_frameless_output = ref false
(* whether to expect a frame around a single input piq object *)
let piq_frameless_input = ref false


(* whether to parse piq in "relaxed" mode, e.g. treat words as string literals
 * and some other convenient stuff; for instance, piqi_getopt indirectly uses
 * relaxed parsing mode *)
let piq_relaxed_parsing = ref false

OCaml

Innovation. Community. Security.