1113136Simp/****************************************************************
2113136Simp
3113136SimpThe author of this software is David M. Gay.
4113136Simp
5113185SimpCopyright (C) 1998 by Lucent Technologies
6240377SobrienAll Rights Reserved
7113136Simp
8240377SobrienPermission to use, copy, modify, and distribute this software and
9113136Simpits documentation for any purpose and without fee is hereby
10113136Simpgranted, provided that the above copyright notice appear in all
11113136Simpcopies and that both that the copyright notice and this
12240377Sobrienpermission notice and warranty disclaimer appear in supporting
13240377Sobriendocumentation, and that the name of Lucent or any of its entities
14240377Sobriennot be used in advertising or publicity pertaining to
15240377Sobriendistribution of the software without specific, written prior
16240377Sobrienpermission.
17240377Sobrien
18240377SobrienLUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19240377SobrienINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
20240377SobrienIN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
21240377SobrienSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22240377SobrienWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
23240377SobrienIN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24245311SbrooksARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25245311SbrooksTHIS SOFTWARE.
26245311Sbrooks
27245311Sbrooks****************************************************************/
28245311Sbrooks
29245311Sbrooks/* Please send bug reports to David M. Gay (dmg at acm dot org,
30245311Sbrooks * with " at " changed at "@" and " dot " changed to ".").	*/
31245311Sbrooks
32245311Sbrooks#include "gdtoaimp.h"
33245311Sbrooks
34245311Sbrooks int
35245311Sbrooks#ifdef KR_headers
36245311SbrooksstrtoIQ(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
37245311Sbrooks#else
38245311SbrooksstrtoIQ(CONST char *s, char **sp, void *a, void *b)
39245311Sbrooks#endif
40113136Simp{
41113136Simp	static FPI fpi = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI };
42113136Simp	Long exp[2];
43113136Simp	Bigint *B[2];
44143044Sru	int k, rv[2];
45143044Sru	ULong *L = (ULong *)a, *M = (ULong *)b;
46143044Sru
47143044Sru	B[0] = Balloc(2);
48113136Simp	B[0]->wds = 4;
49	k = strtoIg(s, sp, &fpi, exp, B, rv);
50	ULtoQ(L, B[0]->x, exp[0], rv[0]);
51	Bfree(B[0]);
52	if (B[1]) {
53		ULtoQ(M, B[1]->x, exp[1], rv[1]);
54		Bfree(B[1]);
55		}
56	else {
57		M[0] = L[0];
58		M[1] = L[1];
59		M[2] = L[2];
60		M[3] = L[3];
61		}
62	return k;
63	}
64