1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
From stsci Thu Jan 17 08:30:15 1985
Received: by lyra.noao.UUCP (4.12/4.7)
id AA10600; Thu, 17 Jan 85 08:30:03 mst
Date: Thu, 17 Jan 85 08:30:03 mst
From: stsci (Space Telescope )
Message-Id: <8501171530.AA10600@lyra.noao.UUCP>
To: tody
Status: R
Doug,
Here is a list of bugs, changes, suggestions, etc. compiled during
the port of IRAF to VMS.
Some of the bugs have the bug fixes listed here; others were too
elusive and/or time-consuming to try to figure out at this time. When you
get the latest, greatest VMS version of IRAF, what changes we made will
certainly be there; we'll probably send along RCS files as well so you could
easily update some of your files. However, most of the changes are
just a few lines here and there.
We await any comments or any bug fixes you have there...
Jay and Fred
P.S.
We were discussing using mapped sections such as sdas
uses for static files. There is one major difference in the way that
iraf and sdas handle static (image) files. In the sdas routine
a pointer is passed back to where the image resides in memory. This
is due to the way the mapped sections work in VMS. In Iraf the zroutine
is given a pointer to where the data is to reside, so we have to do
a memory copy for each image reference, and may not be more efficient
than just writing to or reading from disk. Can you see any easy
way around this problem, or maybe an additional flag to zopnsf which
indicates that a pointer is to be passed back from zardsf or zawrsf
for the data rather than a passing in a pointer to where the data is to
be read to or written from? (fred)
----------------------------------------------------------------------------
------------------------
NOTES file for IRAF (VMS)
------------------------
Contents:
1. Bugs
2. Portability Considerations
3. Source file name changes
-------------------------------------------------------------------------------
1. Bugs
/pkg/cl/bkg.c
In rbkgfile(), following fix:
... fgets (set, fp) ... TO
... fgets (set, SZ_LINE, fp) ...
/sys/libc/qsort.c -- qcmp() --> (*qcmp)()
/sys/libc/cfilbuf.c -- filbuf() --> (*filbuf)()
/sys/vops/advz.x -- '$t' missing for generic function
/sys/vops/advz*.x -- procedure advz[idx...]
(extra files ?)
/sys/vops/ak/aif*.x -- aiftrrr.x
/sys/vops/ak/aff*.x -- afftrxx.x, afftxrr.x, afftxxx.x
/sys/vops/ak/acjgx.x -- acjgxx.x
/sys/fio/fdebug.x -- "int and()" statement missing
/sys/fio/fputtx.x -- "int and()" statement missing
/sys/fio/fgetfd.x -- "int or()" statement missing
/pkg/cl/pfiles.c -- pfcopyback()
'pt' was going NULL before 'pf' in a for loop check;
was changed to check for 'pt' being NULL instead of 'pf'
/pkg/cl/builtin.c, binop.c, bkg.c, history.c, lexicon.c,
debug.c, errs.c, exec.c, pfiles.c
problem getting to next task by doing 'tp++'; due to VMS
alignment of structures. Fixed with a macro definition in
/pkg/cl/task.h for "next_task()", namely:
#define next_task(tp) \
((struct task *)((unsigned)tp + (TASKSIZ * BPI)))
#define prevtask next_task(currentask)
/pkg/help/lroff/output.x -- references constant MAX_INT
"include <mach.h>" statement missing
/pkg/lists/tokens.x -- last_nscan() --> last_nscan
SPP/RPP compiler bug --
define and jiand (e.g. in <iraf.h>)
if (x == FIVE && y == SIX) ... (SPP)
if (x == FIVE & y == SIX) ... (RPP)
if (x .eq. 5 .jiand. y .eq. 6) ... (FORTRAN)
only occurs when a macro is replaced before the '&&',
in this case FIVE.
/sys/fio/vfnmap.x
vfnunmap() -- when an OS extension was (un)mapped to a null
IRAF extension, the character count returned
was not right:
(e.g.) doc.dir --> doc but nchars = 7
This caused problems later on in the directory
task of the system package.
The fix:
... {
vfn[extn_offset-1] = EOS
op = extn_offset - 1 <-- was missing
} ...
/sys/fio/vfntrans.x
filename mapping for directories sometimes doesn't work;
sys$ --> drb4:[irafx.sys]sys instead of
drb4:[irafx.sys]
made a quick fix in zopdir() and zfchdr() to deal with this
for now; can't seem to locate the exact problem in vfntrans.x
/sys/fio/vfnmap.x
When deleting a file and the parameter subfiles=yes, and
no mapping file is currently in directory, a null mapping
file is (sometimes) created. Then doing a system.directory
fails when trying to read this null mapping file.
E.g. cl> delete aaabbb.ccc
subfiles=yes (default .par file)
delete() is called with 'aaabbb.ccc' and then
'aaabbb.ccc.zsf', which is degenerate;
therefore, if a mapping file doesn't
exist, it is created.
Haven't fixed this yet; not sure about the best way to go.
Some simple suggestions:
-- Could somehow figure out whether the file is being
added or deleted (i.e. was vfnmap() called from
vfnadd() or vfndel()?).
-- Or, whenever a mapping file is created, it has the
appropriate header info in it rather than being null?
-- Or, some special case of reading null mapping files?
/sys/etc/environ.x
env_hash()
return (sum**2 / CONSTANT)
causes integer overflow on VMS; changed to: (for now)
return ( int( float(sum) / CONSTANT * float(sum) ) )
arithmetic overflows:
/sys/etc/urand.x and others...
These seem to occur in a few places, sometimes purposely.
An easy VMS fix is to use "FORTRAN/NOCHECK file", but it's
a pain to have to remember which files need this special
treatment.
/sys/fio/
Seems to be a bug in the file i/o related to writing
asynchronously to binary files. In VMS, this is REALLY
asynchronous, and it caused problems when trying to write
the help database; making VMS do it synchronously (like
UNIX) fixed the problem, for now anyway.
It may be that a single buffer is being played with between
the write and the wait; at least that's what it looks like
in some of the binary files that were written -- there were
missing blocks and misaligned data, which were there when
displayed on the terminal.
I don't think it's a problem with RMS, since double buffering
was used to test the binary file driver, with success.
/pkg/system/directory.x
- call strcat ("$", Memc[template]) -->
call strcat ("$", Memc[template], SZ_FNAME)
- should sort and output the file name list ONLY
if (nfiles > 0)
otherwise, an "adjustable array error" occurs in qsort()
(i.e. an array with dimension of 0 is passed to qsort,
causing VMS to complain)
-------------------------------------------------------------------------------
2. Portability Considerations
(life would be easier if most source files and include files did
not need to be mapped ... especially C source files)
-- no underscores
-- only alphanumeric
-- case insensitive (i.e. lower case)
-- (9 chars).(3 chars)
(Notes: Some source file names and references to include files
had to be changed to create the filename mapping in the
first place, see list below.
This is not so crucial now, since XC and XPP have been
written/modified to handle filename mapping. But, it
still does cause problems when making bug fixes to source
files with degenerate names and trying to keep track of
them with RCS. Of course, 99% of the mapping problems will
disappear with VMS V4.0.)
also, directories should be case insensitive:
/sys/vops/AK --> ak
/sys/vops/LZ --> lz
sys/libc/cfilbuf.c -- filbuf --> vfilbuf (VMS)
since 'FILBUF' gets translated to
'filbuf' on VMS, not 'filbuf_',
which causes a conflict:
FILBUF and (*filbuf)()
SPP coding conventions that cause problems for VMS FORTRAN compiler:
a) multiple declarations, e.g.
int ip
...
int ip, this, that
files: /sys/fmtio/ctoi.x
/sys/fmtio/sscan.x
/sys/fmtio/chdeposit.x
/pkg/system/sort.x
b) 'real' function, e.g.
real (dval, 0) --> real (dval, 0.0)
/sys/fmtio/gctod.x
c) array declarations in procedures, e.g.
procedure proc1 (array, count)
type array (count)
int count # should be BEFORE array declaration
# (tries to use 'count' as a REAL)
/sys/fmtio/patmatch.x
/pkg/utilities/t_translit.x
makeset(), filset()
and(), or(), not() --> andi(), ori(), noti() ???
lots of references in /sys/fio/ to these procedures
(added them for VMS, using andi(),...)
xor() referenced in /sys/vops/...axorki.x
(added xor() for VMS, using xori())
FIO
file mode "APPEND" -- create the file if non-existent??
UNIX (and now VMS) do this automatically, but system
reference document isn't clear about this. Without this
feature, /pkg/system/bugmail.cl and revisions.cl don't work.
I/O drivers
ZMAIN passes the EPA of the read driver to IRAF_MAIN() ...
This is OK in UNIX (and VMS, for now), but may have cases
where I/O is to different devices and the drivers are NOT
compatible. (I don't know enough of the internals of
other operating systems to say for sure that this is a
problem, but it seems like it could be.)
Eg. STDIN from a file and STDOUT to terminal
If the file and terminal drivers are incompatible, then
things won't work. We may eventually have some problems
in this area with VMS, especially if we start to support
some network I/O access. Eventually, we may store the
actual read/write function in the channel structure and
check it whenever a read/write function is called; that is,
override the higher level IRAF I/O at the kernel level.
zardlp() function referenced in /sys/etc/lpopen.x ??
(added dummy function for VMS)
modf() function used in /pkg/cl/unop.c
was missing from /sys/libc/
(added modf.mar to /sys/os/ for VMS)
-------------------------------------------------------------------------------
3. Source file name changes
/pkg/softools/boot/spp/xpp/xpp_main.c --> xppmain.c
Necessary for file name mapping:
/sys/memio/ty_size.dat --> tysize.dat
/sys/memio/coerce.x, salloc.x, sizeof.x
include "ty_size.dat" --> include "tysize.dat"
-------------------------------------------------------------------------------
|