xref: /illumos-gate/usr/src/cmd/sort/fields.h (revision 101e15b5)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SORT_FIELDS_H
28 #define	_SORT_FIELDS_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <alloca.h>
35 #include <ctype.h>
36 #include <limits.h>
37 #include <locale.h>
38 #include <stdio.h>
39 #include <string.h>
40 #include <time.h>
41 #include <wchar.h>
42 #include <widec.h>
43 
44 #include "statistics.h"
45 #include "types.h"
46 #include "utility.h"
47 
48 #define	FCV_REALLOC	0x1
49 #define	FCV_FAIL	0x2
50 
51 #define	INITIAL_COLLATION_SIZE	1024
52 
53 #define	COLL_NONUNIQUE	0x0
54 #define	COLL_UNIQUE	0x1
55 #define	COLL_DATA_ONLY	0x2
56 #define	COLL_REVERSE	0x4
57 
58 extern void field_initialize(sort_t *);
59 
60 extern field_t *field_new(sort_t *);
61 extern void field_delete(field_t *);
62 extern void field_add_to_chain(field_t **, field_t *);
63 extern void field_print(field_t *);
64 
65 extern ssize_t field_convert_alpha(field_t *, line_rec_t *, vchar_t,
66     ssize_t, ssize_t, ssize_t);
67 extern ssize_t field_convert_alpha_simple(field_t *, line_rec_t *, vchar_t,
68     ssize_t, ssize_t, ssize_t);
69 extern ssize_t field_convert_month(field_t *, line_rec_t *, vchar_t,
70     ssize_t, ssize_t, ssize_t);
71 extern ssize_t field_convert_numeric(field_t *, line_rec_t *, vchar_t,
72     ssize_t, ssize_t, ssize_t);
73 
74 extern int collated(line_rec_t *, line_rec_t *, ssize_t, flag_t);
75 extern ssize_t field_convert(field_t *, line_rec_t *, flag_t, vchar_t);
76 
77 extern ssize_t field_convert_alpha_wide(field_t *, line_rec_t *, vchar_t,
78     ssize_t, ssize_t, ssize_t);
79 extern ssize_t field_convert_month_wide(field_t *, line_rec_t *, vchar_t,
80     ssize_t, ssize_t, ssize_t);
81 extern ssize_t field_convert_numeric_wide(field_t *, line_rec_t *, vchar_t,
82     ssize_t, ssize_t, ssize_t);
83 
84 extern int collated_wide(line_rec_t *, line_rec_t *, ssize_t, flag_t);
85 extern ssize_t field_convert_wide(field_t *, line_rec_t *, flag_t, vchar_t);
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _SORT_FIELDS_H */
92