ATSLIB/contrib/jansson/jansson

This package contains an API in ATS for the jansson library.


  • JSONptr2ptr
  • JSONptr_is_gtez
  • JSONptr_free_null
  • JSONptr_is_null
  • JSONptr_isnot_null
  • JSONiter2ptr
  • JSONiter_is_gtez
  • JSONiter_free_null
  • JSONiter_return
  • JSONiter_is_null
  • JSONiter_isnot_null
  • json_typeof
  • json_is_null
  • json_is_true
  • json_is_false
  • json_is_boolean
  • json_is_integer
  • json_is_real
  • json_is_number
  • json_is_string
  • json_is_array
  • json_is_object
  • json_incref
  • json_decref
  • json_null
  • json_true
  • json_false
  • int2json_int
  • lint2json_int
  • llint2json_int
  • json_integer
  • json_integer_value
  • json_integer_set
  • json_string
  • json_string_nocheck
  • json_string_value
  • json_string_set
  • json_string_set_nocheck
  • json_array
  • json_array_size
  • json_array_get
  • json_array_get_exnmsg
  • json_array_get_exnloc
  • json_array_get1
  • json_array_get1_exnmsg
  • json_array_get1_exnloc
  • json_array_set
  • json_array_set_new
  • json_array_append
  • json_array_append_new
  • json_array_insert
  • json_array_insert_new
  • json_array_remove
  • json_array_clear
  • json_array_extend
  • json_object
  • json_object_size
  • json_object_get
  • json_object_get_exnmsg
  • json_object_get_exnloc
  • json_object_get1
  • json_object_get1_exnmsg
  • json_object_get1_exnloc
  • json_object_set
  • json_object_set_nocheck
  • json_object_set_new
  • json_object_set_new_nocheck
  • json_object_del
  • json_object_clear
  • json_object_update
  • json_object_update_existing
  • json_object_update_missing
  • json_object_iter
  • json_object_iter_at
  • json_object_iter_next
  • json_object_iter_nextret
  • json_object_iter_key
  • json_object_iter_value
  • json_object_iter_set
  • json_object_iter_set_new
  • json_object_key_to_iter
  • json_loads
  • json_loadb
  • json_loadf
  • json_load_file
  • json_dumps
  • json_dumpf
  • json_dump_file
  • Overloaded Symbols
  • iseqz
  • isneqz

  • JSONptr2ptr

    Synopsis

    castfn JSONptr2ptr {l:addr} (x: !JSONptr(l)):<> ptr (l)

    JSONptr_is_gtez

    Synopsis

    praxi
    JSONptr_is_gtez {l:addr} (x: !JSONptr(l)): [l >= null] void

    JSONptr_free_null

    Synopsis

    praxi
    JSONptr_free_null
      {l:addr | l <= null} (x: JSONptr(l)): void

    JSONptr_is_null

    Synopsis

    fun JSONptr_is_null
      {l:addr} (x: !JSONptr l):<> bool (l==null) = "mac#atspre_ptr_is_null"

    JSONptr_isnot_null

    Synopsis

    fun JSONptr_isnot_null
      {l:addr} (x: !JSONptr (l)):<> bool (l > null) = "mac#atspre_ptr_isnot_null"

    JSONiter2ptr

    Synopsis

    castfn JSONiter2ptr {l1,l2:addr} (x: !JSONiter (l1, l2)):<> ptr (l2)

    JSONiter_is_gtez

    Synopsis

    praxi
    JSONiter_is_gtez
      {l1,l2:addr}
      (x: !JSONiter (l1, l2)): [l2 >= null] void

    JSONiter_free_null

    Synopsis

    praxi
    JSONiter_free_null
      {l1,l2:addr | l2 <= null} (x: JSONiter (l1, l2)): void

    JSONiter_return

    Synopsis

    praxi
    JSONiter_return
      {l1,l2:addr}
      (json: !JSONptr l1, iter: JSONiter (l1, l2)): void

    JSONiter_is_null

    Synopsis

    fun JSONiter_is_null
      {l1,l2:addr}
      (x: !JSONiter (l1, l2)):<> bool (l2==null) = "mac#atspre_ptr_is_null"

    JSONiter_isnot_null

    Synopsis

    fun JSONiter_isnot_null
      {l1,l2:addr}
      (x: !JSONiter (l1, l2)):<> bool (l2 > null) = "mac#atspre_ptr_isnot_null"

    json_typeof

    Synopsis

    fun json_typeof (json: !JSONptr1): int = "mac#%"

    json_is_null

    Synopsis

    fun json_is_null
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_true

    Synopsis

    fun json_is_true
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_false

    Synopsis

    fun json_is_false
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_boolean

    Synopsis

    fun json_is_boolean
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_integer

    Synopsis

    fun json_is_integer
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_real

    Synopsis

    fun json_is_real
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_number

    Synopsis

    fun json_is_number
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_string

    Synopsis

    fun json_is_string
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_array

    Synopsis

    fun json_is_array
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_is_object

    Synopsis

    fun json_is_object
      {l:addr} (json: !JSONptr (l)) : bool = "mac#%"

    json_incref

    Synopsis

    fun
    json_incref{l:agz}
      (json: !JSONptr(l)) : JSONptr(l) = "mac#%"

    json_decref

    Synopsis

    fun
    json_decref (json: JSONptr0): void = "mac#%"

    json_null

    Synopsis

    fun json_null () : JSONptr1 = "mac#%"

    json_true

    Synopsis

    fun json_true () : JSONptr1 = "mac#%"

    json_false

    Synopsis

    fun json_false () : JSONptr1 = "mac#%"

    int2json_int

    Synopsis

    castfn int2json_int (x: int): json_int

    lint2json_int

    Synopsis

    castfn lint2json_int (x: lint): json_int

    llint2json_int

    Synopsis

    castfn llint2json_int (x: llint): json_int

    json_integer

    Synopsis

    fun json_integer
      (value: json_int) : JSONptr0 = "mac#%"

    json_integer_value

    Synopsis

    fun json_integer_value
      (json: !JSONptr1): json_int = "mac#%"

    json_integer_set

    Synopsis

    fun json_integer_set
      (json: !JSONptr1, value: json_int): int(*err*) = "mac#%"

    json_string

    Synopsis

    fun json_string
      (value: NSH(string)) : JSONptr0 = "mac#%"

    json_string_nocheck

    Synopsis

    fun json_string_nocheck
      (value: NSH(string)) : JSONptr0 = "mac#%"

    json_string_value

    Synopsis

    fun json_string_value
      {l1:agz} (
      json: !JSONptr (l1)
    ) : [l2:agz]
      (minus (JSONptr l1, strptr l2) | strptr l2) = "mac#%"

    json_string_set

    Synopsis

    fun json_string_set
      (json: !JSONptr1, value: NSH(string)): int = "mac#"

    json_string_set_nocheck

    Synopsis

    fun json_string_set_nocheck
      (json: !JSONptr1, value: NSH(string)): int = "mac#%"

    json_array

    Synopsis

    fun json_array ((*void*)) : JSONptr0 = "mac#%"

    json_array_size

    Synopsis

    fun json_array_size (json: !JSONptr1) : size_t = "mac#%"

    json_array_get

    Synopsis

    fun json_array_get
      {l1:agz} (
      json: !JSONptr (l1), index: size_t
    ) : [l2:addr]
      (minus (JSONptr l1, JSONptr l2) | JSONptr l2) = "mac#%"

    json_array_get_exnmsg

    Synopsis

    fun json_array_get_exnmsg
      {l1:agz} (
      json: !JSONptr (l1), index: size_t, msg: NSH(string)
    ) : [l2:agz]
      (minus (JSONptr l1, JSONptr l2) | JSONptr l2) = "mac#%"

    json_array_get_exnloc

    Synopsis

    macdef
    json_array_get_exnloc (x, i) =
      json_array_get_exnmsg (,(x), ,(i), $mylocation)

    json_array_get1

    Synopsis

    fun json_array_get1
      (json: !JSONptr1, index: size_t): JSONptr0 = "mac#%"

    json_array_get1_exnmsg

    Synopsis

    fun json_array_get1_exnmsg
      (json: !JSONptr1, index: size_t, msg: NSH(string)): JSONptr1 = "mac#%"

    json_array_get1_exnloc

    Synopsis

    macdef
    json_array_get1_exnloc (x, i) =
      json_array_get1_exnmsg (,(x), ,(i), $mylocation)

    json_array_set

    Synopsis

    fun json_array_set
    (
      json: !JSONptr1, index: size_t, value: !JSONptr0(*preserved*)
    ) : int(*err*) = "mac#%"

    json_array_set_new

    Synopsis

    fun json_array_set_new
    (
      json: !JSONptr1, index: size_t, value: (JSONptr0)/*consumed*/
    ) : int(*err*) = "mac#%"

    json_array_append

    Synopsis

    fun json_array_append
    (
      json: !JSONptr1, value: !JSONptr0(*preserved*)
    ) : int(*err*) = "mac#%"

    json_array_append_new

    Synopsis

    fun json_array_append_new
    (
      json: !JSONptr1, value: (JSONptr0)/*consumed*/
    ) : int(*err*) = "mac#%"

    json_array_insert

    Synopsis

    fun json_array_insert
    (
      json: !JSONptr1, index: size_t, value: !JSONptr0(*preserved*)
    ) : int(*err*) = "mac#%"

    json_array_insert_new

    Synopsis

    fun json_array_insert_new
    (
      json: !JSONptr1, index: size_t, value: (JSONptr0)/*consumed*/
    ) : int(*err*) = "mac#%"

    json_array_remove

    Synopsis

    fun json_array_remove
      (json: !JSONptr1, index: size_t): int(*err*) = "mac#%"

    json_array_clear

    Synopsis

    fun json_array_clear (json: !JSONptr1): int(*0*) = "mac#%"

    json_array_extend

    Synopsis

    fun json_array_extend
      (json1: !JSONptr1, json2: !JSONptr0): int(*err*) = "mac#%"

    json_object

    Synopsis

    fun json_object ((*void*)) : JSONptr0 = "mac#%"

    json_object_size

    Synopsis

    fun json_object_size (json: !JSONptr1): size_t = "mac#%"

    json_object_get

    Synopsis

    fun json_object_get
      {l1:agz} (
      json: !JSONptr l1, key: NSH(string)
    ) : [l2:addr]
      (minus (JSONptr l1, JSONptr l2) | JSONptr l2) = "mac#%"

    json_object_get_exnmsg

    Synopsis

    fun
    json_object_get_exnmsg {l1:agz}
    (
      json: !JSONptr l1, key: NSH(string), msg: NSH(string)
    ) : [l2:agz]
    (
      minus (JSONptr l1, JSONptr l2) | JSONptr l2
    ) = "mac#%" // end of [json_object_get_exnmsg]

    json_object_get_exnloc

    Synopsis

    macdef
    json_object_get_exnloc (x, k) =
      json_object_get_exnmsg (,(x), ,(k), $mylocation)

    json_object_get1

    Synopsis

    fun json_object_get1
      (json: !JSONptr1, key: NSH(string)): JSONptr0 = "mac#%"

    json_object_get1_exnmsg

    Synopsis

    fun json_object_get1_exnmsg
      (json: !JSONptr1, key: NSH(string), msg: NSH(string)): JSONptr1 = "mac#%"

    json_object_get1_exnloc

    Synopsis

    macdef
    json_object_get1_exnloc (x, k) =
      json_object_get1_exnmsg (,(x), ,(k), $mylocation)

    json_object_set

    Synopsis

    fun json_object_set
    (
      json: !JSONptr1, key: NSH(string), value: !JSONptr0 (*preserved*)
    ) : int(*err*) = "mac#%" // endfun

    json_object_set_nocheck

    Synopsis

    fun json_object_set_nocheck
    (
      json: !JSONptr1, key: NSH(string), value: !JSONptr0 (*preserved*)
    ) : int(*err*) = "mac#%"

    json_object_set_new

    Synopsis

    fun json_object_set_new
    (
      json: !JSONptr1, key: NSH(string), value: (JSONptr0)/*consumed*/
    ) : int(*err*) = "mac#%"

    json_object_set_new_nocheck

    Synopsis

    fun json_object_set_new_nocheck
    (
      json: !JSONptr1, key: NSH(string), value: (JSONptr0)/*consumed*/
    ) : int(*err*) = "mac#%"

    json_object_del

    Synopsis

    fun json_object_del
    (
      json: !JSONptr1, key: NSH(string)
    ) : int(*err*) = "mac#%"

    json_object_clear

    Synopsis

    fun json_object_clear (json: !JSONptr1): int(*err*) = "mac#%"

    json_object_update

    Synopsis

    fun json_object_update
      (json1: !JSONptr1, json2: !JSONptr0) : int(*err*) = "mac#%"

    json_object_update_existing

    Synopsis

    fun json_object_update_existing
      (json1: !JSONptr1, json2: !JSONptr0) : int(*err*) = "mac#%"

    json_object_update_missing

    Synopsis

    fun json_object_update_missing
      (json1: !JSONptr1, json2: !JSONptr0) : int(*err*) = "mac#%"

    json_object_iter

    Synopsis

    fun
    json_object_iter
      {l:agz} (json: !JSONptr (l)) : JSONiter0 (l) = "mac#%"

    json_object_iter_at

    Synopsis

    fun
    json_object_iter_at{l:agz}
      (json: !JSONptr (l), key: NSH(string)): JSONiter0 (l) = "mac#%"

    json_object_iter_next

    Synopsis

    fun
    json_object_iter_next{l1,l2:agz}
      (json: !JSONptr l1, iter: !JSONiter (l1, l2)): JSONiter0 (l1) = "mac#%"

    json_object_iter_nextret

    Synopsis

    fun
    json_object_iter_nextret{l1,l2:agz}
      (json: !JSONptr l1, iter: (JSONiter (l1, l2))): JSONiter0 (l1) = "mac#%"

    json_object_iter_key

    Synopsis

    fun json_object_iter_key
      {l1,l2:agz} (iter: !JSONiter (l1, l2)): objkey l1 = "mac#%"

    json_object_iter_value

    Synopsis

    fun json_object_iter_value
      {l1,l2:agz} (iter: !JSONiter (l1, l2)): JSONptr1 = "mac#%"

    json_object_iter_set

    Synopsis

    fun
    json_object_iter_set
      {l1,l2,l3:agz} (
      json: !JSONptr l1
    , iter: !JSONiter (l1, l2)
    , value: !JSONptr l3(*preserved*)
    ) : int(*err*) = "mac#%" // endfun

    json_object_iter_set_new

    Synopsis

    fun
    json_object_iter_set_new
      {l1,l2,l3:agz} (
      json: !JSONptr l1
    , iter: !JSONiter (l1, l2)
    , value:  JSONptr l3 /*consumed*/
    ) : int(*err*) = "mac#%" // endfun

    json_object_key_to_iter

    Synopsis

    fun json_object_key_to_iter
      {l:addr} (key: objkey (l)): JSONiter1 (l) = "mac#%"

    json_loads

    Synopsis

    fun json_loads
    (
      inp: NSH(string)
    , flags: int
    , error: &json_err? >> _
    ) : JSONptr0 = "mac#%" // endfun

    Example

    The following code creates a JSON-value based on a given string representation, prints it onto the standard output channel and then free the JSON-value:
    //
    staload "jansson/SATS/jansson.sats"
    //
    implement
    main () = let
    //
      var err: json_err? 
    //
      val root =
        json_loads ("{\"int\":0}", 0(*flag*), err)
      val () = assertloc (JSONptr_isnot_null (root))
    //
      val _(*err*) =
        json_dumpf (rt, stdout_ref, 0)
      // end of [val]
      val () = fprint_newline (stdout_ref)
    //
      val () = json_decref (root)
    in
      // nothing
    end // end of [main]
    

    json_loadb

    Synopsis

    fun json_loadb
      {lb:addr}
      {n1,n2:int | n1 >= n2}
    (
      pf: !bytes(n1) @ lb
    | bufp: ptr lb, n2: size_t n2
    , flags: int
    , error: &json_err? >> _
    ) : JSONptr0 = "mac#%" // endfun

    json_loadf

    Synopsis

    fun json_loadf
    (
      inp: FILEref
    , flags: int
    , error: &json_err? >> _
    ) : JSONptr0 = "mac#%" // endfun

    json_load_file

    Synopsis

    fun json_load_file
    (
      path: NSH(string)
    , flags: int
    , error: &json_err? >> _
    ) : JSONptr0 = "mac#%" // endfun

    json_dumps

    Synopsis

    fun json_dumps
      (root: !JSONptr1, flags: int): Strptr0 = "mac#%"

    json_dumpf

    Synopsis

    fun json_dumpf
      (root: !JSONptr1, out: FILEref, flags: int): int(*err*) = "mac#%"

    json_dump_file

    Synopsis

    fun json_dump_file
      (root: !JSONptr1, path: NSH(string), flags: int): int(*err*) = "mac#%"

    Overloaded Symbols


    iseqz

    Synopsis

    overload iseqz with JSONptr_is_null

    isneqz

    Synopsis

    overload isneqz with JSONptr_isnot_null

    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo