~ubuntu-branches/ubuntu/breezy/gettext/breezy

« back to all changes in this revision

Viewing changes to lib/linebreak.h

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-03-14 17:40:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314174002-p1ad5ldve1hqzhye
Tags: 0.14.1-2
* Added libexpat1-dev to Build-Depends, for glade support.
* Added libc0.1-dev to Build-Depends, for GNU/kFreeBSD.
* Removed special-casing of knetbsd-gnu in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* linebreak.h - line breaking of Unicode strings
2
 
   Copyright (C) 2001 Free Software Foundation, Inc.
3
 
   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
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 2, or (at your option)
8
 
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, write to the Free Software
17
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
 
 
19
 
#ifndef _LINEBREAK_H
20
 
#define _LINEBREAK_H
21
 
 
22
 
#ifndef PARAMS
23
 
# if defined (__GNUC__) || __STDC__
24
 
#  define PARAMS(args) args
25
 
# else
26
 
#  define PARAMS(args) ()
27
 
# endif
28
 
#endif
29
 
 
30
 
#include <stdlib.h>
31
 
 
32
 
 
33
 
/* Display width.  */
34
 
 
35
 
/* These functions are locale dependent.  The encoding argument identifies
36
 
   the encoding (e.g. "ISO-8859-2" for Polish).  */
37
 
 
38
 
/* Return the encoding of the current locale.  */
39
 
extern const char * locale_charset PARAMS ((void));
40
 
 
41
 
/* Determine number of column positions required for UC. */
42
 
extern int uc_width PARAMS ((unsigned int uc, const char *encoding));
43
 
 
44
 
/* Determine number of column positions required for first N units
45
 
   (or fewer if S ends before this) in S.  */
46
 
extern int u8_width PARAMS ((const unsigned char *s, size_t n, const char *encoding));
47
 
extern int u16_width PARAMS ((const unsigned short *s, size_t n, const char *encoding));
48
 
extern int u32_width PARAMS ((const unsigned int *s, size_t n, const char *encoding));
49
 
 
50
 
 
51
 
/* Line breaking.  */
52
 
 
53
 
enum {
54
 
  UC_BREAK_UNDEFINED,
55
 
  UC_BREAK_PROHIBITED,
56
 
  UC_BREAK_POSSIBLE,
57
 
  UC_BREAK_MANDATORY,
58
 
  UC_BREAK_HYPHENATION
59
 
};
60
 
 
61
 
/* Determine the line break points in S, and store the result at p[0..n-1].
62
 
   p[i] = UC_BREAK_MANDATORY means that s[i] is a line break character.
63
 
   p[i] = UC_BREAK_POSSIBLE means that a line break may be inserted between
64
 
          s[i-1] and s[i].
65
 
   p[i] = UC_BREAK_HYPHENATION means that a hyphen and a line break may be
66
 
          inserted between s[i-1] and s[i].  But beware of language dependent
67
 
          hyphenation rules.
68
 
   p[i] = UC_BREAK_PROHIBITED means that s[i-1] and s[i] must not be separated.
69
 
 */
70
 
extern void u8_possible_linebreaks PARAMS ((const unsigned char *s, size_t n, const char *encoding, char *p));
71
 
extern void u16_possible_linebreaks PARAMS ((const unsigned short *s, size_t n, const char *encoding, char *p));
72
 
extern void u32_possible_linebreaks PARAMS ((const unsigned int *s, size_t n, const char *encoding, char *p));
73
 
extern void mbs_possible_linebreaks PARAMS ((const char *s, size_t n, const char *encoding, char *p));
74
 
 
75
 
/* Choose the best line breaks, assuming the uc_width function.
76
 
   Return the column after the end of the string.
77
 
   o is an optional override; if o[i] != UC_BREAK_UNDEFINED, o[i] takes
78
 
   precedence over p[i] as returned by the *_possible_linebreaks function.
79
 
 */
80
 
extern int u8_width_linebreaks PARAMS ((const unsigned char *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, char *p));
81
 
extern int u16_width_linebreaks PARAMS ((const unsigned short *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, char *p));
82
 
extern int u32_width_linebreaks PARAMS ((const unsigned int *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, char *p));
83
 
extern int mbs_width_linebreaks PARAMS ((const char *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, char *p));
84
 
 
85
 
 
86
 
#endif /* _LINEBREAK_H */