
;; Copyright (C) 2016, 2021  Tommi Höynälänmaa

;; This file is part of Theme-D-Intr.

;; You can redistribute and/or modify this file under the terms of the
;; GNU General Public License as published by the Free Software
;; Foundation, either version 3 of the License, or (at your option) any
;; later version.

;; This file is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see https://www.gnu.org/licenses/.


(define-body (intr-gtk4-examples theme-d-intr-demo demo)

  (import (standard-library text-file-io)
	  (standard-library string-utilities))

  (define-simple-method demo-compute-source (((demo <demo>)) <none> nonpure)
    (let* ((str-module-name (field-ref demo 'str-module-name))
	   (str-interface-name (string-append str-module-name ".thi"))
	   (str-body-name (string-append str-module-name ".thb"))
	   (fl-interface (open-input-file str-interface-name))
	   (fl-body (open-input-file str-body-name))
	   (str-interface (read-string fl-interface))
	   (str-body (read-string fl-body)))
      (close-input-port fl-interface)
      (close-input-port fl-body)
      (field-set! demo 'str-interface str-interface)
      (field-set! demo 'str-body str-body))))



