New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / compiler / arossupport / writedouble.c
blob7d5e5c68df9a9b68cb89d6609c6e451c9d66c6c3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Write a big endian 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 WriteDouble (
20 /* SYNOPSIS */
21 struct Hook * hook,
22 DOUBLE data,
23 void * stream)
25 /* FUNCTION
26 Writes one big endian 64bit double precision floating point value
27 to a streamhook.
29 INPUTS
30 hook - Write to this streamhook
31 data - Data to be written
32 stream - Stream passed to streamhook
34 RESULT
35 The function returns TRUE on success and FALSE otherwise.
36 See IoErr() for the reason in case of an error.
38 NOTES
39 This function writes big endian values to a file even on little
40 endian machines.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 ReadByte(), ReadWord(), ReadLong(), ReadFloat(), ReadDouble(),
48 ReadString(), ReadStruct(), WriteByte(), WriteWord(), WriteLong(),
49 WriteFloat(), WriteDouble(), WriteString(), WriteStruct()
51 HISTORY
53 ******************************************************************************/
55 UBYTE * ptr;
57 #if AROS_BIG_ENDIAN
58 ptr = (UBYTE *)&data;
59 # define NEXT ++
60 #else
61 ptr = ((UBYTE *)&data) + 7;
62 # define NEXT --
63 #endif
65 #define WRITE_ONE_BYTE \
66 if (CallHook (hook, stream, BEIO_WRITE, *ptr NEXT) == EOF) \
67 return FALSE
69 WRITE_ONE_BYTE;
70 WRITE_ONE_BYTE;
71 WRITE_ONE_BYTE;
72 WRITE_ONE_BYTE;
73 WRITE_ONE_BYTE;
74 WRITE_ONE_BYTE;
75 WRITE_ONE_BYTE;
76 WRITE_ONE_BYTE;
78 return TRUE;
79 } /* WriteDouble */