home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / cray / 329 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  2.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!copper!aspen.craycos.com!jrbd
  2. From: jrbd@craycos.com (James Davies)
  3. Newsgroups: comp.unix.cray
  4. Subject: Re: Storage of Fortran character strings on Cray
  5. Message-ID: <1992Dec17.164818.2198@craycos.com>
  6. Date: 17 Dec 92 16:48:18 GMT
  7. References: <MRL.92Dec16094950@sun4.uai.com>
  8. Organization: Cray Computer Corporation
  9. Lines: 38
  10.  
  11. In article <MRL.92Dec16094950@sun4.uai.com> mrl@uai.com (Mark R. Ludwig) writes:
  12. >I'd appreciate information or pointers to information about how
  13. >Fortran character strings are stored on Cray machines.  I have the
  14. >impression that sometimes they are word-aligned, but I don't know how
  15. >they then honor the X3.9-1978 standard which requires adjacency of
  16. >elements of a character array.  Perhaps only the first element of the
  17. >array is mandatorily aligned, and rest are also aligned only if the
  18. >length of each element is an integer multiple of 8?
  19.  
  20. They're packed 8 to a word, and aligned when possible.  The need to
  21. make common blocks, equivalenced variables, and arrays conform to the
  22. standard make it necessary to start things on non-word boundaries at times.
  23. For example, Fortran 77 allows passing an array declared
  24.     character*3 a(4)
  25. to a subroutine and declaring it in the subroutine as
  26.     character*4 a(3)
  27. and both arrays have to reference the same 12 characters.  Similar
  28. tricks can be played by equivalencing variables together or varying the
  29. declarations in common blocks between routines.
  30.  
  31. >Hopefully related enough to not need a separate post, can someone tell
  32. >me what the addressability is of data on Cray machines?  What does the
  33. >machine have to do to extract an arbitrary character from a string?
  34.  
  35. Character variables are passed by descriptor.  The descriptor contains
  36. the address of the first word, the starting offset in that word,
  37. and the length of the variable in bytes, all packed into a 64-bit word.
  38. The format of the descriptors varies by model, but the Cray-2 and 3 have 
  39. the starting bit offset in the upper 6 bits of the word, the length in the
  40. next 26 bits, and the word address in the lower 32 bits.  C character pointers
  41. have the same format, except that the length field isn't used.
  42.  
  43. To reference an arbitrary character, you basically have to work real hard :-).
  44. Shift and mask to extract the fields from the descriptor, load the word with
  45. the character you want, and shift and mask some more to extract the character.
  46.  
  47.                         Jim Davies
  48.                         jrbd@craycos.com
  49.