xref: /titanic_41/usr/src/lib/libast/common/features/iconv (revision b3697b90e692e3e5d859fb77d285d4c056d99eda)
1set	prototyped
2hdr	iconv
3lib	iconv_open,iconv_close,iconv iconv.h -liconv
4nxt	iconv
5
6tst	output{
7	#if !_lib_iconv_open
8	#define _undef_hdr_iconv	1
9	#undef	_hdr_iconv
10	#endif
11	#if !_hdr_iconv
12	#define _undef_lib_iconv_open	1
13	#undef	_lib_iconv_open
14	#endif
15	#if _hdr_iconv
16	#include <sys/types.h>
17	#include <iconv.h>
18	#endif
19
20	int
21	main()
22	{
23		char*	lib;
24
25		printf("#include <ast_common.h>\n");
26		printf("#include <ccode.h>\n");
27	#if _undef_hdr_iconv
28		printf("#undef	_hdr_iconv\n");
29	#endif
30	#if _undef_lib_iconv_open
31		printf("#undef	_lib_iconv_open\n");
32	#endif
33	#if _hdr_iconv && defined(_nxt_iconv_str)
34		printf("#include <%s>	/* the native iconv.h */\n", _nxt_iconv_str);
35	#endif
36		printf("\n");
37		printf("#define CC_ICONV	(-1)\n");
38		printf("#define CC_UCS		(-2)\n");
39		printf("#define CC_SCU		(-3)\n");
40		printf("#define CC_UTF		(-4)\n");
41		printf("#define CC_UME		(-5)\n");
42		printf("\n");
43	#if _lib_iconv_open
44		lib = "_ast_";
45		printf("#ifndef _ICONV_LIST_PRIVATE_\n");
46		printf("#undef	iconv_t\n");
47		printf("#define	iconv_t		%siconv_t\n", lib);
48		printf("#undef	iconv_f\n");
49		printf("#define	iconv_f		%siconv_f\n", lib);
50		printf("#undef	iconv_list_t\n");
51		printf("#define	iconv_list_t	%siconv_list_t\n", lib);
52		printf("#undef	iconv_open\n");
53		printf("#define iconv_open	%siconv_open\n", lib);
54		printf("#undef	iconv\n");
55		printf("#define	iconv		%siconv\n", lib);
56		printf("#undef	iconv_close\n");
57		printf("#define iconv_close	%siconv_close\n", lib);
58		printf("#undef	iconv_list\n");
59		printf("#define iconv_list	%siconv_list\n", lib);
60		printf("#undef	iconv_move\n");
61		printf("#define iconv_move	%siconv_move\n", lib);
62		printf("#undef	iconv_name\n");
63		printf("#define iconv_name	%siconv_name\n", lib);
64		printf("#undef	iconv_write\n");
65		printf("#define iconv_write	%siconv_write\n", lib);
66		printf("#endif\n");
67	#else
68		lib = "";
69	#endif
70		printf("\n");
71		printf("typedef Ccmap_t %siconv_list_t;\n", lib);
72		printf("typedef void* %siconv_t;\n", lib);
73		printf("typedef size_t (*%siconv_f)(%siconv_t, char**, size_t*, char**, size_t*);\n", lib, lib);
74		printf("\n");
75		printf("#if _BLD_ast && defined(__EXPORT__)\n");
76		printf("#define extern		__EXPORT__\n");
77		printf("#endif\n");
78		printf("\n");
79		printf("extern %siconv_t	%siconv_open(const char*, const char*);\n", lib, lib);
80		printf("extern size_t		%siconv(%siconv_t, char**, size_t*, char**, size_t*);\n", lib, lib);
81		printf("extern int		%siconv_close(%siconv_t);\n", lib, lib);
82		printf("extern %siconv_list_t*	%siconv_list(%siconv_list_t*);\n", lib, lib, lib);
83		printf("extern int		%siconv_name(const char*, char*, size_t);\n", lib);
84		printf("#if _SFIO_H\n");
85		printf("extern ssize_t		%siconv_move(%siconv_t, Sfio_t*, Sfio_t*, size_t, size_t*);\n", lib, lib);
86		printf("extern ssize_t		%siconv_write(%siconv_t, Sfio_t*, char**, size_t*, size_t*);\n", lib, lib);
87		printf("#else\n");
88		printf("#if _SFSTDIO_H\n");
89		printf("extern ssize_t		%siconv_move(%siconv_t, FILE*, FILE*, size_t, size_t*);\n", lib, lib);
90		printf("extern ssize_t		%siconv_write(%siconv_t, FILE*, char**, size_t*, size_t*);\n", lib, lib);
91		printf("#endif\n");
92		printf("#endif\n");
93		printf("\n");
94		printf("#undef	extern\n");
95		printf("\n");
96		return 0;
97	}
98}end
99