File: ets.html

package info (click to toggle)
erlang-doc-html 1%3A8.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 18,028 kB
  • ctags: 7,419
  • sloc: perl: 1,841; ansic: 323; erlang: 155
file content (923 lines) | stat: -rw-r--r-- 43,631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
<HTML>
<HEAD>
<!-- refpage -->
<TITLE>ets</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>


<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Erlang Systems]" SRC="min_head.gif"></A>
<H1>ets</H1>
</CENTER>
<H3>MODULE</H3>
<UL>
ets</UL>
<H3>MODULE SUMMARY</H3>
<UL>
Built-In Term Storage</UL>
<H3>DESCRIPTION</H3>
<UL>
<P>This module is an interface to the Erlang built-in term storage BIFs.
These provide the ability to store very large quantities of data in
an Erlang runtime system, and to have constant access time to the
data. (In the case of <CODE>ordered_set</CODE>, see below, access time is
proportional to the logarithm of the number of objects stored).<P>Data is organized as a set of dynamic tables, which can store
tuples. Each table is created by a process. When the process
terminates, the table is automatically destroyed. Every table has
access rights set at creation.<P>Tables are divided into four different types, <CODE>set</CODE>,
<CODE>ordered_set</CODE>, <CODE>bag</CODE> and <CODE>duplicate_bag</CODE>. 
A <CODE>set</CODE> or <CODE>ordered_set</CODE> table can only have one object
associated with each key. A <CODE>bag</CODE> or <CODE>duplicate_bag</CODE> can
have many objects associated with each key.<P>The number of tables stored at one Erlang node is limited.
The current default limit is approximately 1400 tables. The upper
limit can be increased by setting the environment variable
<CODE>ERL_MAX_ETS_TABLES</CODE> before starting the Erlang runtime system
(i.e. with the <CODE>-env</CODE> option to <CODE>erl</CODE>/<CODE>werl</CODE>).
The actual limit may be slightly higher than the one specified, but
never lower.<P>Note that there is no automatic garbage collection for tables.
Even if there are no references to a table from any process, it will
not automatically be destroyed unless the owner process terminates.
It can be destroyed explicitly by using <CODE>delete/1</CODE>.<P>Some implementation details:<P><UL>
<LI>In the current implementation, every object insert and look-up 
        operation results in one copy of the object.</LI><BR>
<LI>This module provides very limited support for concurrent updates.
        No locking is available, but the <CODE>safe_fixtable/2</CODE> function can
        be used to guarantee that a sequence of <CODE>first/1</CODE> and
        <CODE>next/2</CODE> calls will traverse the table without errors even if
        another process (or the same process) simultaneously deletes or
        inserts objects in the table.</LI><BR>
<LI><CODE>'$end_of_table'</CODE> should not be used as a key since this
        atom is used to mark the end of the table when using
        <CODE>first</CODE>/<CODE>next</CODE>.</LI><BR>
</UL>
<P>In general, the functions below will exit with reason <CODE>badarg</CODE> if
any argument is of the wrong format, or if the table identifier is
invalid.<BR>

The type <CODE>tid()</CODE> is used to denote a table identifier. Note that
the internal structure of this type is implementation-specific.</UL>
<H3>EXPORTS</H3>
<P><A NAME="all%0"><STRONG><CODE>all() -&#62; [Tab]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns a list of all tables at the node. Named tables are
         given by their names, unnamed tables are given by their
         table identifiers.</UL>
<P><A NAME="delete%1"><STRONG><CODE>delete(Tab) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Deletes the entire table <CODE>Tab</CODE>.</UL>
<P><A NAME="delete%2"><STRONG><CODE>delete(Tab, Key) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Deletes all objects with the key <CODE>Key</CODE> from the table
         <CODE>Tab</CODE>.</UL>
<P><A NAME="delete_all_objects%1"><STRONG><CODE>delete_all_objects(Tab) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Delete all objects in the ETS table <CODE>Tab</CODE>. The
        deletion is atomic.</UL>
<P><A NAME="delete_object%2"><STRONG><CODE>delete_object(Tab,Object) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Delete the exact object <CODE>Object</CODE> from the ETS table,
        leaving objects with the same key but other differences
        (useful for type <CODE>bag</CODE>).</UL>
<P><A NAME="file2tab%1"><STRONG><CODE>file2tab(Filename) -&#62; {ok,Tab} | {error,Reason}</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Filename = string() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Reads a file produced by <CODE>tab2file/2</CODE> and creates the
         corresponding table <CODE>Tab</CODE>.</UL>
<P><A NAME="first%1"><STRONG><CODE>first(Tab) -&#62; Key | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the first key <CODE>Key</CODE> in the table <CODE>Tab</CODE>. 
         If the table is of the <CODE>ordered_set</CODE> type, the first key
         in Erlang term order will be returned. If the table is of any
         other type, the first key according to the table's internal
         order will be returned. If the table is empty,
         <CODE>'$end_of_table'</CODE> will be returned.<P>Use <CODE>next/2</CODE> to find subsequent keys in the table.</UL>
<P><A NAME="fixtable%2"><STRONG><CODE>fixtable(Tab, true|false) -&#62; true | false</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P><TABLE CELLPADDING=4><TR>
      <TD VALIGN=TOP><IMG ALT="Warning!" SRC="warning.gif"></TD>
      <TD>
<P>The function is retained for backwards compatibility only.
         Use <CODE>safe_fixtable/2</CODE> instead.</TD></TR>
      </TABLE>
<P>Fixes a table for safe traversal. The function is primarily used
         by the Mnesia DBMS to implement functions which allow write
         operations in a table, although the table is in the process of
         being copied to disk or to another node. It does not keep track
         of when and how tables are fixed.</UL>
<P><A NAME="foldl%3"><STRONG><CODE>foldl(Function, Acc0, Tab) -&#62; Acc1</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Function = fun(A, AccIn) -&#62; AccOut</CODE></STRONG><BR>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Acc0 = Acc1 = AccIn = AccOut = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P><CODE>Acc0</CODE> is returned if the table is empty.
        This function is similar to <CODE>lists:foldl/3</CODE>. The order in
        which the elements of the table are traversed is unspecified,
        except for tables of type <CODE>ordered_set</CODE>, for which they
        are traversed first to last. Since <CODE>safe_fixtable/2</CODE> is
        called, the table must be public or owned by the calling process.
</UL>
<P><A NAME="foldr%3"><STRONG><CODE>foldr(Function, Acc0, Tab) -&#62; Acc1</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Function = fun(A, AccIn) -&#62; AccOut</CODE></STRONG><BR>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Acc0 = Acc1 = AccIn = AccOut = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P><CODE>Acc0</CODE> is returned if the table is empty.
        This function is similar to <CODE>lists:foldr/3</CODE>. The order in
        which the elements of the table are traversed is unspecified,
        except for tables of type <CODE>ordered_set</CODE>, for which they
        are traversed last to first. Since <CODE>safe_fixtable/2</CODE> is
        called, the table must be public or owned by the calling process.
</UL>
<P><A NAME="from_dets%2"><STRONG><CODE>from_dets(Tab, DetsTab) -&#62; Tab</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>DetsTab = atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>     Fills an already created ETS table with the objects in the
        already opened DETS table named <CODE>DetsTab</CODE>. The ETS table
        is emptied before the objects are inserted.
        </UL>
<P><A NAME="i%0"><STRONG><CODE>i() -&#62; void()</CODE></STRONG></A><BR>
<UL>
<P>Displays information about all ETS tables on tty.</UL>
<P><A NAME="i%1"><STRONG><CODE>i(Tab) -&#62; void()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Browses the table <CODE>Tab</CODE> on tty.</UL>
<P><A NAME="info%1"><STRONG><CODE>info(Tab) -&#62; [{Item,Value}] | undefined</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Item, Value - see below</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns information about the table <CODE>Tab</CODE> as a list of
         <CODE>{Item,Value}</CODE> tuples:<P><UL>
<LI>     <CODE>Item=memory, Value=int()</CODE><BR>

         The number of words allocated to the table.
         </LI><BR>
<LI>     <CODE>Item=owner, Value=pid()</CODE><BR>

         The pid of the owner of the table.
         </LI><BR>
<LI>     <CODE>Item=name, Value=atom()</CODE><BR>

         The name of the table.
         </LI><BR>
<LI>     <CODE>Item=size, Value=int()</CODE><BR>

         The number of objects inserted in the table.
         </LI><BR>
<LI>     <CODE>Item=node, Value=atom()</CODE><BR>

         The node where the table is stored. This field is no longer
         meaningful as tables cannot be accessed from other nodes.
         </LI><BR>
<LI>     <CODE>Item=named_table, Value=true|false</CODE><BR>

         Indicates if the table is named or not.
         </LI><BR>
<LI>     <CODE>Item=type, Value=set|ordered_set|bag|duplicate_bag</CODE><BR>

         The table type.
         </LI><BR>
<LI>     <CODE>Item=keypos, Value=int()</CODE><BR>

         The key position.
         </LI><BR>
<LI>     <CODE>Item=protection, Value=public|protected|private</CODE><BR>

         The table access rights.
         </LI><BR>
</UL>
</UL>
<P><A NAME="info%2"><STRONG><CODE>info(Tab, Item) -&#62; Value | undefined</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Item, Value - see below</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the information associated with <CODE>Item</CODE> for
         the table <CODE>Tab</CODE>. In addition to the <CODE>{Item,Value}</CODE>
         pairs defined for <CODE>info/1</CODE>, the following items are
         allowed:<P><UL>
<LI>     <CODE>Item=fixed, Value=true|false</CODE><BR>

         Indicates if the table is fixed by any process or not.
         </LI><BR>
<LI>     <CODE>Item=safe_fixed, Value={FirstFixed,Info}|false
         </CODE><BR>

         If the table has been fixed using <CODE>safe_fixtable/2</CODE>,
         the call returns a tuple where <CODE>FirstFixed</CODE> is the time
         when the table was first fixed by a process, which may or may
         not be one of the processes it is fixed by right now.<BR>

         <CODE>Info</CODE> is a possibly empty lists of tuples
         <CODE>{Pid,RefCount}</CODE>, one tuple for every process the table is
         fixed by right now. <CODE>RefCount</CODE> is the value of the
         reference counter, keeping track of how many times the table
         has been fixed by the process.<BR>

         If the table never has been fixed, the call returns
         <CODE>false</CODE>.<BR>

         </LI><BR>
</UL>
</UL>
<P><A NAME="init_table%2"><STRONG><CODE>init_table(Name, InitFun) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Name = atom()</CODE></STRONG><BR>
<STRONG><CODE>InitFun = fun(Arg) -&#62; Res</CODE></STRONG><BR>
<STRONG><CODE>Arg = read | close</CODE></STRONG><BR>
<STRONG><CODE>Res = end_of_input | {[object()], InitFun} | term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Replaces the existing objects of the table <CODE>Tab</CODE> with
        objects created by calling the input function <CODE>InitFun</CODE>,
        see below. This function is provided for compatibility with
        the DETS module, it's not more efficient than filling a table
        by using <CODE>ets:insert/2</CODE>.

        <P>When called with the argument <CODE>read</CODE> the function
<CODE>InitFun</CODE> is assumed to return <CODE>end_of_input</CODE> when
there is no more input, or <CODE>{Objects, Fun}</CODE>, where
<CODE>Objects</CODE> is a list of objects and <CODE>Fun</CODE> is a new
input function. Any other value Value is returned as an error
<CODE>{error, {init_fun, Value}}</CODE>. Each input function will be
called exactly once, and should an error occur, the last
function is called with the argument <CODE>close</CODE>, the reply
of which is ignored.<P>If the type of the table is <CODE>set</CODE> and there is more
        than one object with a given key, one of the objects is
        chosen. This is not necessarily the last object with the given
        key in the sequence of objects returned by the input
        functions. This holds also for duplicated
        objects stored in tables of type <CODE>duplicate_bag</CODE>.</UL>
<P><A NAME="insert%2"><STRONG><CODE>insert(Tab, ObjectOrObjects) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>ObjectOrObjects = tuple() | [tuple()]</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Inserts the object or all of the objects in the list
         <CODE>ObjectOrObjects</CODE> into the table <CODE>Tab</CODE>. If there
         already exists an object with the same key as one of the
         objects, and the table is a <CODE>set</CODE> or <CODE>ordered_set</CODE>
         table, the old object will be replaced. If the list contains
         more than one object with the same key and the table is a
         <CODE>set/ordered_set</CODE>, one will be inserted, which one is
         not defined.</UL>
<P><A NAME="last%1"><STRONG><CODE>last(Tab) -&#62; Key | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the last key <CODE>Key</CODE> according to Erlang term order
         in the table <CODE>Tab</CODE> of the <CODE>ordered_set</CODE> type. If
         the table is of any other type, the function is synonymous to
         <CODE>first/2</CODE>. If the table is empty, <CODE>'$end_of_table'</CODE> is
         returned.<P>Use <CODE>prev/2</CODE> to find preceding keys in the table.</UL>
<P><A NAME="lookup%2"><STRONG><CODE>lookup(Tab, Key) -&#62; [Object]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns a list of all objects with the key <CODE>Key</CODE> in
         the table <CODE>Tab</CODE>.<P>If the table is of type <CODE>set</CODE> or <CODE>ordered_set</CODE>,
         the function returns either the empty list or a list with one
         element, as there cannot be more than one object with the same
         key. If the table is of type <CODE>bag</CODE> or <CODE>duplicate_bag</CODE>,
         the function returns a list of arbitrary length.<P>Note that the time order of object insertions is preserved;
         The first object inserted with the given key will be first
         in the resulting list, and so on.<P>Insert and look-up times in tables of type <CODE>set</CODE>, <CODE>bag</CODE>
         and <CODE>duplicate_bag</CODE> are constant, regardless of the size of
         the table. For the <CODE>ordered_set</CODE> data-type, time is
         proportional to the (binary) logarithm of the number of objects.
        </UL>
<P><A NAME="lookup_element%3"><STRONG><CODE>lookup_element(Tab, Key, Pos) -&#62; Elem</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
<STRONG><CODE>Pos = int()</CODE></STRONG><BR>
<STRONG><CODE>Elem = term() | [term()]</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>If the table <CODE>Tab</CODE> is of type <CODE>set</CODE> or
         <CODE>ordered_set</CODE>, the function returns the <CODE>Pos</CODE>:th
         element of the object with the key <CODE>Key</CODE>.<P>If the table is of type <CODE>bag</CODE> or <CODE>duplicate_bag</CODE>,
         the functions returns a list with the <CODE>Pos</CODE>:th element of
         every object with the key <CODE>Key</CODE>.<P>If no object with the key <CODE>Key</CODE> exists, the function will
         exit with reason <CODE>badarg</CODE>.</UL>
<P><A NAME="match%2"><STRONG><CODE>match(Tab, Pattern) -&#62; [Match]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Pattern = tuple()</CODE></STRONG><BR>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Matches the objects in the table <CODE>Tab</CODE> against the pattern
         <CODE>Pattern</CODE>.<P>A pattern is a term that may contain:<P><UL>
<LI>bound parts (Erlang terms),</LI><BR>
<LI><CODE>'_'</CODE> which matches any Erlang term, and</LI><BR>
<LI>pattern variables: <CODE>'$N'</CODE> where <CODE>N</CODE>=0,1,...</LI><BR>
</UL>
<P>The function returns a list with one element for each matching
         object, where each element is an ordered list of pattern variable
         bindings. An example:<PRE>&#62; <STRONG>ets:match(T, '$1').</STRONG> % Matches every object in the table
[{rufsen,dog,7},{brunte,horse,5},{ludde,dog,5}]
&#62; <STRONG>ets:match(T, {'_',dog,'$1'}).</STRONG>
[[7],[5]]
&#62; <STRONG>ets:match(T, {'_',cow,'$1'}).</STRONG>
[]
        </PRE>
<P>If the key is specified in the pattern, the match is very
         efficient. If the key is not specified, i.e. if it is a variable
         or an underscore, the entire table must be searched. The search
         time can be substantial if the table is very large.<P>On tables of the <CODE>ordered_set</CODE> type, the result is in the
         same order as in a <CODE>first/next</CODE> traversal.</UL>
<P><A NAME="match%3"><STRONG><CODE>match(Tab, Pattern, Limit) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Pattern = tuple()</CODE></STRONG><BR>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Works like <CODE>ets:match/2</CODE> but only returns a limited
        (<CODE>Limit</CODE>) number of matching objects. The
        <CODE>Continuation</CODE> term can then be used in subsequent calls
        to <CODE>ets:match/1</CODE> to get the next chunk of matching
        objects. This is a space efficient way to work on objects in a
        table which is still faster than traversing the table object
        by object using <CODE>ets:first/1</CODE> and <CODE>ets:next/1</CODE>.<P><CODE>'$end_of_table'</CODE> is returned if the table is empty.</UL>
<P><A NAME="match%1"><STRONG><CODE>match(Continuation) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Continues a match started with <CODE>ets:match/3</CODE>. The next
         chunk of the size given in the initial <CODE>ets:match/3</CODE>
         call is returned together with a new <CODE>Continuation</CODE>
         that can be used in subsequent calls to this function.<P>'$end_of_table' is returned when there are no more
         objects in the table.</UL>
<P><A NAME="match_delete%2"><STRONG><CODE>match_delete(Tab, Pattern) -&#62; true</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Pattern = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Deletes all objects which match the pattern <CODE>Pattern</CODE> from
         the table <CODE>Tab</CODE>. See <CODE>match/2</CODE> for a description of
         patterns.</UL>
<P><A NAME="match_object%2"><STRONG><CODE>match_object(Tab, Pattern) -&#62; [Object]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Pattern = Object = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Matches the objects in the table <CODE>Tab</CODE> against the pattern
         <CODE>Pattern</CODE>. See <CODE>match/2</CODE> for a description of patterns.
         The function returns a list of all objects which match the pattern.
        <P>If the key is specified in the pattern, the match is very
         efficient. If the key is not specified, i.e. if it is a variable
         or an underscore, the entire table must be searched. The search
         time can be substantial if the table is very large.<P>On tables of the <CODE>ordered_set</CODE> type, the result is in the
         same order as in a <CODE>first/next</CODE> traversal.</UL>
<P><A NAME="match_object%3"><STRONG><CODE>match_object(Tab, Pattern, Limit) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Pattern = tuple()</CODE></STRONG><BR>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Works like <CODE>ets:match_object/2</CODE> but only returns a limited
        (<CODE>Limit</CODE>) number of matching objects. The
        <CODE>Continuation</CODE> term can then be used in subsequent calls
        to <CODE>ets:match_object/1</CODE> to get the next chunk of matching
        objects. This is a space efficient way to work on objects in a
        table which is still faster than traversing the table object
        by object using <CODE>ets:first/1</CODE> and <CODE>ets:next/1</CODE>.<P><CODE>'$end_of_table'</CODE> is returned if the table is empty.</UL>
<P><A NAME="match_object%1"><STRONG><CODE>match_object(Continuation) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Continues a match started with
         <CODE>ets:match_object/3</CODE>. The next
         chunk of the size given in the initial <CODE>ets:match_object/3</CODE>
         call is returned together with a new <CODE>Continuation</CODE>
         that can be used in subsequent calls to this function.<P>'$end_of_table' is returned when there are no more
         objects in the table.</UL>
<P><A NAME="member%2"><STRONG><CODE>member(Tab, Key) -&#62; true | false</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Works like lookup/2, but does not return the objects. The
        function returns <CODE>true</CODE> if one or more elements in the
        table has the key <CODE>Key</CODE>, <CODE>false</CODE> otherwise.</UL>
<P><A NAME="new%2"><STRONG><CODE>new(Name, Options) -&#62; tid()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Name = atom()</CODE></STRONG><BR>
<STRONG><CODE>Options = [Option]</CODE></STRONG><BR>
<STRONG><CODE>&#160;Option = Type | Access | named_table | {keypos,Pos}</CODE></STRONG><BR>
<STRONG><CODE>&#160;&#160;Type = set | ordered_set | bag | duplicate_bag</CODE></STRONG><BR>
<STRONG><CODE>&#160;&#160;Access = public | protected | private</CODE></STRONG><BR>
<STRONG><CODE>&#160;&#160;Pos = int()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Creates a new table and returns a table identifier which can be
         used in subsequent operations. The table identifier can be sent to
         other processes so that a table can be shared between different
         processes within a node.
        <P>The parameter <CODE>Options</CODE> is a list of atoms which specifies
         table type, access rights, key position and if the table is named
         or not. If one or more options are left out, the default values
         are used. This means that not specifying any options (<CODE>[]</CODE>) is
         the same as specifying <CODE>[set,protected,{keypos,1}]</CODE>.<P><UL>
<LI><CODE>set</CODE>
         The table is a <CODE>set</CODE> table - one key, one object, no
         order among objects. This is the default table type.<BR>

         </LI><BR>
<LI><CODE>ordered_set</CODE>
         The table is a <CODE>ordered_set</CODE> table - one key, one
         object, ordered in Erlang term order, which is the order
         implied by the &#60; and &#62; operators. Tables of this type
         have a somewhat different behavior in some situations
         than tables of the other types.<BR>

         </LI><BR>
<LI><CODE>bag</CODE>
         The table is a <CODE>bag</CODE> table which can have many objects,
         but only one instance of each object, per key.<BR>

         </LI><BR>
<LI><CODE>duplicate_bag</CODE>
         The table is a <CODE>duplicate_bag</CODE> table which can have many
         objects, including multiple copies of the same object, per
         key.<BR>

         </LI><BR>
<LI><CODE>public</CODE>
         Any process may read or write to the table.<BR>

         </LI><BR>
<LI><CODE>protected</CODE>
         The owner process can read and write to the table. Other
         processes can only read the table. This is the default
         setting for the access rights.<BR>

         </LI><BR>
<LI><CODE>private</CODE>
         Only the owner process can read or write to the table.<BR>

         </LI><BR>
<LI><CODE>named_table</CODE>
         If this option is present, the name <CODE>Name</CODE> is associated
         with the table identifier. The name can then be used
         instead of the table identifier in subsequent operations.<BR>

         </LI><BR>
<LI><CODE>{keypos,Pos}</CODE>
         Specfies which element in the stored tuples should be used as
         key. By default, it is the first element, i.e. <CODE>Pos=1</CODE>.
         However, this is not always appropriate. In particular,
         we do not want the first element to be the key if we want to
         store Erlang records in a table.<BR>

         Note that any tuple stored in the table must have at least
         <CODE>Pos</CODE> number of elements.<BR>

         </LI><BR>
</UL>
</UL>
<P><A NAME="next%2"><STRONG><CODE>next(Tab, Key1) -&#62; Key2 | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key1 = Key2 = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the next key <CODE>Key2</CODE>, following the key <CODE>Key1</CODE>
         in the table <CODE>Tab</CODE>. If the table is of the <CODE>ordered_set</CODE>
         type, the next key in Erlang term order is returned. If the table
         is of any other type, the next key according to the table's
         internal order is returned. If there is no next key,
         <CODE>'$end_of_table'</CODE> is returned.
        <P>Use <CODE>first/1</CODE> to find the first key in the table.<P>Unless a table of type <CODE>set</CODE>, <CODE>bag</CODE> or
         <CODE>duplicate_bag</CODE> is protected using <CODE>safe_fixtable/2</CODE>,
         see below, a traversal may fail if concurrent updates are made
         to the table.
         If the table is of type <CODE>ordered_set</CODE>, the function returns
         the next key in order, even if the object does no longer exist.</UL>
<P><A NAME="prev%2"><STRONG><CODE>prev(Tab, Key1) -&#62; Key2 | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key1 = Key2 = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the previous key <CODE>Key2</CODE>, preceding the key
         <CODE>Key1</CODE> according the Erlang term order in the table
         <CODE>Tab</CODE> of the <CODE>ordered_set</CODE> type. If the table is of
         any other type, the function is synonymous to <CODE>next/2</CODE>.
         If there is no previous key, <CODE>'$end_of_table'</CODE> is returned.
        <P>Use <CODE>last/1</CODE> to find the last key in the table.</UL>
<P><A NAME="rename%2"><STRONG><CODE>rename(Tab, Name) -&#62; Name</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = Name = atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Renames the named table <CODE>Tab</CODE> to the new name <CODE>Name</CODE>.
         Afterwards, the old name can not be used to access the table.
         Renaming an unnamed table has no effect.</UL>
<P><A NAME="safe_fixtable%2"><STRONG><CODE>safe_fixtable(Tab, true|false) -&#62; true | false</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Fixes a table of the <CODE>set</CODE>, <CODE>bag</CODE> or
         <CODE>duplicate_bag</CODE> table type for safe traversal.<P>A process fixes a table by calling <CODE>safe_fixtable(Tab,true)</CODE>.
         The table remains fixed until the process releases it by calling
         <CODE>safe_fixtable(Tab,false)</CODE>, or until the process terminates.
        <P>If several processes fix a table, the table will remain fixed
         until all processes have released it (or terminated).
         A reference counter is kept on a per process basis, and N
         consecutive fixes requires N releases to actually release
         the table.<P>When a table is fixed, a sequence of <CODE>first/1</CODE> and
         <CODE>next/2</CODE> calls are guaranteed to succeed even if objects
         are removed during the traversal. An example:<PRE>clean_all_with_value(Tab,X) -&#62;
  safe_fixtable(Tab,true),
  clean_all_with_value(Tab,X,ets:first(Tab)),
  safe_fixtable(Tab,false).
          
clean_all_with_value(Tab,X,'$end_of_table') -&#62;
  true;
clean_all_with_value(Tab,X,Key) -&#62;
  case ets:lookup(Tab,Key) of
    [{Key,X}] -&#62;
       ets:delete(Tab,Key);
    _ -&#62;
       true
  end,
  clean_all_with_value(Tab,X,ets:next(Tab,Key)).
        </PRE>
<P>Note that no deleted objects are actually removed from a fixed
         table until it has been released. If a process fixes a table but
         never releases it, the memory used by the deleted objects will
         never be freed. The performance of operations on the table will
         also degrade significantly.<P>Use <CODE>info/2</CODE> to retrieve information about which processes
         have fixed which tables. A system with a lot of processes fixing
         tables may need a monitor which sends alarms when tables have
         been fixed for too long.<P>Note that for tables of the <CODE>ordered_set</CODE> type,
         <CODE>safe_fixtable/2</CODE> is not necessary as calls to <CODE>first/1</CODE>
         and <CODE>next/2</CODE> will always succeed.</UL>
<P><A NAME="select%2"><STRONG><CODE>select(Tab, MatchSpec) -&#62; [Object]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
<STRONG><CODE>MatchSpec = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>      Matches the objects in the table <CODE>Tab</CODE> using a
         match_spec as described in ERTS users guide. This is a more
         general call than the <CODE>ets:match/2</CODE> and
         <CODE>ets:match_object/2</CODE> calls. In its simplest forms the 
         match_spec's
         look like this:
         <P><UL>
<LI>MatchSpec = [MatchFunction]
         </LI><BR>
<LI>MatchFunction = {MatchHead, [Guard], [Result]}
         </LI><BR>
<LI>MatchHead = &#34;Pattern as in ets:match&#34;
         </LI><BR>
<LI>Guard = {&#34;Guardtest name&#34;, ...}
         </LI><BR>
<LI>Result = &#34;Term construct&#34;
         </LI><BR>
</UL>
<P>      This means that the match_spec is always a list of one or
         more tuples (of arity 3). The tuples first element should be
         a pattern as destcribed in the documentation of
         <CODE>ets:match/2</CODE>. The second element of the tuple should
         be a list of 0 or more guard tests (described below). The
         third element of the tuple should be a list containing a
         description of the value to actually return. In almost all
         normal cases the list contains exactly one term which fully
         describes the value to return for each object.
         <P>     The return value is constructed using the &#34;match variables&#34;
         bound in the MatchHead or using the special match variables
         <CODE>'$_'</CODE> (the whole matching object) and <CODE>'$$' (all match
         variables in a list), so that the following
         &#60;c&#62;ets:match/2</CODE> expression:
         <PRE>      ets:match(Tab,{'$1','$2','$3'})
          </PRE><P> is exactly equivalent to:
         <PRE>      ets:select(Tab,[{{'$1','$2','$3'},[],['$$']}])
          </PRE><P>      - and the following <CODE>ets:match_object/2</CODE> call:
         <PRE>      ets:match_object(Tab,{'$1','$2','$1'})
          </PRE><P>      is exactly equivalent to
         <PRE>      ets:select(Tab,[{{'$1','$2','$1'},[],['$_']}])
          </PRE><P>      Composite terms can be constructed in the <CODE>Result</CODE> part
         either by simply writing a list, so that this code:
         <PRE>      ets:select(Tab,[{{'$1','$2','$3'},[],['$$']}])
          </PRE><P>      gives the same output as:
         <PRE>      ets:select(Tab,[{{'$1','$2','$3'},[],[['$1','$2','$3']]}])
          </PRE><P>      i.e. all the bound variables in the match head as a list. If
         tuples are to be constructed, one has to write a tuple of
         arity 1 with the single element in the tuple beeing the tuple
         one wants to construct (as an ordinary tuple could be mistaken
         for a <CODE>Guard</CODE>). Therefore the following call:
         <PRE>      ets:select(Tab,[{{'$1','$2','$1'},[],['$_']}])
          </PRE><P>      gives the same output as:
         <PRE>      ets:select(Tab,[{{'$1','$2','$1'},[],[{{'$1','$2','$3'}}]}])
          </PRE><P>      - this syntax is equivalent to the syntax used in the trace
         patterns (see the <CODE>dbg</CODE> module in the
         <CODE>runtime_tools</CODE> application).
         <P>     The <CODE>Guard</CODE>'s are constructed as tuples where the first
         element is the name of the test (again, see the
         <CODE>match_spec</CODE> documentation in ERTS users guide) and the
         rest of the elements are the parameters of the test. To check
         for a specific type (say a list) of the element bound to the
         match variable <CODE>'$1'</CODE>, one would write the test as
         <CODE>{is_list, '$1'}</CODE>. If the test fails, the object in the
         table won't match and the next <CODE>MatchFunction</CODE> (if any)
         will be tried. Most guard tests present in erlang can be used,
         but only the new versions prefixed <CODE>is_</CODE> are allowed
         (like <CODE>is_float</CODE>, <CODE>is_atom</CODE> etc). An exact list of
         the allowed guard tests is present in the <CODE>match_spec</CODE>
         section of ERTS users guide. 
         <P>     The <CODE>Guard</CODE> section can also contain logic and arithmetic
         operations, which are written with the same syntax as the
         guard tests (prefix notation), so that a guard test written in
         erlang looking like this:
         <PRE>      is_integer(X), is_integer(Y), X + Y &#60; 4711
          </PRE><P>      is expressed like this (X replaced with '$1' and Y with
         '$2'):
         <PRE>      [{is_integer, '$1'}, {is_integer, '$2'}, {'&#60;', {'+', '$1',
            '$2'}, 4711}]
          </PRE><P>      A complete lost of the operators is present in the match_spec
         section of ERTS users guide.
         </UL>
<P><A NAME="select%3"><STRONG><CODE>select(Tab, MatchSpec, Limit) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
<STRONG><CODE>MatchSpec = term()</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Works like <CODE>ets:select/2</CODE> but only returns a limited
        (<CODE>Limit</CODE>) number of matching objects. The
        <CODE>Continuation</CODE> term can then be used in subsequent calls
        to <CODE>ets:select/1</CODE> to get the next chunk of matching
        objects. This is a space efficient way to work on objects in a
        table which is still faster than traversing the table object
        by object using <CODE>ets:first/1</CODE> and <CODE>ets:next/1</CODE>.<P><CODE>'$end_of_table'</CODE> is returned if the table is empty.</UL>
<P><A NAME="select%1"><STRONG><CODE>select(Continuation) -&#62; {[Match],Continuation} | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Match = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Continuation = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Continues a match started with
         <CODE>ets:select/3</CODE>. The next
         chunk of the size given in the initial <CODE>ets:select/3</CODE>
         call is returned together with a new <CODE>Continuation</CODE>
         that can be used in subsequent calls to this function.<P>'$end_of_table' is returned when there are no more
         objects in the table.</UL>
<P><A NAME="slot%2"><STRONG><CODE>slot(Tab, I) -&#62; [Object] | '$end_of_table'</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>I = int()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P><TABLE CELLPADDING=4><TR>
      <TD VALIGN=TOP><IMG ALT="Warning!" SRC="warning.gif"></TD>
      <TD>
<P>The function is deprecated and may be removed from future
         releases. Use <CODE>first/next</CODE> or <CODE>last/prev</CODE> instead.</TD></TR>
      </TABLE>
<P>Returns all objects in the <CODE>I</CODE>:th slot of the table
         <CODE>Tab</CODE>. A table can be traversed by repeatedly calling
         the function, starting with the first slot <CODE>I=0</CODE> and
         ending when <CODE>'$end_of_table'</CODE> is returned.
         The function will fail with reason <CODE>badarg</CODE> if the <CODE>I</CODE>
         argument is out of range.<P>Unless a table of type <CODE>set</CODE>, <CODE>bag</CODE> or
         <CODE>duplicate_bag</CODE> is protected using <CODE>safe_fixtable/2</CODE>,
         see above, a traversal may fail if concurrent updates are made
         to the table.
         If the table is of type <CODE>ordered_set</CODE>, the function returns
         a list containing the <CODE>I</CODE>:th object in Erlang term order.</UL>
<P><A NAME="tab2file%2"><STRONG><CODE>tab2file(Tab, Filename) -&#62; ok | {error,Reason}</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Filename = string() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Dumps the table <CODE>Tab</CODE> to the file <CODE>Filename</CODE>.
         The implementation of this function is not efficient.</UL>
<P><A NAME="tab2list%1"><STRONG><CODE>tab2list(Tab) -&#62; [Object]</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Object = tuple()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns a list of all objects in the table <CODE>Tab</CODE>.</UL>
<P><A NAME="test_ms%2"><STRONG><CODE>test_ms(Tuple, MatchSpec) -&#62; {ok, Result} | {error, Errors}</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tuple = tuple()</CODE></STRONG><BR>
<STRONG><CODE>MatchSpec = term()</CODE></STRONG><BR>
<STRONG><CODE>Result = term()</CODE></STRONG><BR>
<STRONG><CODE>Errors = [{warning|error, string()}]
</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>      This function is a utility to test the <CODE>match_spec</CODE>'s
         used in calls to <CODE>ets:select/2</CODE>. The function both
         tests the <CODE>MatchSpec</CODE> for &#34;syntactic&#34; correctness and
         runs the match_spec against the object <CODE>Tuple</CODE>. If the
         match_spec contains errors, the tuple <CODE>{error, Errors}</CODE>
         is returned where <CODE>Errors</CODE> is a list of natural
         language descriptions of what was wrong with the
         match_spec. If the match_spec is syntactically OK, the
         function returns <CODE>{ok,Term}</CODE> where <CODE>Term</CODE> is what
         would have been the result in a real <CODE>ets:select/2</CODE>
         call or <CODE>false</CODE> if the <CODE>match_spec</CODE> does not match
         the object <CODE>Tuple</CODE>.
         <P>     This is a useful debugging and test tool, especially when
         writing complicated <CODE>ets:select/2</CODE> calls.
         </UL>
<P><A NAME="to_dets%2"><STRONG><CODE>to_dets(Tab, DetsTab) -&#62; Tab</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>DetsTab = atom()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>     Fills an already created/opened DETS table with the objects in the
        already opened ETS table named <CODE>Tab</CODE>. The DETS table
        is emptied before the objects are inserted.
        </UL>
<P><A NAME="update_counter%4"><STRONG><CODE>update_counter(Tab, Key, {Pos,Incr}) -&#62; Result</CODE></STRONG></A><BR>
<A NAME="update_counter%3"><STRONG><CODE>update_counter(Tab, Key, Incr) -&#62; Result</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Tab = tid() | atom()</CODE></STRONG><BR>
<STRONG><CODE>Key = term()</CODE></STRONG><BR>
<STRONG><CODE>Pos = Incr = Result = int()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>This functions provides an efficient way to update a counter,
         without the hassle of having to look up an object, update the
         object by incrementing an element and insert the resulting object
         into the table again.<P>It will destructively update the object with key <CODE>Key</CODE> in
         the table <CODE>Tab</CODE> by adding <CODE>Incr</CODE> to the element at
         the <CODE>Pos</CODE>:th position. The new counter value is returned.
         If no position is specified, the element directly following
         the key (<CODE>&#60;keypos&#62;+1</CODE>) is updated.<P>The function will fail with reason <CODE>badarg</CODE> if:<P><UL>
<LI>the table is not of type <CODE>set</CODE> or <CODE>ordered_set</CODE>,
         </LI><BR>
<LI>no object with the right key exists,</LI><BR>
<LI>the object has the wrong arity, or,</LI><BR>
<LI>the element to update is not an integer.</LI><BR>
</UL>
</UL>
<H3>AUTHORS</H3>
<UL>
 Claes Wikstrom, Tony Rogvall, Patrik Nyblom - support@erlang.ericsson.se<BR>
</UL>
<CENTER>
<HR>
<FONT SIZE=-1>stdlib 1.10<BR>
Copyright &copy; 1991-2001
<A HREF="http://www.erlang.se">Ericsson Utvecklings AB</A><BR>
<!--#include virtual="/ssi/otp_footer.html"-->
</FONT>
</CENTER>
</BODY>
</HTML>