5-6 FILE PORTING AND FTP
*************************
Files may be transferred between machines:
1) Over some network, e.g. using the FTP protocol (TCP/IP),
Kermit (usually serial line but necessarily).
2) Over some network, archived by a program that adds some
file-system specific info, e.g. ZIP (VMS), BACKUP (VMS).
This is important for files created on a record-oriented
file-system, where files have an internal structure,
and the operating system keeps the relevant info.
3) Using standard ANSI magnetic tape
Porting formatted files between different machines using FTP is usually
no problem, the FTP protocol automatically performs the few needed
conversions (ASCII/EBCDIC, record structure conventions).
Unformatted files, are very machine dependent, and the FTP protocol
doesn't support the required conversions, so porting them between
different machines may be very difficult.
Some relevant information the purpose of file porting:
Hardware Floats Endianity Unformatted Control
----------------- ------ --------- ------------ -------
Sun UNIX IEEE BIG Variable 4
IRIX IEEE BIG Variable 4
CRAY CRAY BIG
DEC VAX DEC LITTLE Segmented 2+2
DEC ALPHA IEEE+DEC LITTLE Variable 4
IBM PC compatibles IEEE LITTLE
IBM mainframes IBM BIG
DEC compilers provide good options for the conversion of unformatted
files between different platforms. Sun provides conversion software.
These machines can be used as "conversion platforms" for others,
however, the best methods are:
1) Modify the program that produced the unformatted file
to produce a formatted one, and run it on the original
machine or similar one.
2) Write a program that will read the unformatted file and
write an equivalent formatted one, ON A MACHINE LIKE THE
ONE THAT WROTE IT, thus avoiding the machine-specific
complications discussed below.
The translation program may use code excerpts from the
original program, or based on some knowledge of the
unformatted file's structure.
Some people use the XDR routine library to solve the problem of
porting unformatted files. They write and read files using the XDR
routines instead of Fortran I/O statements, but of course this is
not standard Fortran, and makes the programs less portable.
By the way, HDF files are self-documenting and should be read with
HDF routines.
A short digression on FTP
-------------------------
The File Transfer Protocol (FTP), is usually used interactively by
invoking a program with that name.
Many of the transfer options proposed by Postel and Reynolds in RFC959
were not implemented, and FTP programs can properly handle only text
file transfers. Binary transfers are properly handled only in the
simplest case, between two byte-oriented (e.g. UNIX) file-systems.
FORTRAN require record-oriented files, on byte-oriented systems the
FORTRAN compiler has to support this requirement, it produces and
reads files with variable-length records.
However, binary FTP transfers between a record-oriented system (e.g. VMS)
and a byte-oriented one are not supported, and all or some of the control
information of each record is discarded in one direction, and is passed
without proper translation in the other.
FTP shortcomings can be worked around by proper modification in the
FORTRAN source code. When writing files intended to be transferred
from a record-oriented system to a byte-oriented one, a count-field
value can be prefixed to each record. In the other direction a routine
that understands the foreign record format should be used for reading.
FTP of archived files
---------------------
Archiving programs like the VMS version of ZIP (used with "-V") and
the VMS BACKUP program store some control information of the file.
When the file is restored that information can be used.
This is useful when transferring files between two VMS machines,
via a UNIX one.
Porting formatted files
-----------------------
This is relatively simple, possible problems are:
1) Different character codes (EBCDIC on IBM mainframes,
ASCII on all others).
2) File type translations (Variable-size-records on VMS,
some Stream type on almost all others).
Direct FTP can take care of both these problems, character codes are
transformed into a standard character set (standard 8-bit Network
Virtual Terminal-ASCII) before transmission and are transformed again
to the local character set upon reception.
Similarly, records are translated to a standard form (stream CR/LF)
before transmission and transformed to the local structure upon reception.
It is recommended to use formatted files to transfer information
between different systems. The disadvantages are that the formatted
files are larger and some precision is lost on the radix translations.
Porting unformatted files
-------------------------
Here the problems start:
1) Different endianity (DEC machines and PCs are little
endian, all else are big endian).
2) Different integer sizes / float formats (integers have
the same general format, most floats are now IEEE).
3) Different character codes (EBCDIC on IBM mainframes,
ASCII on all others).
4) File type translations (Variable-size-records on VMS,
some Stream type on others).
5) All the above problems are solvable in principle,
but if you don't know the layout of variables in
the unformatted file, you would have to guess it
using too little information, with unsafe results.
The required knowledge can be found in the source
of the program that wrote it, or in notes left by
the programmer(s).
Problems #1-3 makes porting unformatted files content dependant,
i.e. you need to know the contents of a file in order to port it.
In the general case each variable has to be converted separately,
so the converting program has to know in detail the layout of
variables in the file.
Provided you know the internal structure of the file, porting
unformatted files is less frightening than the above list of
problems suggests. For example, UNIX workstations are compatible
except for the endianity problem.
Reading general binary files from Fortran
-----------------------------------------
Sometimes you want to read the content of a file "as it is", and
bypass the logical structure.
The record-oriented Fortran I/O routines must consider files either
as formatted or unformatted, and in both cases they treat one or more
bytes at the end of each record as control information, not as data.
You may need this ability when you want to process non-ASCII files,
e.g. files in one of the many graphics formats, or unformatted files
written on another machine.
There is no portable solution to this problem, some possible solutions
are:
1) Some compilers support a special OPEN keyword:
STREAM (VMS, Digital UNIX)
BINARY (MS Powerstation)
TRANSPARENT
2) Some UNIX compilers allow you to open a file
in DIRECT access mode, with RECL=1.
You can read then each byte by specifying
its location in the file.
Compilers suporting a DELETE statement for
direct files (VMS with the default /VMS option,
Digital UNIX with the -vms option), expect a
special flag located inside the record.
DEC uses the first byte of the record with
value equal to '@' (or NUL ASCII value 0).
To do the trick, the support for the DELETE
statement has to be disabled on VMS by the
/NOVMS compiler option, on digital UNIX the
compiler option -vms should not be used.
On VMS you should use RECL=2, as RMS assumes
all records are word aligned, file attributes
have to be modified by:
SET FILE/ATTRIBUTES=(RFM:FIX,LRL:2,MRS:2)
When OPENing the file use: RECORDTYPE='FIXED'.
3) VMS offers in addition many special techniques:
o Mapping the file to a memory area,
e.g. a common block, and reading it.
o Low-level routines: RMS block-mode.
o Getting the file size, declaring it to
contain fixed-size records, and reading
it with a buffering routine.
Porting from a typical UNIX to Digital UNIX
-------------------------------------------
This is an easy case, The DEC Fortran compiler supports options
that makes such porting easy (again, provided you know the internal
structure of the file).
Transfer the file to the DUNIX machine (I didn't use FTP as our
machines here share filesystems, but I think that FTP wouldn't
make a difference)
The following conversion program assumes:
1) All variables are REAL*4 (can be modified)
2) There is no record with more than MAXREC records
program convuf
integer MAXREC, BYTE2REAL
parameter (MAXREC = 100000, BYTE2REAL = 4)
real data(MAXREC)
integer count1, count2, i
C ------------------------------------------------------------------
open (unit = 10,
& file = 'unixfile',
& status = 'OLD',
& form = 'UNFORMATTED',
& convert = 'BIG_ENDIAN',
& recordtype = 'STREAM')
open (unit = 11,
& file = 'decfile',
& status = 'NEW',
& form = 'FORMATTED')
C ------------------------------------------------------------------
100 continue
read(unit=10, end=999) count1,
& (data(i), i = 1, count1/BYTE2REAL),
& count2
C write (*,*) '... ', count1, count2
if (count1 .eq. count2) then
write(unit=11,fmt=*) (data(i), i = 1, count1/BYTE2REAL)
else
write (*,*) ' something is wrong '
write (*,*) ' prefix count is: ', count1
write (*,*) ' suffix count is: ', count2
stop ' '
endif
goto 100
C ------------------------------------------------------------------
999 write (*,*) ' end of file reached '
close (10)
close (11)
end
The docs are not clear about the "RECORDTYPE" OPEN keyword,
DEC Fortran 90 docs are self-contradictory on this point.
It seems that the keyword once meant to support text files
with records delimited by CR/LF, but evolved to support
non-record-oriented files.
Endianity conversion
--------------------
Integer/Float format conversion
-------------------------------
Control information conversion
------------------------------
If you have the program source you can do it with a few modifications,
in the general case you'll need a conversion program.
1) Unformatted file from VMS to UNIX:
On VMS you can use unformatted variable records if your records
are no longer than 32764 bytes, specify RECORDTYPE='VARIABLE'
in the OPEN statement, as the default for unformatted I/O is
'SEGMENTED'.
FTP discards the the 2-byte count-field of the variable records,
you can re-prefix (and re-suffix) the record length to the data
in each WRITE statement:
INTEGER RECLEN
REAL X, Y, Z
......................
RECLEN = SIZEOF(X) + SIZEOF(Y) + SIZEOF(Z)
WRITE (10) RECLEN, X, Y, Z, RECLEN
If your unformatted records has to be longer, write each record
in parts, each one smaller than 32764 bytes, write the record
length in the beginning of the first part, and in the end of
the last part.
An unrecommended option is using the C Run-Time-Library function
'write', it converts VAX/ALPHA little-endian longwords (4 bytes)
to big-endian. 'write' doesn't add the prefix & suffix count-fields,
and creates a stream/LF file, an unsuitable type. Include the unixio.h
and file.h standard headers, they contain the function prototype and
associated argument constants.
2) Unformatted file from UNIX to VMS:
FTP will create by default 512 bytes long fixed-length records.
If the records are of the same known length, you may change the formal
record-length to that value, without changing anything in the file.
Use either: SET FILE/ATTRIBUTES=(LRL:size) filespec
or Joe Meadows FILE utility, then use OPEN with RECORDTYPE='FIXED'
and RECL=size, read and ignore the count field (first 4 bytes).
If the records are not the same length, you'll need a routine that
can reconstruct the original structure.
EBCDIC/ASCII conversion
-----------------------
File type conversion
--------------------
FTP options
-----------
FTP transfer options can be divided into 5 categories, most
of them are unimplemented:
File structure (e.g. stru file)
-------------------------------
file Byte-oriented file system
record Record-oriented file system
page ----
mount ----
vms [On VMS/MULTINET] Preserve all VMS characteristics
automatically negotiated.
Transfer type (e.g. type ascii)
-------------------------------
ascii For text files, default.
ebcdic For IBM mainframes
backup [On VMS/MULTINET] for VMS/BACKUP files
binary Same as IMAGE
image For unformatted data files and executables.
local-byte-size
logical-byte Same as LOCAL-BYTE-SIZE
tenex
Transfer mode (e.g. mode stream)
--------------------------------
stream Usual mode
compressed Supported by TGV/MULTINET only?
block
Form formats
------------
non-print
telnet format effectors
carriage control (ASA)
Auxiliary
---------
record-size [On VMS/MULTINET]
site rms recsize [On VMS/MULTINET]
block [On VMS/MULTINET]
case
A much more important factor in the social movement than those already mentioned was the ever-increasing influence of women. This probably stood at the lowest point to which it has ever fallen, during the classic age of Greek life and thought. In the history of Thucydides, so far as it forms a connected series of events, four times only during a period of nearly seventy years does a woman cross the scene. In each instance her apparition only lasts for a moment. In three of the four instances she is a queen or a princess, and belongs either to the half-barbarous kingdoms of northern Hellas or to wholly barbarous Thrace. In the one remaining instance208— that of the woman who helps some of the trapped Thebans to make their escape from Plataea—while her deed of mercy will live for ever, her name is for ever lost.319 But no sooner did philosophy abandon physics for ethics and religion than the importance of those subjects to women was perceived, first by Socrates, and after him by Xenophon and Plato. Women are said to have attended Plato’s lectures disguised as men. Women formed part of the circle which gathered round Epicurus in his suburban retreat. Others aspired not only to learn but to teach. Arêtê, the daughter of Aristippus, handed on the Cyrenaic doctrine to her son, the younger Aristippus. Hipparchia, the wife of Crates the Cynic, earned a place among the representatives of his school. But all these were exceptions; some of them belonged to the class of Hetaerae; and philosophy, although it might address itself to them, remained unaffected by their influence. The case was widely different in Rome, where women were far more highly honoured than in Greece;320 and even if the prominent part assigned to them in the legendary history of the city be a proof, among others, of its untrustworthiness, still that such stories should be thought worth inventing and preserving is an indirect proof of the extent to which feminine influence prevailed. With the loss of political liberty, their importance, as always happens at such a conjuncture, was considerably increased. Under a personal government there is far more scope for intrigue than where law is king; and as intriguers women are at least the209 equals of men. Moreover, they profited fully by the levelling tendencies of the age. One great service of the imperial jurisconsults was to remove some of the disabilities under which women formerly suffered. According to the old law, they were placed under male guardianship through their whole life, but this restraint was first reduced to a legal fiction by compelling the guardian to do what they wished, and at last it was entirely abolished. Their powers both of inheritance and bequest were extended; they frequently possessed immense wealth; and their wealth was sometimes expended for purposes of public munificence. Their social freedom seems to have been unlimited, and they formed combinations among themselves which probably served to increase their general influence.321 The old religions of Greece and Italy were essentially oracular. While inculcating the existence of supernatural beings, and prescribing the modes according to which such beings were to be worshipped, they paid most attention to the interpretation of the signs by which either future events in general, or the consequences of particular actions, were supposed to be divinely revealed. Of these intimations, some were given to the whole world, so that he who ran might read, others were reserved for certain favoured localities, and only communicated through the appointed ministers of the god. The Delphic oracle in particular enjoyed an enormous reputation both among Greeks and barbarians for guidance afforded under the latter conditions; and during a considerable period it may even be said to have directed the course of Hellenic civilisation. It was also under this form that supernatural religion suffered most injury from the great intellectual movement which followed the Persian wars. Men who had learned to study the constant sequences of Nature for themselves, and to shape their conduct according to fixed principles of prudence or of justice, either thought it irreverent to trouble the god about questions on which they were competent to form an opinion for themselves, or did not choose to place a well-considered scheme at the mercy of his possibly interested responses. That such a revolution occurred about the middle of the fifth century B.C., seems proved by the great change of tone in reference to this subject which one perceives on passing from Aeschylus to Sophocles. That anyone should question the veracity of an oracle is a supposition which never crosses the mind of the elder dramatist. A knowledge of augury counts among the greatest benefits222 conferred by Prometheus on mankind, and the Titan brings Zeus himself to terms by his acquaintance with the secrets of destiny. Sophocles, on the other hand, evidently has to deal with a sceptical generation, despising prophecies and needing to be warned of the fearful consequences brought about by neglecting their injunctions. The stranger had a pleasant, round face, with eyes that twinkled in spite of the creases around them that showed worry. No wonder he was worried, Sandy thought: having deserted the craft they had foiled in its attempt to get the gems, the man had returned from some short foray to discover his craft replaced by another. “Thanks,” Dick retorted, without smiling. When they reached him, in the dying glow of the flashlight Dick trained on a body lying in a heap, they identified the man who had been warned by his gypsy fortune teller to “look out for a hidden enemy.” He was lying at full length in the mould and leaves. "But that is sport," she answered carelessly. On the retirement of Townshend, Walpole reigned supreme and without a rival in the Cabinet. Henry Pelham was made Secretary at War; Compton Earl of Wilmington Privy Seal. He left foreign affairs chiefly to Stanhope, now Lord Harrington, and to the Duke of Newcastle, impressing on them by all means to avoid quarrels with foreign Powers, and maintain the blessings of peace. With all the faults of Walpole, this was the praise of his political system, which system, on the meeting of Parliament in the spring of 1731, was violently attacked by Wyndham and Pulteney, on the plea that we were making ruinous treaties, and sacrificing British interests, in order to benefit Hanover, the eternal millstone round the neck of England. Pulteney and Bolingbroke carried the same attack into the pages of The Craftsman, but they failed to move Walpole, or to shake his power. The English Government, instead of treating Wilkes with a dignified indifference, was weak enough to show how deeply it was touched by him, dismissed him from his commission of Colonel of the Buckinghamshire Militia, and treated Lord Temple as an abettor of his, by depriving him of the Lord-Lieutenancy of the same county, and striking his name from the list of Privy Councillors, giving the Lord-Lieutenancy to Dashwood, now Lord Le Despencer. "I tell you what I'll do," said the Deacon, after a little consideration. "I feel as if both Si and you kin stand a little more'n you had yesterday. I'll cook two to-day. We'll send a big cupful over to Capt. McGillicuddy. That'll leave us two for to-morrer. After that we'll have to trust to Providence." "Indeed you won't," said the Surgeon decisively. "You'll go straight home, and stay there until you are well. You won't be fit for duty for at least a month yet, if then. If you went out into camp now you would have a relapse, and be dead inside of a week. The country between here and Chattanooga is dotted with the graves of men who have been sent back to the front too soon." "Adone do wud that—though you sound more as if you wur in a black temper wud me than as if you pitied me." "Wot about this gal he's married?" "Don't come any further." "Davy, it 'ud be cruel of us to go and leave him." "Insolent priest!" interrupted De Boteler, "do you dare to justify what you have done? Now, by my faith, if you had with proper humility acknowledged your fault and sued for pardon—pardon you should have had. But now, you leave this castle instantly. I will teach you that De Boteler will yet be master of his own house, and his own vassals. And here I swear (and the baron of Sudley uttered an imprecation) that, for your meddling knavery, no priest or monk shall ever again abide here. If the varlets want to shrieve, they can go to the Abbey; and if they want to hear mass, a priest can come from Winchcombe. But never shall another of your meddling fraternity abide at Sudley while Roland de Boteler is its lord." "My lord," said Edith, in her defence, "this woman has sworn falsely. The medicine I gave was a sovereign remedy, if given as I ordered. Ten drops would have saved the child's life; but the contents of the phial destroyed it. The words I uttered were prayers for the life of the child. My children, and all who know me, can bear witness that I have a custom of asking His blessing upon all I take in hand. I raised my eyes towards heaven, and muttered words; but, my lord, they were words of prayer—and I looked up as I prayed, to the footstool of the Lord. But it is in vain to contend: the malice of the wicked will triumph, and Edith Holgrave, who even in thought never harmed one of God's creatures, must be sacrificed to cover the guilt, or hide the thoughtlessness of another." "Aye, Sir Treasurer, thou hast reason to sink thy head! Thy odious poll-tax has mingled vengeance—nay, blood—with the cry of the bond." HoME古一级毛片免费观看
ENTER NUMBET 0017 mege9.com.cn www.mela2.com.cn www.geze8.net.cn www.daowu1.net.cn riqun2.com.cn mante1.net.cn fagei0.net.cn aohuatex.com.cn www.yzzdsm.net.cn 182gm.com.cn