~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to scm/uim-sh.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;; uim-sh.scm: uim interactive shell for debugging, batch processing
2
2
;;;             and serving as generic inferior process
3
3
;;;
4
 
;;; Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
 
4
;;; Copyright (c) 2003-2007 uim Project http://uim.freedesktop.org/
5
5
;;;
6
6
;;; All rights reserved.
7
7
;;;
30
30
;;; SUCH DAMAGE.
31
31
;;;;
32
32
 
 
33
(use srfi-34)
 
34
 
33
35
(define uim-sh-prompt "uim> ")
34
36
(define uim-sh-opt-batch #f)
35
37
(define uim-sh-opt-strict-batch #f)
40
42
(define uim-sh-loop
41
43
  (lambda ()
42
44
    (if (not uim-sh-opt-batch)
43
 
        (puts uim-sh-prompt))
 
45
        (display uim-sh-prompt))
44
46
    (let* ((expr (read))
45
 
           (eof (eq? (eof-val) expr)))
 
47
           (eof  (eof-object? expr)))
46
48
      (if (not eof)
47
49
          (begin
48
50
            ((if  uim-sh-opt-strict-batch
49
 
                  (lambda () #f)
 
51
                  (lambda args #f)
50
52
                  print)
51
53
             (eval expr (interaction-environment)))
52
54
            (uim-sh-loop))
70
72
 
71
73
(define uim-sh-usage
72
74
  (lambda ()
73
 
    (puts "Usage: uim-sh [options]
 
75
    (display "Usage: uim-sh [options]
74
76
  -b        batch mode. suppress shell prompts
75
77
  -B        strict batch mode, implies -b. suppress shell prompts and
76
78
            evaluated results\n")
77
79
    (if (symbol-bound? 'uim-editline-readline)
78
 
        (puts "  -r [module] Load and import module.\n"))
79
 
    (puts "  -h        show this help\n")))
 
80
        (display "  -r [module] Load and import module.\n"))
 
81
    (display "  -h        show this help\n")))
80
82
 
 
83
;; TODO: Loop even if error has occur. This is required to run GaUnit-based
 
84
;; unit test for uim
81
85
(define uim-sh
82
86
  (lambda (args)
83
87
    (uim-sh-parse-args args)
87
91
          (if (and uim-editline-enabled
88
92
                   (symbol-bound? 'uim-editline-readline))
89
93
              (activate-editline))
90
 
          (if (*catch
91
 
               'all
92
 
               (uim-sh-loop))
 
94
          (if (guard (err
 
95
                      (else
 
96
                       (%%inspect-error err)))
 
97
                (uim-sh-loop))
93
98
              (uim-sh args))))))
94
99
 
95
100
(if (symbol-bound? 'uim-editline-readline)
108
113
                        (if (not eof)
109
114
                            (begin
110
115
                              ((if uim-sh-opt-strict-batch
111
 
                                   (lambda () #f)
 
116
                                   (lambda args #f)
112
117
                                   print)
113
118
                               (eval expr (interaction-environment)))
114
119
                              (uim-sh-loop))