"Initial commit to Gerrit"
[profile/ivi/libtiff.git] / contrib / acorn / convert
1 RISC OS Conversion log
2 ======================
3
4 mkversion.c
5 ~~~~~~~~~~~
6 The RISC OS command-line does not allow the direct creation of the version.h
7 file in the proper manner. To remedy this in such a way that the version
8 header is made at compiletime, I wrote this small program. It is fully
9 portable, so should work quite happily for any other platform that might need
10 it.
11
12 msg3states.c
13 ~~~~~~~~~~~~
14 Needed getopt.c from the port folder, then compiled and worked fine.
15
16
17 tiff.h
18 ~~~~~~
19
20 ====1====
21
22 The symbol _MIPS_SZLONG, if not defined, causes a compiler error. Fixed by
23 ensuring it does exist. This looks to me like this wouldn't be an
24 Acorn-specific problem. The new code fragment is as follows:
25
26 #ifndef _MIPS_SZLONG
27 #define _MIPS_SZLONG 32
28 #endif
29 #if defined(__alpha) || _MIPS_SZLONG == 64
30
31
32
33 tiffcomp.h
34 ~~~~~~~~~~
35
36 ====1====
37
38 #if !defined(__MWERKS__) && !defined(THINK_C)
39 #include <sys/types.h>
40 #endif
41
42 Acorn also doesn't have this header so:
43
44 #if !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acorn)
45 #include <sys/types.h>
46 #endif
47
48 ====2====
49
50 #ifdef VMS
51 #include <file.h>
52 #include <unixio.h>
53 #else
54 #include <fcntl.h>
55 #endif
56
57 This seems to indicate that fcntl.h is included on all systems except
58 VMS. Odd, because I've never heard of it before. Sure it's in the ANSI
59 definition? Anyway, following change:
60
61 #ifdef VMS
62 #include <file.h>
63 #include <unixio.h>
64 #else
65 #ifndef __acorn
66 #include <fcntl.h>
67 #endif
68 #endif
69
70 This will probably change when I find out what it wants from fcntl.h!
71
72 ====3====
73
74 #if defined(__MWERKS__) || defined(THINK_C) || defined(applec)
75 #include <stdlib.h>
76 #define BSDTYPES
77 #endif
78
79 Added RISC OS to above thus:
80
81 #if defined(__MWERKS__) || defined(THINK_C) || defined(applec) || defined(__acorn)
82 #include <stdlib.h>
83 #define BSDTYPES
84 #endif
85
86 ====4====
87
88 /*
89  * The library uses the ANSI C/POSIX SEEK_*
90  * definitions that should be defined in unistd.h
91  * (except on VMS where they are in stdio.h and
92  * there is no unistd.h).
93  */
94 #ifndef SEEK_SET
95 #if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__)
96 #include <unistd.h>
97 #endif
98
99 RISC OS is like VMS and Mac in this regard. So changed to:
100
101 /*
102  * The library uses the ANSI C/POSIX SEEK_*
103  * definitions that should be defined in unistd.h
104  * (except on VMS or the Mac or RISC OS, where they are in stdio.h and
105  * there is no unistd.h).
106  */
107 #ifndef SEEK_SET
108 #if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__) && !defined(__acorn)
109 #include <unistd.h>
110 #endif
111 #endif
112
113 ====5====
114
115 NB: HAVE_IEEEFP is defined in tiffconf.h, not tiffcomp.h as mentioned
116 in libtiff.README. (Note written on original port from 3.4beta004)
117
118 Acorn C/C++ claims to accord with IEEE 754, so no change (yet) to
119 tiffconf.h.
120
121 ====6====
122
123 Unsure about whether this compiler supports inline functions. Will
124 leave it on for the time being and see if it works! (Likely if
125 everything else does.)
126
127 ... Seems to be OK ...
128
129 ====7====
130
131 Added to the end:
132
133 /*
134  * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
135  * on C alone. For that reason, the relevant functions have been
136  * implemented by myself in tif_acorn.c, and the elements from the header
137  * included here.
138  */
139
140 #ifdef __acorn
141 #ifdef __cplusplus
142 #include <osfcn.h>
143 #else
144 #include "kernel.h"
145 #define O_RDONLY        0
146 #define O_WRONLY        1
147 #define O_RDWR          2
148 #define O_APPEND        8
149 #define O_CREAT         0x200
150 #define O_TRUNC         0x400
151 typedef long off_t;
152 extern int open(const char *name, int flags, int mode);
153 extern int close(int fd);
154 extern int write(int fd, const char *buf, int nbytes);
155 extern int read(int fd, char *buf, int nbytes);
156 extern off_t lseek(int fd, off_t offset, int whence);
157 #endif
158 #endif
159
160
161 ===============================================================================
162
163 tif_acorn.c
164 ~~~~~~~~~~~
165
166 Created file tif_acorn.c, copied initially from tif_unix.c
167
168 Documented internally where necessary.
169
170 Note that I have implemented the low-level file-handling functions normally
171 found in osfcn.h in here, and put the header info at the bottom of
172 tiffcomp.h. This is further documented from a RISC OS perspective inside the
173 file.
174
175 ===============================================================================