xref: /titanic_50/usr/src/cmd/sort/common/fields.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <alloca.h>
37 #include <ctype.h>
38 #include <limits.h>
39 #include <locale.h>
40 #include <stdio.h>
41 #include <string.h>
42 #include <time.h>
43 #include <wchar.h>
44 #include <widec.h>
45 
46 #include "statistics.h"
47 #include "types.h"
48 #include "utility.h"
49 
50 #define	FCV_REALLOC	0x1
51 #define	FCV_FAIL	0x2
52 
53 #define	INITIAL_COLLATION_SIZE	1024
54 
55 #define	COLL_NONUNIQUE	0x0
56 #define	COLL_UNIQUE	0x1
57 #define	COLL_DATA_ONLY	0x2
58 #define	COLL_REVERSE	0x4
59 
60 extern void field_initialize(sort_t *);
61 
62 extern field_t *field_new(sort_t *);
63 extern void field_delete(field_t *);
64 extern void field_add_to_chain(field_t **, field_t *);
65 extern void field_print(field_t *);
66 
67 extern ssize_t field_convert_alpha(field_t *, line_rec_t *, vchar_t,
68     ssize_t, ssize_t, ssize_t);
69 extern ssize_t field_convert_alpha_simple(field_t *, line_rec_t *, vchar_t,
70     ssize_t, ssize_t, ssize_t);
71 extern ssize_t field_convert_month(field_t *, line_rec_t *, vchar_t,
72     ssize_t, ssize_t, ssize_t);
73 extern ssize_t field_convert_numeric(field_t *, line_rec_t *, vchar_t,
74     ssize_t, ssize_t, ssize_t);
75 
76 extern int collated(line_rec_t *, line_rec_t *, ssize_t, flag_t);
77 extern ssize_t field_convert(field_t *, line_rec_t *, flag_t, vchar_t);
78 
79 extern ssize_t field_convert_alpha_wide(field_t *, line_rec_t *, vchar_t,
80     ssize_t, ssize_t, ssize_t);
81 extern ssize_t field_convert_month_wide(field_t *, line_rec_t *, vchar_t,
82     ssize_t, ssize_t, ssize_t);
83 extern ssize_t field_convert_numeric_wide(field_t *, line_rec_t *, vchar_t,
84     ssize_t, ssize_t, ssize_t);
85 
86 extern int collated_wide(line_rec_t *, line_rec_t *, ssize_t, flag_t);
87 extern ssize_t field_convert_wide(field_t *, line_rec_t *, flag_t, vchar_t);
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif	/* _SORT_FIELDS_H */
94