aros/libcall.h: Don't let AROS_CALL and AROS_LVO_CALL depend on __AROS_CPU_SPECIFIC_LC
[AROS.git] / compiler / arossupport / readdouble.c
blobec98ed67f26fadec6b568c27aaceeefab9085f09
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Read a big endian double floating point (64bit) from a streamhook
6 Lang: english
7 */
9 #include <proto/dos.h>
11 /******************************************************************************
13 NAME */
14 #include <stdio.h>
15 #include <aros/bigendianio.h>
16 #include <proto/alib.h>
18 BOOL ReadDouble (
20 /* SYNOPSIS */
21 struct Hook * hook,
22 DOUBLE * dataptr,
23 void * stream)
25 /* FUNCTION
26 Reads one big endian 64bit double precision floating point value
27 from a streamhook.
29 INPUTS
30 hook - Streamhook
31 dataptr - Put the data here
32 stream - Read from this stream
34 RESULT
35 The function returns TRUE on success. On success, the value
36 read is written into dataptr. On failure, FALSE is returned and the
37 contents of dataptr are not changed.
39 NOTES
40 This function reads big endian values from a streamhook even on
41 little endian machines.
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 ReadByte(), ReadWord(), ReadLong(), ReadFloat(), ReadDouble(),
49 ReadString(), ReadStruct(), WriteByte(), WriteWord(), WriteLong(),
50 WriteFloat(), WriteDouble(), WriteString(), WriteStruct()
52 HISTORY
53 14.09.93 ada created
55 ******************************************************************************/
57 DOUBLE value;
58 UBYTE * ptr;
59 LONG c;
60 struct BEIOM_Read rd = {BEIO_READ};
62 ptr = (UBYTE *)&value;
64 #if AROS_BIG_ENDIAN
65 # define NEXT ++
66 #else
67 ptr += 7;
68 # define NEXT --
69 #endif
71 #define READ_ONE_BYTE \
72 if ((c = CallHookA (hook, stream, &rd)) == EOF) \
73 return FALSE; \
75 *ptr NEXT = c
77 READ_ONE_BYTE;
78 READ_ONE_BYTE;
79 READ_ONE_BYTE;
80 READ_ONE_BYTE;
82 READ_ONE_BYTE;
83 READ_ONE_BYTE;
84 READ_ONE_BYTE;
85 READ_ONE_BYTE;
87 *dataptr = value;
89 return TRUE;
90 } /* ReadDouble */