xref: /titanic_51/usr/src/lib/libast/common/features/sfinit.c (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1da2e3ebdSchin /***********************************************************************
2da2e3ebdSchin *                                                                      *
3da2e3ebdSchin *               This software is part of the ast package               *
4*3e14f97fSRoger A. Faulkner *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5da2e3ebdSchin *                      and is licensed under the                       *
6da2e3ebdSchin *                  Common Public License, Version 1.0                  *
77c2fbfb3SApril Chin *                    by AT&T Intellectual Property                     *
8da2e3ebdSchin *                                                                      *
9da2e3ebdSchin *                A copy of the License is available at                 *
10da2e3ebdSchin *            http://www.opensource.org/licenses/cpl1.0.txt             *
11da2e3ebdSchin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12da2e3ebdSchin *                                                                      *
13da2e3ebdSchin *              Information and Software Systems Research               *
14da2e3ebdSchin *                            AT&T Research                             *
15da2e3ebdSchin *                           Florham Park NJ                            *
16da2e3ebdSchin *                                                                      *
17da2e3ebdSchin *                 Glenn Fowler <gsf@research.att.com>                  *
18da2e3ebdSchin *                  David Korn <dgk@research.att.com>                   *
19da2e3ebdSchin *                   Phong Vo <kpv@research.att.com>                    *
20da2e3ebdSchin *                                                                      *
21da2e3ebdSchin ***********************************************************************/
22da2e3ebdSchin /*
23da2e3ebdSchin  * generate sfio _Sftable static initializers
24da2e3ebdSchin  */
25da2e3ebdSchin 
26da2e3ebdSchin #include "FEATURE/common"
27da2e3ebdSchin #include "FEATURE/float"
28da2e3ebdSchin 
29da2e3ebdSchin int
main()30da2e3ebdSchin main()
31da2e3ebdSchin {
32da2e3ebdSchin 	register int	i;
33da2e3ebdSchin #if _ast_fltmax_double
34da2e3ebdSchin 	char*		fs = "";
35da2e3ebdSchin 	char*		ds = "";
36da2e3ebdSchin 	char*		ls = "";
37da2e3ebdSchin #else
38da2e3ebdSchin 	char*		fs = "F";
39da2e3ebdSchin 	char*		ds = "";
40da2e3ebdSchin 	char*		ls = "L";
41da2e3ebdSchin #endif
42da2e3ebdSchin 
43da2e3ebdSchin 	printf("\nstatic const float sf_flt_pow10[] =\n{\n");
44da2e3ebdSchin 	for (i = 0; i <= FLT_MAX_10_EXP; i++)
45da2e3ebdSchin 		printf("\t1E%d%s,\n", i, fs);
46da2e3ebdSchin 	printf("};\n");
47da2e3ebdSchin 	printf("\nstatic const double sf_dbl_pow10[] =\n{\n");
48da2e3ebdSchin 	for (i = 0; i <= DBL_MAX_10_EXP; i++)
49da2e3ebdSchin 		printf("\t1E%d%s,\n", i, ds);
50da2e3ebdSchin 	printf("};\n");
51da2e3ebdSchin #if !_ast_fltmax_double
52da2e3ebdSchin 	printf("\nstatic const _ast_fltmax_t sf_ldbl_pow10[] =\n{\n");
53da2e3ebdSchin 	for (i = 0; i <= LDBL_MAX_10_EXP; i++)
54da2e3ebdSchin 		printf("\t1E%d%s,\n", i, ls);
55da2e3ebdSchin 	printf("};\n");
56da2e3ebdSchin #endif
57da2e3ebdSchin 	printf("\nSftab_t _Sftable =\n{\n");
58da2e3ebdSchin 	printf("\t{ 1E1%s, 1E2%s, 1E4%s, 1E8%s, 1E16%s, 1E32%s },\n", ls, ls, ls, ls, ls, ls);
59da2e3ebdSchin 	printf("\t{ 1E-1%s, 1E-2%s, 1E-4%s, 1E-8%s, 1E-16%s, 1E-32%s },\n", ls, ls, ls, ls, ls, ls);
60da2e3ebdSchin 	printf("\t{ '0','0', '0','1', '0','2', '0','3', '0','4',\n");
61da2e3ebdSchin 	printf("\t  '0','5', '0','6', '0','7', '0','8', '0','9',\n");
62da2e3ebdSchin 	printf("\t  '1','0', '1','1', '1','2', '1','3', '1','4',\n");
63da2e3ebdSchin 	printf("\t  '1','5', '1','6', '1','7', '1','8', '1','9',\n");
64da2e3ebdSchin 	printf("\t  '2','0', '2','1', '2','2', '2','3', '2','4',\n");
65da2e3ebdSchin 	printf("\t  '2','5', '2','6', '2','7', '2','8', '2','9',\n");
66da2e3ebdSchin 	printf("\t  '3','0', '3','1', '3','2', '3','3', '3','4',\n");
67da2e3ebdSchin 	printf("\t  '3','5', '3','6', '3','7', '3','8', '3','9',\n");
68da2e3ebdSchin 	printf("\t  '4','0', '4','1', '4','2', '4','3', '4','4',\n");
69da2e3ebdSchin 	printf("\t  '4','5', '4','6', '4','7', '4','8', '4','9',\n");
70da2e3ebdSchin 	printf("\t  '5','0', '5','1', '5','2', '5','3', '5','4',\n");
71da2e3ebdSchin 	printf("\t  '5','5', '5','6', '5','7', '5','8', '5','9',\n");
72da2e3ebdSchin 	printf("\t  '6','0', '6','1', '6','2', '6','3', '6','4',\n");
73da2e3ebdSchin 	printf("\t  '6','5', '6','6', '6','7', '6','8', '6','9',\n");
74da2e3ebdSchin 	printf("\t  '7','0', '7','1', '7','2', '7','3', '7','4',\n");
75da2e3ebdSchin 	printf("\t  '7','5', '7','6', '7','7', '7','8', '7','9',\n");
76da2e3ebdSchin 	printf("\t  '8','0', '8','1', '8','2', '8','3', '8','4',\n");
77da2e3ebdSchin 	printf("\t  '8','5', '8','6', '8','7', '8','8', '8','9',\n");
78da2e3ebdSchin 	printf("\t  '9','0', '9','1', '9','2', '9','3', '9','4',\n");
79da2e3ebdSchin 	printf("\t  '9','5', '9','6', '9','7', '9','8', '9','9',\n");
80da2e3ebdSchin 	printf("\t},\n");
81da2e3ebdSchin 	printf("\t\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@_\",\n");
82da2e3ebdSchin 	printf("\tsfcvinit, 0,\n");
83da2e3ebdSchin 	printf("\tsffmtpos,\n");
84da2e3ebdSchin 	printf("\tsffmtint,\n");
85da2e3ebdSchin 	printf("\t(float*)&sf_flt_pow10[0],\n");
86da2e3ebdSchin 	printf("\t(double*)&sf_dbl_pow10[0],\n");
87da2e3ebdSchin #if _ast_fltmax_double
88da2e3ebdSchin 	printf("\t0,\n");
89da2e3ebdSchin #else
90da2e3ebdSchin 	printf("\t(_ast_fltmax_t*)&sf_ldbl_pow10[0],\n");
91da2e3ebdSchin #endif
92da2e3ebdSchin 	printf("};\n");
93da2e3ebdSchin 	return 0;
94da2e3ebdSchin }
95