1 /* Value distribution of plural form expressions.
2    Copyright (C) 2001-2008 Free Software Foundation, Inc.
3    Written by Bruno Haible <bruno@clisp.org>, 2001-2005.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _PLURAL_DISTRIB_H
19 #define _PLURAL_DISTRIB_H
20 
21 
22 /* Definition of 'struct expression'.  */
23 #include "plural-exp.h"
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 
31 /* The value distribution of a plural formula.  */
32 struct plural_distribution
33 {
34   /* The plural formula as a parsed expression.  */
35   const struct expression *expr;
36 
37   /* OFTEN is either NULL or an array of nplurals elements,
38      OFTEN[j] being true if the value j appears to be assumed infinitely often
39      by the plural formula.  */
40   const unsigned char *often;
41 
42   /* The length of the OFTEN array.  */
43   unsigned long often_length;
44 
45   /* A function which evaluates the plural formula for min <= n <= max
46      and returns the estimated number of times the value j was assumed.  */
47   unsigned int (*histogram) (const struct plural_distribution *self,
48                              int min, int max, unsigned long j);
49 };
50 
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 
57 #endif /* _PLURAL_DISTRIB_H */
58