
;; Copyright (C) 2026 Tommi Höynälänmaa

;; Distributed under GNU Lesser General Public License.


(define-interface (theme-d-intr dbus types)


  (import (standard-library core)
          (standard-library text-file-io))


  (reexport <source-expr>)

  
  (declare <dbus-type-repr> :union)

  (define <dbus-basic-type-repr>
    (:union (:singleton-type 'byte)
            (:singleton-type 'boolean)
            (:singleton-type 'int16)
            (:singleton-type 'uint16)
            (:singleton-type 'int32)
            (:singleton-type 'uint32)
            (:singleton-type 'int64)
            (:singleton-type 'uint64)
            (:singleton-type 'double)
            (:singleton-type 'unix-fd)
            (:singleton-type 'string)
            (:singleton-type 'object-path)
            (:singleton-type 'signature)))

  (define <dbus-type-repr>
    (:union <dbus-basic-type-repr>
            (:pair (:singleton-type 'struct) (:uniform-list <dbus-type-repr>))
            (:tuple (:singleton-type 'array) <dbus-type-repr>)
            (:singleton-type 'variant)
            (:tuple (:singleton-type 'dict-entry)
                    <dbus-basic-type-repr>
                    <dbus-type-repr>)))


  (declare-simple-method dbus-repr->type
    (<dbus-type-repr>) <string> pure)

  (declare-simple-method dbus-repr->theme-d
    (<dbus-type-repr>) <source-expr> pure)

  (declare-simple-method parse-dbus-signature
    (<string>) (:uniform-list <dbus-type-repr>) pure))

