Initial git import
[sxemacs] / src / seq.c
1 /*** seq.c -- generic sequence service
2  *
3  * Copyright (C) 2008 Sebastian Freundt
4  *
5  * Author:  Sebastian Freundt <hroptatyr@sxemacs.org>
6  *
7  * This file is part of SXEmacs.
8  * 
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * 3. Neither the name of the author nor the names of any contributors
21  *    may be used to endorse or promote products derived from this
22  *    software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  ***/
37
38 #include "config.h"
39 #include "lisp.h"
40 #include "seq.h"
41
42 Lisp_Object Qseqp;
43
44 /* an error throwing seq impl */
45 static size_t
46 seq_unsupp_length(const seq_t s)
47 {
48         Lisp_Object sequence = (Lisp_Object)(long int)s;
49         check_losing_bytecode("length", sequence);
50         sequence = wrong_type_argument(Qsequencep, sequence);
51         return 0UL;
52 }
53
54 static size_t
55 seq_empty_length(const seq_t s)
56 {
57         return 0UL;
58 }
59
60 static struct seq_impl_s __seq_unsupp = {
61         .length_f = seq_unsupp_length,
62 };
63
64 static struct seq_impl_s __seq_empty = {
65         .length_f = seq_empty_length,
66 };
67
68 seq_impl_t seq_unsupp = &__seq_unsupp;
69 seq_impl_t seq_empty = &__seq_empty;
70
71 \f
72 /* we are smart, we use the names desired by libtool, making a module out of
73    this one day is easier than peeing^Wbreathing */
74 void
75 seq_LTX_init(void)
76 {
77         DEFSYMBOL(Qseqp);
78         Fprovide(intern("seq"));
79 }
80
81 void
82 seq_LTX_reinit(void)
83 {
84 }
85
86 void
87 seq_LTX_deinit(void)
88 {
89         Frevoke(intern("seq"));
90 }
91
92 /* seq.c ends here */