Hex Artifact Content
Not logged in

Artifact 102036ebffa25f18890f5d6a250c3d4d15c7264e:


0000: 3b 3b 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20  ;;.;; Copyright 
0010: 32 30 31 36 20 41 6c 64 6f 20 4e 69 63 6f 6c 61  2016 Aldo Nicola
0020: 73 20 42 72 75 6e 6f 0a 3b 3b 0a 3b 3b 20 4c 69  s Bruno.;;.;; Li
0030: 63 65 6e 73 65 64 20 75 6e 64 65 72 20 74 68 65  censed under the
0040: 20 41 70 61 63 68 65 20 4c 69 63 65 6e 73 65 2c   Apache License,
0050: 20 56 65 72 73 69 6f 6e 20 32 2e 30 20 28 74 68   Version 2.0 (th
0060: 65 20 22 4c 69 63 65 6e 73 65 22 29 3b 0a 3b 3b  e "License");.;;
0070: 20 79 6f 75 20 6d 61 79 20 6e 6f 74 20 75 73 65   you may not use
0080: 20 74 68 69 73 20 66 69 6c 65 20 65 78 63 65 70   this file excep
0090: 74 20 69 6e 20 63 6f 6d 70 6c 69 61 6e 63 65 20  t in compliance 
00a0: 77 69 74 68 20 74 68 65 20 4c 69 63 65 6e 73 65  with the License
00b0: 2e 0a 3b 3b 20 59 6f 75 20 6d 61 79 20 6f 62 74  ..;; You may obt
00c0: 61 69 6e 20 61 20 63 6f 70 79 20 6f 66 20 74 68  ain a copy of th
00d0: 65 20 4c 69 63 65 6e 73 65 20 61 74 0a 3b 3b 0a  e License at.;;.
00e0: 3b 3b 20 20 20 20 20 68 74 74 70 3a 2f 2f 77 77  ;;     http://ww
00f0: 77 2e 61 70 61 63 68 65 2e 6f 72 67 2f 6c 69 63  w.apache.org/lic
0100: 65 6e 73 65 73 2f 4c 49 43 45 4e 53 45 2d 32 2e  enses/LICENSE-2.
0110: 30 0a 3b 3b 0a 3b 3b 20 55 6e 6c 65 73 73 20 72  0.;;.;; Unless r
0120: 65 71 75 69 72 65 64 20 62 79 20 61 70 70 6c 69  equired by appli
0130: 63 61 62 6c 65 20 6c 61 77 20 6f 72 20 61 67 72  cable law or agr
0140: 65 65 64 20 74 6f 20 69 6e 20 77 72 69 74 69 6e  eed to in writin
0150: 67 2c 20 73 6f 66 74 77 61 72 65 0a 3b 3b 20 64  g, software.;; d
0160: 69 73 74 72 69 62 75 74 65 64 20 75 6e 64 65 72  istributed under
0170: 20 74 68 65 20 4c 69 63 65 6e 73 65 20 69 73 20   the License is 
0180: 64 69 73 74 72 69 62 75 74 65 64 20 6f 6e 20 61  distributed on a
0190: 6e 20 22 41 53 20 49 53 22 20 42 41 53 49 53 2c  n "AS IS" BASIS,
01a0: 0a 3b 3b 20 57 49 54 48 4f 55 54 20 57 41 52 52  .;; WITHOUT WARR
01b0: 41 4e 54 49 45 53 20 4f 52 20 43 4f 4e 44 49 54  ANTIES OR CONDIT
01c0: 49 4f 4e 53 20 4f 46 20 41 4e 59 20 4b 49 4e 44  IONS OF ANY KIND
01d0: 2c 20 65 69 74 68 65 72 20 65 78 70 72 65 73 73  , either express
01e0: 20 6f 72 20 69 6d 70 6c 69 65 64 2e 0a 3b 3b 20   or implied..;; 
01f0: 53 65 65 20 74 68 65 20 4c 69 63 65 6e 73 65 20  See the License 
0200: 66 6f 72 20 74 68 65 20 73 70 65 63 69 66 69 63  for the specific
0210: 20 6c 61 6e 67 75 61 67 65 20 67 6f 76 65 72 6e   language govern
0220: 69 6e 67 20 70 65 72 6d 69 73 73 69 6f 6e 73 20  ing permissions 
0230: 61 6e 64 0a 3b 3b 20 6c 69 6d 69 74 61 74 69 6f  and.;; limitatio
0240: 6e 73 20 75 6e 64 65 72 20 74 68 65 20 4c 69 63  ns under the Lic
0250: 65 6e 73 65 2e 0a 0a 28 64 65 66 69 6e 65 2d 65  ense...(define-e
0260: 6e 75 6d 65 72 61 74 69 6f 6e 2a 20 6d 64 62 2d  numeration* mdb-
0270: 63 75 72 73 6f 72 2d 6f 70 0a 20 20 28 66 69 72  cursor-op.  (fir
0280: 73 74 09 09 09 3b 3b 3c 20 50 6f 73 69 74 69 6f  st...;;< Positio
0290: 6e 20 61 74 20 66 69 72 73 74 20 6b 65 79 2f 64  n at first key/d
02a0: 61 74 61 20 69 74 65 6d 20 2a 2f 0a 20 20 20 66  ata item */.   f
02b0: 69 72 73 74 2d 64 75 70 09 09 3b 3b 3c 20 50 6f  irst-dup..;;< Po
02c0: 73 69 74 69 6f 6e 20 61 74 20 66 69 72 73 74 20  sition at first 
02d0: 64 61 74 61 20 69 74 65 6d 20 6f 66 20 63 75 72  data item of cur
02e0: 72 65 6e 74 20 6b 65 79 2e 0a 20 20 20 3b 3b 4f  rent key..   ;;O
02f0: 6e 6c 79 20 66 6f 72 20 23 44 55 50 53 4f 52 54  nly for #DUPSORT
0300: 20 2a 2f 0a 20 20 20 67 65 74 2d 62 6f 74 68 09   */.   get-both.
0310: 09 3b 3b 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74  .;;< Position at
0320: 20 6b 65 79 2f 64 61 74 61 20 70 61 69 72 2e 20   key/data pair. 
0330: 4f 6e 6c 79 20 66 6f 72 20 23 44 55 50 53 4f 52  Only for #DUPSOR
0340: 54 20 2a 2f 0a 20 20 20 67 65 74 2d 62 6f 74 68  T */.   get-both
0350: 2d 72 61 6e 67 65 09 3b 3b 3c 20 70 6f 73 69 74  -range.;;< posit
0360: 69 6f 6e 20 61 74 20 6b 65 79 2c 20 6e 65 61 72  ion at key, near
0370: 65 73 74 20 64 61 74 61 2e 20 4f 6e 6c 79 20 66  est data. Only f
0380: 6f 72 20 23 44 55 50 53 4f 52 54 20 2a 2f 0a 20  or #DUPSORT */. 
0390: 20 20 67 65 74 2d 63 75 72 72 65 6e 74 09 3b 3b    get-current.;;
03a0: 3c 20 52 65 74 75 72 6e 20 6b 65 79 2f 64 61 74  < Return key/dat
03b0: 61 20 61 74 20 63 75 72 72 65 6e 74 20 63 75 72  a at current cur
03c0: 73 6f 72 20 70 6f 73 69 74 69 6f 6e 20 2a 2f 0a  sor position */.
03d0: 20 20 20 67 65 74 2d 6d 75 6c 74 69 70 6c 65 09     get-multiple.
03e0: 3b 3b 3c 20 52 65 74 75 72 6e 20 6b 65 79 20 61  ;;< Return key a
03f0: 6e 64 20 75 70 20 74 6f 20 61 20 70 61 67 65 20  nd up to a page 
0400: 6f 66 20 64 75 70 6c 69 63 61 74 65 20 64 61 74  of duplicate dat
0410: 61 20 69 74 65 6d 73 0a 20 20 20 3b 3b 66 72 6f  a items.   ;;fro
0420: 6d 20 63 75 72 72 65 6e 74 20 63 75 72 73 6f 72  m current cursor
0430: 20 70 6f 73 69 74 69 6f 6e 2e 20 4d 6f 76 65 20   position. Move 
0440: 63 75 72 73 6f 72 20 74 6f 20 70 72 65 70 61 72  cursor to prepar
0450: 65 0a 20 20 20 3b 3b 66 6f 72 20 23 4e 45 58 54  e.   ;;for #NEXT
0460: 2d 4d 55 4c 54 49 50 4c 45 2e 20 4f 6e 6c 79 20  -MULTIPLE. Only 
0470: 66 6f 72 20 23 44 55 50 46 49 58 45 44 20 2a 2f  for #DUPFIXED */
0480: 0a 20 20 20 6c 61 73 74 09 09 09 3b 3b 3c 20 50  .   last...;;< P
0490: 6f 73 69 74 69 6f 6e 20 61 74 20 6c 61 73 74 20  osition at last 
04a0: 6b 65 79 2f 64 61 74 61 20 69 74 65 6d 20 2a 2f  key/data item */
04b0: 0a 20 20 20 6c 61 73 74 2d 64 75 70 09 09 3b 3b  .   last-dup..;;
04c0: 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74 20 6c 61  < Position at la
04d0: 73 74 20 64 61 74 61 20 69 74 65 6d 20 6f 66 20  st data item of 
04e0: 63 75 72 72 65 6e 74 20 6b 65 79 2e 0a 20 20 20  current key..   
04f0: 3b 3b 4f 6e 6c 79 20 66 6f 72 20 23 44 55 50 53  ;;Only for #DUPS
0500: 4f 52 54 20 2a 2f 0a 20 20 20 6e 65 78 74 09 09  ORT */.   next..
0510: 09 3b 3b 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74  .;;< Position at
0520: 20 6e 65 78 74 20 64 61 74 61 20 69 74 65 6d 20   next data item 
0530: 2a 2f 0a 20 20 20 6e 65 78 74 2d 64 75 70 09 09  */.   next-dup..
0540: 3b 3b 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74 20  ;;< Position at 
0550: 6e 65 78 74 20 64 61 74 61 20 69 74 65 6d 20 6f  next data item o
0560: 66 20 63 75 72 72 65 6e 74 20 6b 65 79 2e 0a 20  f current key.. 
0570: 20 20 3b 3b 4f 6e 6c 79 20 66 6f 72 20 23 44 55    ;;Only for #DU
0580: 50 53 4f 52 54 20 2a 2f 0a 20 20 20 6e 65 78 74  PSORT */.   next
0590: 2d 6d 75 6c 74 69 70 6c 65 09 3b 3b 3c 20 52 65  -multiple.;;< Re
05a0: 74 75 72 6e 20 6b 65 79 20 61 6e 64 20 75 70 20  turn key and up 
05b0: 74 6f 20 61 20 70 61 67 65 20 6f 66 20 64 75 70  to a page of dup
05c0: 6c 69 63 61 74 65 20 64 61 74 61 20 69 74 65 6d  licate data item
05d0: 73 0a 20 20 20 3b 3b 66 72 6f 6d 20 6e 65 78 74  s.   ;;from next
05e0: 20 63 75 72 73 6f 72 20 70 6f 73 69 74 69 6f 6e   cursor position
05f0: 2e 20 4d 6f 76 65 20 63 75 72 73 6f 72 20 74 6f  . Move cursor to
0600: 20 70 72 65 70 61 72 65 0a 20 20 20 3b 3b 66 6f   prepare.   ;;fo
0610: 72 20 23 4e 45 58 54 2d 4d 55 4c 54 49 50 4c 45  r #NEXT-MULTIPLE
0620: 2e 20 4f 6e 6c 79 20 66 6f 72 20 23 44 55 50 46  . Only for #DUPF
0630: 49 58 45 44 20 2a 2f 0a 20 20 20 6e 65 78 74 2d  IXED */.   next-
0640: 6e 6f 64 75 70 09 09 3b 3b 3c 20 50 6f 73 69 74  nodup..;;< Posit
0650: 69 6f 6e 20 61 74 20 66 69 72 73 74 20 64 61 74  ion at first dat
0660: 61 20 69 74 65 6d 20 6f 66 20 6e 65 78 74 20 6b  a item of next k
0670: 65 79 20 2a 2f 0a 20 20 20 70 72 65 76 09 09 09  ey */.   prev...
0680: 3b 3b 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74 20  ;;< Position at 
0690: 70 72 65 76 69 6f 75 73 20 64 61 74 61 20 69 74  previous data it
06a0: 65 6d 20 2a 2f 0a 20 20 20 70 72 65 76 2d 64 75  em */.   prev-du
06b0: 70 09 09 3b 3b 3c 20 50 6f 73 69 74 69 6f 6e 20  p..;;< Position 
06c0: 61 74 20 70 72 65 76 69 6f 75 73 20 64 61 74 61  at previous data
06d0: 20 69 74 65 6d 20 6f 66 20 63 75 72 72 65 6e 74   item of current
06e0: 20 6b 65 79 2e 0a 20 20 20 3b 3b 4f 6e 6c 79 20   key..   ;;Only 
06f0: 66 6f 72 20 23 44 55 50 53 4f 52 54 20 2a 2f 0a  for #DUPSORT */.
0700: 20 20 20 70 72 65 76 2d 6e 6f 64 75 70 09 09 3b     prev-nodup..;
0710: 3b 3c 20 50 6f 73 69 74 69 6f 6e 20 61 74 20 6c  ;< Position at l
0720: 61 73 74 20 64 61 74 61 20 69 74 65 6d 20 6f 66  ast data item of
0730: 20 70 72 65 76 69 6f 75 73 20 6b 65 79 20 2a 2f   previous key */
0740: 0a 20 20 20 73 65 74 09 09 09 3b 3b 3c 20 50 6f  .   set...;;< Po
0750: 73 69 74 69 6f 6e 20 61 74 20 73 70 65 63 69 66  sition at specif
0760: 69 65 64 20 6b 65 79 20 2a 2f 0a 20 20 20 73 65  ied key */.   se
0770: 74 2d 6b 65 79 09 09 3b 3b 3c 20 50 6f 73 69 74  t-key..;;< Posit
0780: 69 6f 6e 20 61 74 20 73 70 65 63 69 66 69 65 64  ion at specified
0790: 20 6b 65 79 2c 20 72 65 74 75 72 6e 20 6b 65 79   key, return key
07a0: 20 2b 20 64 61 74 61 20 2a 2f 0a 20 20 20 73 65   + data */.   se
07b0: 74 2d 72 61 6e 67 65 09 09 3b 3b 3c 20 50 6f 73  t-range..;;< Pos
07c0: 69 74 69 6f 6e 20 61 74 20 66 69 72 73 74 20 6b  ition at first k
07d0: 65 79 20 67 72 65 61 74 65 72 20 74 68 61 6e 20  ey greater than 
07e0: 6f 72 20 65 71 75 61 6c 20 74 6f 20 73 70 65 63  or equal to spec
07f0: 69 66 69 65 64 20 6b 65 79 2e 20 2a 2f 0a 20 20  ified key. */.  
0800: 20 70 72 65 76 2d 6d 75 6c 74 69 70 6c 65 29 29   prev-multiple))
0810: 0a 0a                                            ..