home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4731 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.7 KB  |  65 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!rdg.dec.com!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
  3. From: lionel@quark.enet.dec.com (Steve Lionel)
  4. Subject: Re: SUMMARY: CHARACTER FUNCTION as dummy argument
  5. Message-ID: <1992Dec15.151332.5658@e2big.mko.dec.com>
  6. Lines: 52
  7. Sender: usenet@e2big.mko.dec.com (Mr. USENET)
  8. Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
  9. Organization: Digital Equipment Corporation, Nashua NH
  10. References:  <BURLEY.92Dec15044825@apple-gunkies.gnu.ai.mit.edu>
  11. Date: Tue, 15 Dec 1992 15:13:32 GMT
  12.  
  13.  
  14. In article <BURLEY.92Dec15044825@apple-gunkies.gnu.ai.mit.edu>, 
  15. burley@apple-gunkies.gnu.ai.mit.edu (Craig Burley) writes:
  16.  
  17. |>If anyone has a system that supports the code in Sample 1 (like VAX/VMS
  18. |>FORTRAN), it'd be interesting to see how well it handled the following:
  19. |>
  20. |>C Sample 6
  21. |>    CHARACTER*(*) CFUNC
  22. |>    EXTERNAL CFUNC
  23. |>    CALL X (CFUNC)
  24. |>    PRINT *, 'Done!'
  25. |>    END
  26. |>C
  27. |>    SUBROUTINE X (CFUNC)
  28. |>    CHARACTER*(*) CFUNC
  29. |>    EXTERNAL CFUNC
  30. |>    PRINT *, 'Try this:'
  31. |>    PRINT *, CFUNC()
  32. |>    PRINT *, 'Now try this:'
  33. |>    CALL Y (CFUNC(), CFUNC())
  34. |>    END
  35. |>C
  36. |>    SUBROUTINE Y (ARG1, ARG2)
  37. |>    CHARACTER*(*) ARG1, ARG2
  38. |>    PRINT *, ARG1(1:10), LEN (ARG1)
  39. |>    PRINT *, ARG2(1:10), LEN (ARG2)
  40. |>    END
  41. |>C
  42. |>    CHARACTER*(*) FUNCTION CFUNC ()
  43. |>    INTEGER I,J
  44. |>    CHARACTER C
  45. |>    SAVE I,C
  46. |>    DATA I/50/, C/'A'/
  47. |>    DO 10 J = 1, I
  48. |>       CFUNC(J:J) = C
  49. |>10    CONTINUE
  50. |>    I = 2 * I
  51. |>    C = CHAR (ICHAR (C) + 1)
  52. |>    END
  53. |>
  54. |>
  55.  
  56. VAX FORTRAN disallows the CHARACTER*(*) declaration for something that is
  57. not a formal argument; this seems to me the only correct choice.
  58. --
  59.  
  60. Steve Lionel                    lionel@quark.enet.dec.com
  61. SDT Languages Group
  62. Digital Equipment Corporation
  63. 110 Spit Brook Road
  64. Nashua, NH 03062
  65.