;; Copyright (c) 2005 Jeremy Shute

;; Permission is hereby granted, free of charge, to any person obtaining a copy
;; of this software and associated documentation files (the "Software"), to
;; deal in the Software without restriction, including without limitation the
;; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
;; sell copies of the Software, and to permit persons to whom the Software is
;; furnished to do so, subject to the following conditions:

;; The above copyright notice and this permission notice shall be included in
;; all copies or substantial portions of the Software.

;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
;; IN THE SOFTWARE.

(define *GTK-ACCEL-VISIBLE* 1)
(define *GTK-ACCEL-LOCKED*  2)
(define *GTK-ACCEL-MASK*    7)

(define *GTK-ANCHOR-CENTER*     0)
(define *GTK-ANCHOR-NORTH*      1)
(define *GTK-ANCHOR-NOTH-WEST*  2)
(define *GTK-ANCHOR-NORTH-EAST* 3)
(define *GTK-ANCHOR-SOUTH*      4)
(define *GTK-ANCHOR-SOUTH-WEST* 5)
(define *GTK-ANCHOR-SOUTH-EAST* 6)
(define *GTK-ANCHOR-WEST*       7)
(define *GTK-ANCHOR-EAST*       8)
(define *GTK-ANCHOR-N*          *GTK-ANCHOR-NORTH*)
(define *GTK-ANCHOR-NW*         *GTK-ANCHOR-NOTH-WEST*)
(define *GTK-ANCHOR-NE*         *GTK-ANCHOR-NORTH-EAST*)
(define *GTK-ANCHOR-S*          *GTK-ANCHOR-SOUTH*)
(define *GTK-ANCHOR-SW*         *GTK-ANCHOR-SOUTH-WEST*)
(define *GTK-ANCHOR-SE*         *GTK-ANCHOR-SOUTH-EAST*)
(define *GTK-ANCHOR-W*          *GTK-ANCHOR-WEST*)
(define *GTK-ANCHOR-E*          *GTK-ANCHOR-EAST*)

(define *GTK-ARROW-UP*    0)
(define *GTK-ARROW-DOWN*  1)
(define *GTK-ARROW-LEFT*  2)
(define *GTK-ARROW-RIGHT* 3)

(define *GTK-EXPAND* 1)
(define *GTK-SHRINK* 2)
(define *GTK-FILL*   4)

(define *GTK-BUTTONBOX-DEFAULT-STYLE* 0)
(define *GTK-BUTTONBOX-SPREAD*        1)
(define *GTK-BUTTONBOX-EDGE*          2)
(define *GTK-BUTTONBOX-START*         3)
(define *GTK-BUTTONBOX-END*           4)

(define *GTK-CORNER-TOP-LEFT*     0)
(define *GTK-CORNER-BOTTOM-LEFT*  1)
(define *GTK-CORNER-TOP-RIGHT*    2)
(define *GTK-CORNER-BOTTOM-RIGHT* 3)

(define *GTK-CURVE-TYPE-LINEAR* 0)
(define *GTK-CURVE-TYPE-SPLINE* 1)
(define *GTK-CURVE-TYPE-FREE*   2)

(define *GTK-DELETE-CHARS*             0)
(define *GTK-DELETE-WORD-ENDS*         1)
(define *GTK-DELETE-WORDS*             2)
(define *GTK-DELETE-DISPLAY-LINES*     3)
(define *GTK-DELETE-DISPLAY-LINE-ENDS* 4)
(define *GTK-DELETE-PARAGRAPH-ENDS*    5)
(define *GTK-DELETE-PARAGRAPHS*        6)
(define *GTK-DELETE-WHITESPACE*        7)

(define *GTK-DIR-TAB-FORWARD*  0)
(define *GTK-DIR-TAB-BACKWARD* 1)
(define *GTK-DIR-UP*           2)
(define *GTK-DIR-DOWN*         3)
(define *GTK-DIR-LEFT*         4)
(define *GTK-DIR-RIGHT*        5)

(define *GTK-EXPANDER-COLLAPSED*      0)
(define *GTK-EXPANDER-SEMI-COLLAPSED* 1)
(define *GTK-EXPANDER-SEMI-EXPANDED*  2)
(define *GTK-EXPANDER-EXPANDED*       3)

(define *GTK-IM-PREEDIT-NOTHING*  0)
(define *GTK-IM-PREEDIT-CALLBACK* 1)
(define *GTK-IM-PREEDIT-NONE*     2)

(define *GTK-IM-STATUS-NOTHING*  0)
(define *GTK-IM-STATUS-CALLBACK* 1)
(define *GTK-IM-STATUS-NONE*     2)

(define *GTK-JUSTIFY-LEFT*   0)
(define *GTK-JUSTIFY-RIGHT*  1)
(define *GTK-JUSTIFY-CENTER* 2)
(define *GTK-JUSTIFY-FILL*   3)

(define *GTK-PIXELS*      0)
(define *GTK-INCHES*      1)
(define *GTK-CENTIMETERS* 2)

(define *GTK-MOVEMENT-LOGICAL-POSITIONS* 0)
(define *GTK-MOVEMENT-VISUAL-POSITIONS*  1)
(define *GTK-MOVEMENT-WORDS*             2)
(define *GTK-MOVEMENT-DISPLAY-LINES*     3)
(define *GTK-MOVEMENT-DISPLAY-LINE-ENDS* 4)
(define *GTK-MOVEMENT-PARAGRAPHS*        5)
(define *GTK-MOVEMENT-PARAGRAPH-ENDS*    6)
(define *GTK-MOVEMENT-PAGES*             7)
(define *GTK-MOVEMENT-BUFFER-ENDS*       8)
(define *GTK-MOVEMENT-HORIZONTAL-PAGES*  9)

(define *GTK-ORIENTATION-HORIZONTAL* 0)
(define *GTK-ORIENTATION-VERTICAL*   1)

(define *GTK-PACK-START* 0)
(define *GTK-PACK-END*   1)

(define *GTK-PATH-PRIO-LOWEST*      0)
(define *GTK-PATH-PRIO-GTK*         4)
(define *GTK-PATH-PRIO-APPLICATION* 8)
(define *GTK-PATH-PRIO-THEME*       10)
(define *GTK-PATH-PRIO-RC*          12)
(define *GTK-PATH-PRIO-HIGHEST*     15)

(define *GTK-PATH-WIDGET*       0)
(define *GTK-PATH-WIDGET-CLASS* 1)
(define *GTK-PATH-CLASS*        2)

(define *GTK-POLICY-ALWAYS*    0)
(define *GTK-POLICY-AUTOMATIC* 1)
(define *GTK-POLICY-NEVER*     2)

(define *GTK-POS-LEFT*   0)
(define *GTK-POS-RIGHT*  1)
(define *GTK-POS-TOP*    2)
(define *GTK-POS-BOTTOM* 3)

(define *GTK-RELIEF-NORMAL* 0)
(define *GTK-RELIEF-HALF*   1)
(define *GTK-RELIEF-NONE*   2)

(define *GTK-RESIZE-PARENT* 0)
(define *GTK-RESIZE-QUEUE*  1)

(define *GTK-SCROLL-STEPS*            0)
(define *GTK-SCROLL-PAGES*            1)
(define *GTK-SCROLL-ENDS*             2)
(define *GTK-SCROLL-HORIZONTAL-STEPS* 3)
(define *GTK-SCROLL-HORIZONTAL-PAGES* 4)
(define *GTK-SCROLL-HORIZONTAL-ENDS*  5)

(define *GTK-SCROLL-NONE*          0)
(define *GTK-SCROLL-JUMP*          1)
(define *GTK-SCROLL-STEP-BACKWARD* 2)
(define *GTK-SCROLL-STEP-FORWARD*  3)
(define *GTK-SCROLL-PAGE-BACKWARD* 4)
(define *GTK-SCROLL-PAGE-FORWARD*  5)
(define *GTK-SCROLL-STEP-UP*       6)
(define *GTK-SCROLL-STEP-DOWN*     7)
(define *GTK-SCROLL-PAGE-UP*       8)
(define *GTK-SCROLL-PAGE-DOWN*     9)
(define *GTK-SCROLL-STEP-LEFT*     10)
(define *GTK-SCROLL-STEP-RIGHT*    11)
(define *GTK-SCROLL-PAGE-LEFT*     12)
(define *GTK-SCROLL-PAGE-RIGHT*    13)
(define *GTK-SCROLL-START*         14)
(define *GTK-SCROLL-END*           15)

(define *GTK-SELECTION-NONE*     0)
(define *GTK-SELECTION-SINGLE*   1)
(define *GTK-SELECTION-BROWSE*   2)
(define *GTK-SELECTION-MULTIPLE* 3)

(define *GTK-SHADOW-NONE*       0)
(define *GTK-SHADOW-IN*         1)
(define *GTK-SHADOW-OUT*        2)
(define *GTK-SHADOW-ETCHED-IN*  3)
(define *GTK-SHADOW-ETCHED-OUT* 4)

(define *GTK-STATE-NORMAL*      0)
(define *GTK-STATE-ACTIVE*      1)
(define *GTK-STATE-PRELIGHT*    2)
(define *GTK-STATE-SELECTED*    3)
(define *GTK-STATE-INSENSITIVE* 4)

(define *GTK-TOOLBAR-ICONS*      0)
(define *GTK-TOOLBAR-TEXT*       1)
(define *GTK-TOOLBAR-BOTH*       2)
(define *GTK-TOOLBAR-BOTH-HORIZ* 3)

(define *GTK-UPDATE-CONTINUOUS*    0)
(define *GTK-UPDATE-DISCONTINUOUS* 1)
(define *GTK-UPDATE-DELAYED*       2)

(define *GTK-VISIBILITY-NONE*    0)
(define *GTK-VISIBILITY-PARTIAL* 1)
(define *GTK-VISIBILITY-FULL*    2)

(define *GTK-WIN-POS-NONE*             0)
(define *GTK-WIN-POS-CENTER*           1)
(define *GTK-WIN-POS-MOUSE*            2)
(define *GTK-WIN-POS-CENTER-ALWAYS*    3)
(define *GTK-WIN-POS-CENTER-ON-PARENT* 4)

(define *GTK-WINDOW-TOPLEVEL* 0)
(define *GTK-WINDOW-POPUP*    1)

(define *GTK-SORT-ASCENDING*  0)
(define *GTK-SORT-DESCENDING* 1)

(define-macro
  (with-gtk-server . body)
  (let ((s (gensym)) (i (gensym)) (o (gensym)))
    `(let* ((,s
             (run-process
               "gtk-server"
               "stdin"
               input:
               pipe:
               output:
               pipe:))
            (,i (process-input-port ,s))
            (,o (process-output-port ,s)))
       (unwind-protect
         (let ((gtk-server-callback
                 (lambda::bstring
                   (arg0::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_server_callback"
                                    " "
                                    (if arg0 "1" "0"))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-server-enable-c-string-escaping
                 (lambda::unspecified
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_server_enable_c_string_escaping")
                             (flush-output-port (current-output-port))
                             (read-line)
                             (unspecified)))))))
               (gtk-server-disable-c-string-escaping
                 (lambda::unspecified
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_server_disable_c_string_escaping")
                             (flush-output-port (current-output-port))
                             (read-line)
                             (unspecified)))))))
               (gtk-server-connect
                 (lambda::procedure
                   (arg0::bstring arg1::symbol)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (let ((tmp (gensym)))
                               (print "gtk_server_connect"
                                      " "
                                      arg0
                                      " "
                                      (symbol->string arg1)
                                      " "
                                      (symbol->string tmp))
                               (flush-output-port (current-output-port))
                               (read-line)
                               (lambda (val)
                                  (eq? (string->symbol val) tmp)))))))))
               (gtk-window-new
                 (lambda::bstring
                   (arg0::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_new"
                                    " "
                                    (number->string arg0))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-window-set-title
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_title"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1))))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-window-set-default-size
                 (lambda::unspecified
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_default_size"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-window-set-position
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_position"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-window-set-resizable
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_resizable"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-window-set-transient-for
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_transient_for"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-window-maximize
                 (lambda::unspecified
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_maximize" " " arg0)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-message-dialog-new
                 (lambda::bstring
                   (arg0::bstring
                     arg1::bint
                     arg2::bint
                     arg3::bint
                     arg4::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_message_dialog_new"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2)
                                    " "
                                    (number->string arg3)
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg4))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-window-set-icon-from-file
                 (lambda::bool
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_window_set_icon_from_file"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    "NULL")
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-window-set-icon-from-file"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-table-new
                 (lambda::bstring
                   (arg0::bint arg1::bint arg2::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_table_new"
                                    " "
                                    (number->string arg0)
                                    " "
                                    (number->string arg1)
                                    " "
                                    (if arg2 "1" "0"))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-table-attach-defaults
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bint
                     arg3::bint
                     arg4::bint
                     arg5::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_table_attach_defaults"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (number->string arg2)
                                    " "
                                    (number->string arg3)
                                    " "
                                    (number->string arg4)
                                    " "
                                    (number->string arg5))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-container-add
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_container_add" " " arg0 " " arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-container-remove
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_container_remove" " " arg0 " " arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-hbox-new
                 (lambda::bstring
                   (arg0::bool arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_hbox_new"
                                    " "
                                    (if arg0 "1" "0")
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-vbox-new
                 (lambda::bstring
                   (arg0::bool arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_vbox_new"
                                    " "
                                    (if arg0 "1" "0")
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-box-pack-start
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bool
                     arg3::bool
                     arg4::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_box_pack_start"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (if arg2 "1" "0")
                                    " "
                                    (if arg3 "1" "0")
                                    " "
                                    (number->string arg4))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-box-pack-end
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bool
                     arg3::bool
                     arg4::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_box_pack_end"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (if arg2 "1" "0")
                                    " "
                                    (if arg3 "1" "0")
                                    " "
                                    (number->string arg4))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-box-pack-start-defaults
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_box_pack_start_defaults"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-box-pack-end-defaults
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_box_pack_end_defaults"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-button-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_new")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-button-new-with-label
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_new_with_label"
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg0))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-button-new-from-stock
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_new_from_stock"
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg0))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-button-new-with-mnemonic
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_new_with_mnemonic"
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg0))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-button-set-use-stock
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_set_use_stock"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-button-set-label
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_set_label"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1))))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-button-set-relief
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_button_set_relief"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-toggle-button-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_toggle_button_new")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-toggle-button-new-with-label
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_toggle_button_new_with_label"
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg0))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-toggle-button-get-active
                 (lambda::bool
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_toggle_button_get_active" " " arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-toggle-button-get-active"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-toggle-button-set-active
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_toggle_button_set_active"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-check-button-new-with-label
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_check_button_new_with_label"
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg0))))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-entry-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_entry_new")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-entry-get-text
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_entry_get_text" " " arg0)
                             (flush-output-port (current-output-port))
                             (begin
                               (let ((retval (read)))
                                 (if (string? retval)
                                   retval
                                   (error "gtk-entry-get-text"
                                          "STRING return code required"
                                          retval))))))))))
               (gtk-entry-set-text
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_entry_set_text"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1))))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-editable-delete-text
                 (lambda::unspecified
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_editable_delete_text"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-editable-get-chars
                 (lambda::bstring
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_editable_get_chars"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin
                               (let ((retval (read)))
                                 (if (string? retval)
                                   retval
                                   (error "gtk-editable-get-chars"
                                          "STRING return code required"
                                          retval))))))))))
               (gtk-editable-set-editable
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_editable_set_editable"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-editable-select-region
                 (lambda::unspecified
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_editable_select_region"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_new" " " "NULL")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-buffer-set-text
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_set_text"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-insert-at-cursor
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_insert_at_cursor"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-insert
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_insert" " " arg0)
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-buffer-get-start-iter
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_start_iter"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-end-iter
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_end_iter"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-bounds
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_bounds"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    arg2)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-selection-bounds
                 (lambda::bool
                   (arg0::bstring arg1::bstring arg2::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_selection_bounds"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    arg2)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-text-buffer-get-selection-bounds"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-text-buffer-get-iter-at-offset
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_iter_at_offset"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-text
                 (lambda::bstring
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_text"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    arg2
                                    " "
                                    (if arg3 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin
                               (let ((retval (read)))
                                 (if (string? retval)
                                   retval
                                   (error "gtk-text-buffer-get-text"
                                          "STRING return code required"
                                          retval))))))))))
               (gtk-text-buffer-insert
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_insert"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg2)))
                                    " "
                                    (number->string arg3))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-create-tag
                 (lambda::bstring
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_create_tag"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg2)))
                                    " "
                                    (number->string arg3)
                                    " "
                                    "NULL")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-buffer-insert-with-tags-by-name
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bint
                     arg4::bstring
                     arg5::bstring
                     arg6::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_insert_with_tags_by_name"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg2)))
                                    " "
                                    (number->string arg3)
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg4)))
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg5)))
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg6)))
                                    " "
                                    "NULL")
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-apply-tag-by-name
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_apply_tag_by_name"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    arg2
                                    " "
                                    arg3)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-remove-tag-by-name
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_remove_tag_by_name"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    arg2
                                    " "
                                    arg3)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-select-range
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_select_range"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    arg2)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-get-selection-bound
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_selection_bound"
                                    " "
                                    arg0)
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-buffer-get-line-count
                 (lambda::bint
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_line_count" " " arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (if (fixnum? retval)
                                 retval
                                 (error "gtk-text-buffer-get-line-count"
                                        "LONG return code required"
                                        retval)))))))))
               (gtk-text-buffer-create-mark
                 (lambda::bstring
                   (arg0::bstring
                     arg1::bstring
                     arg2::bstring
                     arg3::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_create_mark"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    arg2
                                    " "
                                    (if arg3 "1" "0"))
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-buffer-get-iter-at-mark
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring arg2::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_get_iter_at_mark"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    arg2)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-delete-mark
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_delete_mark"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-buffer-delete-mark-by-name
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_buffer_delete_mark_by_name"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1))))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-scrolled-window-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_scrolled_window_new"
                                    " "
                                    "NULL"
                                    " "
                                    "NULL")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-scrolled-window-set-policy
                 (lambda::unspecified
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_scrolled_window_set_policy"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-scrolled-window-set-shadow-type
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_scrolled_window_set_shadow_type"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-new-with-buffer
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_new_with_buffer" " " arg0)
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-view-set-wrap-mode
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_wrap_mode"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-set-editable
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_editable"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-set-border-window-size
                 (lambda::unspecified
                   (arg0::bstring arg1::bint arg2::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_border_window_size"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-move-mark-onscreen
                 (lambda::bool
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_move_mark_onscreen"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-text-view-move-mark-onscreen"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-text-view-scroll-to-mark
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bstring
                     arg2::real
                     arg3::bool
                     arg4::real
                     arg5::real)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_scroll_to_mark"
                                    " "
                                    arg0
                                    " "
                                    arg1
                                    " "
                                    (number->string arg2)
                                    " "
                                    (if arg3 "1" "0")
                                    " "
                                    (number->string arg4)
                                    " "
                                    (number->string arg5))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-scroll-mark-onscreen
                 (lambda::unspecified
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_scroll_mark_onscreen"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-set-pixels-inside-wrap
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_pixels_inside_wrap"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-get-pixels-inside-wrap
                 (lambda::bint
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_get_pixels_inside_wrap"
                                    " "
                                    arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (if (fixnum? retval)
                                 retval
                                 (error "gtk-text-view-get-pixels-inside-wrap"
                                        "LONG return code required"
                                        retval)))))))))
               (gtk-text-view-set-pixels-above-lines
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_pixels_above_lines"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-get-pixels-above-lines
                 (lambda::bint
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_get_pixels_above_lines"
                                    " "
                                    arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (if (fixnum? retval)
                                 retval
                                 (error "gtk-text-view-get-pixels-above-lines"
                                        "LONG return code required"
                                        retval)))))))))
               (gtk-text-view-set-cursor-visible
                 (lambda::unspecified
                   (arg0::bstring arg1::bool)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_set_cursor_visible"
                                    " "
                                    arg0
                                    " "
                                    (if arg1 "1" "0"))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-view-window-to-buffer-coords
                 (lambda::unspecified
                   (arg0::bstring
                     arg1::bint
                     arg2::bint
                     arg3::bint
                     arg4::bstring
                     arg5::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_window_to_buffer_coords"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1)
                                    " "
                                    (number->string arg2)
                                    " "
                                    (number->string arg3)
                                    " "
                                    arg4
                                    " "
                                    arg5)
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-iter-forward-search
                 (lambda::bool
                   (arg0::bstring
                     arg1::bstring
                     arg2::bint
                     arg3::bstring
                     arg4::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_forward_search"
                                    " "
                                    arg0
                                    " "
                                    (with-output-to-string
                                      (lambda () (write arg1)))
                                    " "
                                    (number->string arg2)
                                    " "
                                    arg3
                                    " "
                                    arg4
                                    " "
                                    "NULL")
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-text-iter-forward-search"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-text-iter-forward-visible-cursor-position
                 (lambda::bool
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_forward_visible_cursor_position"
                                    " "
                                    arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-text-iter-forward-visible-cursor-position"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-text-iter-forward-to-line-end
                 (lambda::bool
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_forward_to_line_end"
                                    " "
                                    arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (cond ((equal? retval 1) #t)
                                     ((equal? retval 0) #f)
                                     (else
                                      (error "gtk-text-iter-forward-to-line-end"
                                             "BOOL return code required"
                                             retval))))))))))
               (gtk-text-iter-set-line
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_set_line"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-iter-get-text
                 (lambda::bstring
                   (arg0::bstring arg1::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_get_text"
                                    " "
                                    arg0
                                    " "
                                    arg1)
                             (flush-output-port (current-output-port))
                             (begin
                               (let ((retval (read)))
                                 (if (string? retval)
                                   retval
                                   (error "gtk-text-iter-get-text"
                                          "STRING return code required"
                                          retval))))))))))
               (gtk-text-iter-get-line
                 (lambda::bint
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_iter_get_line" " " arg0)
                             (flush-output-port (current-output-port))
                             (let ((retval (read)))
                               (if (fixnum? retval)
                                 retval
                                 (error "gtk-text-iter-get-line"
                                        "LONG return code required"
                                        retval)))))))))
               (gtk-text-view-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_new")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-view-get-buffer
                 (lambda::bstring
                   (arg0::bstring)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_view_get_buffer" " " arg0)
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-new
                 (lambda::bstring
                   ()
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_new" " " "NULL" " " "NULL")
                             (flush-output-port (current-output-port))
                             (read-line)))))))
               (gtk-text-set-editable
                 (lambda::unspecified
                   (arg0::bstring arg1::bint)
                   (with-input-from-port
                     ,o
                     (lambda ()
                        (with-output-to-port
                          ,i
                          (lambda ()
                             (print "gtk_text_set_editable"
                                    " "
                                    arg0
                                    " "
                                    (number->string arg1))
                             (flush-output-port (current-output-port))
                             (begin (read-line) (unspecified))))))))
               (gtk-text-insert
                 (lambda::unspecified