Add some prototype to silence silly warnings.
[sxemacs] / modules / ase / ase-metric.h
1 /*
2   ase-metric.h -- Metrical Spaces and Distances
3   Copyright (C) 2006, 2007, 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 /* Synched up with: Not in FSF. */
38
39 #ifndef INCLUDED_ase_metric_h_
40 #define INCLUDED_ase_metric_h_ 1
41
42 #include "ase.h"
43
44 typedef struct ase_metric_s *ase_metric_t;
45 typedef struct ase_pmetric_data_s *ase_pmetric_data_t;
46 typedef Lisp_Object(*ase_distance_f)(void*, Lisp_Object, Lisp_Object);
47
48 #define EMOD_ASE_DEBUG_METR(args...)    EMOD_ASE_DEBUG("[METR]: " args)
49
50 extern Lisp_Object Qase_metric, Qase_metricp;
51 extern Lisp_Object Qase_euclidean_metric, Qase_supremum_metric;
52
53 extern void LTX_PUBINIT(ase_metric)(void);
54 extern void LTX_PUBREINIT(ase_metric)(void);
55 extern void LTX_PUBDEINIT(ase_metric)(void);
56
57 \f
58 struct ase_metric_s {
59         ase_distance_f dist;
60         Lisp_Object ldist;
61         Lisp_Object colour;
62         /* helper data (e.g. for p-metrics) */
63         void *data;
64 };
65
66 struct ase_pmetric_data_s {
67         unsigned int p;
68 };
69
70 EXFUN(Fabs, 1);
71 EXFUN(Fsqrt, 2);
72 EXFUN(Fpow, 2);
73 #ifdef HAVE_MPFR
74 EXFUN(Froot, 3);
75 #endif
76
77 \f
78 #define ASE_METRICP(_i)                                                 \
79         (DYNACATP(_i) && EQ(XDYNACAT_TYPE(_i), Qase_metric))
80 #define CHECK_ASE_METRIC(x)                                             \
81         do {                                                            \
82                 if (!ASE_METRICP(x))                                    \
83                         dead_wrong_type_argument(Qase_metricp, x);      \
84         } while (0)
85 #define CONCHECK_ASE_METRIC(x)                                  \
86         do {                                                            \
87                 if (!ASE_METRICP(x))                                    \
88                         x = wrong_type_argument(Qase_metricp, x);       \
89         } while (0)
90 extern Lisp_Object _ase_wrap_metric(ase_metric_t);
91 #define XSETASE_METRIC(_res, _int)      (_res) = _ase_wrap_metric((_int))
92 #define XASE_METRIC(_x)                 ((ase_metric_t)get_dynacat(_x))
93
94 #define ase_metric_dist(_m)     ((_m)->dist)
95 #define XASE_METRIC_DIST(_m)    (ase_metric_dist(XASE_METRIC(_m)))
96 #define ase_metric_ldist(_m)    ((_m)->ldist)
97 #define XASE_METRIC_LDIST(_m)   (ase_metric_ldist(XASE_METRIC(_m)))
98 #define ase_metric_data(_m)     ((_m)->data)
99 #define XASE_METRIC_DATA(_m)    (ase_metric_data(XASE_METRIC(_m)))
100
101 /* stuff we provide */
102 extern Lisp_Object
103 ase_make_metric(ase_distance_f fn, void *data, Lisp_Object lambda);
104
105 #endif  /* INCLUDED_ase_metric_h_ */