Project

General

Profile

« Previous | Next » 

Revision 57ecad58

Added by Christophe Garion almost 6 years ago

parser-json: clean main program + add pp for vars

View differences:

src/tools/stateflow/common/datatype.ml
150 150
      name
151 151
      (pp_src pp_sffunction) component_list
152 152

  
153
  let pp_prog fmt (Program (name, component_list, _)) =
154
    Format.fprintf fmt "Main node name: %s@ %a@ "
153
  let pp_vars fmt src =
154
    Format.fprintf fmt "@[<v>%a@ @]"
155
      (Utils.fprintf_list ~sep:"@ " Printers.pp_var)
156
    src
157

  
158
  let pp_prog fmt (Program (name, component_list, vars)) =
159
    Format.fprintf fmt "Main node name: %s@ %a@ %a@"
155 160
      name
156 161
      (pp_src pp_sffunction) component_list
162
      pp_vars vars
157 163

  
158 164
  let pp_scope fmt src =
159 165
    Format.fprintf fmt (match src with
......
162 168
        | Local     -> "Local"
163 169
        | Output    -> "Output"
164 170
        | Parameter -> "Parameter")
165

  
166
  let pp_vars fmt src =
167
    Format.fprintf fmt "@[<v>%a@ @]"
168
      (Utils.fprintf_list ~sep:"@ "
169
         (fun fmt src -> match src with
170
	    | (name, scope, Bool b) -> Format.fprintf fmt "%s: %a %s := %s"
171
                                  name
172
                                  pp_scope scope
173
                                  "Bool" (string_of_bool b)
174
	    | (name, scope, Real f) -> Format.fprintf fmt "%s: %a %s := %s"
175
                                  name
176
                                  pp_scope scope
177
                                  "Real" (string_of_float f)
178
	    | (name, scope, Int i)  -> Format.fprintf fmt "%s: %a %s := %s"
179
                                  name
180
                                  pp_scope scope
181
                                  "Int" (string_of_int i)
182
         ))
183
    src
184 171
end

Also available in: Unified diff