Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

HOW TO USE GDBM - EXT:32BIT-VECTOR

Help
Rus
2008-10-11
2013-05-29
  • Rus
    Rus
    2008-10-11

    How to use ext:32bit-vector in :gdbm package? Look here:

    ru@ru-laptop ~ $ clisp -K full
      i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
      I I I I I I I      8     8   8           8     8     o  8    8
      I  \ `+' /  I      8         8           8     8        8    8
       \  `-+-'  /       8         8           8      ooooo   8oooo
        `-__|__-'        8         8           8           8  8
            |            8     o   8           8     o     8  8
      ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

    Welcome to GNU CLISP 2.46 (2008-07-02) <http://clisp.cons.org/>

    Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
    Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
    Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
    Copyright (c) Bruno Haible, Sam Steingold 1999-2000
    Copyright (c) Sam Steingold, Bruno Haible 2001-2008

    Type :h and hit Enter for context help.

    [1]> (defvar *db* nil)
    *DB*
    [2]> (setf *db* (gdbm:gdbm-open "test.db" :read-write :newdb))
    #<GDBM:GDBM :DBF #<FOREIGN-POINTER #x0000000000863EC0> :PATH "test.db" :KEY-TYPE 7 :VALUE-TYPE 7>
    [3]> (gdbm:gdbm-setopt *db* :default-value-type 'ext:32bit-vector)

    [4]> (gdbm:gdbm-default-value-type *db*)
    32BIT-VECTOR
    [5]> (multiple-value-list (gdbm:gdbm-store *db* "key1" (vector (coerce 10345 '(unsigned-byte 32)))))

    *** - COERCE: 10345 does not fit into #(0), bad type
    The following restarts are available:
    ABORT          :R1      Abort main loop
    Break 1 [6]>

    Looks like :gdbm package not recognize ext:32bit-vector type.
    Thanks in advance for any help.

    Sincerely,

    Ru

     
    • Sam Steingold
      Sam Steingold
      2008-10-12

      VECTOR creates a simple-vector which is NOT the same as 32BIT-VECTOR.
      try
      (make-array 1 :elment-type '(unsigned-byte 32) :initial-contents '(10345))

       
    • Rus
      Rus
      2008-10-12

      Urrrrrrrra!

      It works, thank you very much, Sam.

      Sincerely,
        Ru