make fat.handler build again with debug enabled
[tangerine.git] / compiler / arossupport / readword.c
blobb48a05400b5bff84efc546d72afab7da6d01756a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Read a big endian word (16bit) from a streamhook
6 Lang: english
7 */
9 #include <proto/dos.h>
10 #include <stdio.h>
11 #include <assert.h>
13 /******************************************************************************
15 NAME */
16 #include <aros/bigendianio.h>
17 #include <proto/alib.h>
19 BOOL ReadWord (
21 /* SYNOPSIS */
22 struct Hook * hook,
23 UWORD * dataptr,
24 void * stream)
26 /* FUNCTION
27 Reads one big endian 16bit value 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
54 ******************************************************************************/
56 LONG value, c;
58 struct BEIOM_Read rd = {BEIO_READ};
60 assert (hook);
61 assert (stream);
62 assert (dataptr);
64 /* High byte */
65 c = CallHookA (hook, stream, &rd);
67 if (c == EOF)
68 return FALSE;
70 /* Low byte */
71 value = CallHookA (hook, stream, &rd);
73 if (value == EOF)
74 return FALSE;
76 *dataptr = (c << 8) + value;
78 return TRUE;
79 } /* ReadWord */