1 /* $Id: lio.c,v 1.1.1.1 2008/08/24 05:34:47 gmcgarry Exp $ */
3 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * Redistributions of source code and documentation must retain the above
10 * copyright notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditionsand the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed or owned by Caldera
18 * Neither the name of Caldera International, Inc. nor the names of other
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
22 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
41 static int l_write(ftnint
*number
, flex
*ptr
,ftnlen len
, ftnint type
);
42 static int t_putc(int);
43 void lwrt_I(ftnint n
);
44 void lwrt_L(ftnint n
);
45 void lwrt_A(char *p
, ftnlen len
);
46 void lwrt_F(double n
);
47 void lwrt_C(double a
,double b
);
54 if((n
=c_le(a
,WRITE
))) return(n
);
61 return(nowwriting(curunit
));
85 sprintf(buf
," %ld",(long)n
);
86 if(recpos
+strlen(buf
)>=LINE
)
90 for(p
=buf
;*p
;t_putc(*p
++));
96 if(recpos
+LLOGW
>=LINE
)
104 lwrt_A(char *p
, ftnlen len
)
113 for(i
=0;i
<len
;i
++) t_putc(*p
++);
122 if(LLOW
<=n
&& n
<LHIGH
)
130 wrt_F(&uf
,LFW
,LFD
,(ftnlen
)sizeof(uf
));
138 wrt_E(&uf
,LEW
,LED
,LEE
,(ftnlen
)sizeof(uf
));
143 lwrt_C(double a
,double b
)
145 if(recpos
+2*LFW
+3>=LINE
)
157 l_write(ftnint
*number
, flex
*ptr
,ftnlen len
, ftnint type
)
164 for(i
=0;i
< *number
; i
++)
168 default: fatal(204,"unknown type in lio");
169 case TYSHORT
: x
=ptr
->flshort
;
171 case TYLONG
: x
=ptr
->flint
;
174 case TYREAL
: y
=ptr
->flreal
;
176 case TYDREAL
: y
=ptr
->fldouble
;
179 case TYCOMPLEX
: xx
= &(ptr
->flreal
);
183 case TYDCOMPLEX
: yy
= &(ptr
->fldouble
);
186 xcomplex
: lwrt_C(y
,z
);
188 case TYLOGICAL
: lwrt_L(ptr
->flint
);
190 case TYCHAR
: lwrt_A((char *)ptr
,len
);
193 ptr
= (flex
*)((char *)ptr
+ len
); /* XXX ??? */