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