~ubuntu-branches/ubuntu/intrepid/electric/intrepid

« back to all changes in this revision

Viewing changes to lib/lisp/gdbmtest.scm

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2008-07-23 02:09:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080723020953-1gmnv7q2wpsdbnop
Tags: 8.07-0ubuntu1
* New Upstream version. Please check changelog for details. (LP: #242720)
* debian/control
  - Add build dependencies *-jdk, cdbs and bsh.
  - Remove build dependency dpatch. We will be using CDBS simple patchsys.
  - Refreshed runtime dependencies to default-jre | java2-runtime and bsh.
  - Added home page field.
  - Standard version 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
  - Changed email address for original maintainer to indicate who has
    refreshed the packaging.
* debian/rules
  - Revamped to use cdbs.
  - Added get-orig-source target.
* debian/patches
  - 00list, 02_sensible-browser.dpatch, 01_errors-numbers.dpatch,
    03_manpage.dpatch - Deleted, not relevant anymore.
  - 01_fix_build_xml.patch - Patch to fix the build.xml.
* debian/ant.properties
  - File to set various compilation properties.
* debian/electric.1
  - Remove the entry that causes lintian warning.
* debian/electric.desktop
  - Change as suggested by desktop-file-validate.
* debian/electric.docs
  - Updated as per changes in file names.
* debian/electric.svg
  - Name changed from electric_icon.svg.
* debian/install
  - Added appropriate locations for jar file, desktop file and wrapper shell
    script.
* debian/README.source
  - Added to comply with standards version 3.8.0.
* debian/TODO.Debian
  - Name changed form TODO.
* debain/wrapper/electric
  - Wrapper shell script to launch the application.
* debian/manpages
  - Added for installation of manpage.
* debian/watch
  - Updated to match jar files instead of older tar.gz files.
* debian/dirs
  - Removed, not needed anymore.
* debian/{electric.doc-base, electric.examples, substvars}
  - Removed, not relevant anymore.
* debian/*.debhelper
  - Removed auto generated files. Not relevant anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;;; -*-Scheme-*-
2
 
;;;
3
 
;;; An interactive command loop for testing the GNU gdbm extension.
4
 
;;; Contributed by Martin Stut.
5
 
 
6
 
 
7
 
(require 'gdbm.o)
8
 
 
9
 
(let ((gf (gdbm-open 'test.gdbm 1024 'create)) (last "nothing"))
10
 
     (if (not gf)
11
 
         (error 'gdbm-open "cannot open test.gdbm"))
12
 
     (format #t "Type ? for help~%")
13
 
     (let loop ((op (read-char)))
14
 
          (newline)
15
 
          (if (not (char=? op #\newline))
16
 
              (read-string)) ; flush rest of line
17
 
          (case op
18
 
          ((#\? #\h)
19
 
            (format #t "c -- count items~%")
20
 
            (format #t "d -- delete item~%")
21
 
            (format #t "f -- fetch item~%")
22
 
            (format #t "s -- store item~%")
23
 
            (format #t "n -- next key~%")
24
 
            (format #t "1 -- first key~%")
25
 
            (format #t "2 -- next key of last n, 1, or 2~%")
26
 
            (format #t "r -- reorganize~%")
27
 
            (format #t "q -- quit~%"))
28
 
          (#\c
29
 
            (do ((i 0 (1+ i))
30
 
                 (x (gdbm-firstkey gf) (gdbm-nextkey gf x)))
31
 
                ((not x) (format #t "Number of entries: ~s~%" i))))
32
 
          (#\d
33
 
            (display "Key: ")
34
 
            (if (gdbm-delete gf (read-string))
35
 
                (format #t "Deleted.~%")
36
 
                (format #t "Doesn't exist.~%")))
37
 
          (#\f
38
 
            (display "Key: ")
39
 
            ((lambda (d)
40
 
               (if d 
41
 
                   (format #t "Data: ~s~%" d)
42
 
                   (format #t "Doesn't exist.~%")))
43
 
              (gdbm-fetch gf (read-string))))
44
 
          (#\s
45
 
            (display "Key: ")
46
 
            ((lambda (k)
47
 
               (display "Data: ")
48
 
               (if (= 1 (gdbm-store gf k (read-string) 'insert))
49
 
                   (format #t "Already there.~%")
50
 
                   (format #t "Inserted.~%")))
51
 
              (read-string)))
52
 
          (#\n
53
 
            (display "Key: ")
54
 
            ((lambda (r)
55
 
               (if r
56
 
                   (begin
57
 
                     (format #t "Next: ~s Data: ~s~%" r (gdbm-fetch gf r))
58
 
                     (set! last r))
59
 
                   (print #f)))
60
 
              (gdbm-nextkey gf (read-string))))
61
 
          (#\1
62
 
            ((lambda (r)
63
 
               (if r
64
 
                   (begin
65
 
                     (format #t "First: ~s Data: ~s~%" r (gdbm-fetch gf r))
66
 
                     (set! last r))
67
 
                   (print #f)))
68
 
              (gdbm-firstkey gf)))
69
 
          (#\2
70
 
            ((lambda (r)
71
 
               (if r
72
 
                   (begin
73
 
                     (format #t "Next: ~s Data: ~s~%" r (gdbm-fetch gf r))
74
 
                     (set! last r))
75
 
                   (print #f)))
76
 
              (gdbm-nextkey gf last)))
77
 
          (#\r
78
 
            (gdbm-reorganize gf)
79
 
            (format #t "Reorganized.~%"))
80
 
          (#\q
81
 
            (exit)))
82
 
          (loop (read-char))))