home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4341 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.5 KB  |  50 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!jchauvin
  3. From: jchauvin@netcom.com (John H. Chauvin)
  4. Subject: Data initialization: FORTRAN program called as SUBROUTINE
  5. Message-ID: <1992Nov18.025912.13187@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Wed, 18 Nov 1992 02:59:12 GMT
  8. Lines: 40
  9.  
  10.  
  11. I am currently working on a mix language program in which a C program 
  12. calls a large FORTRAN program ( 15,000 lines , 100+ SUBROUTINES, 
  13. and extensive use of COMMON blocks). I have converted the main routine 
  14. from the FORTRAN into a SUBROUTINE and am calling the routine from 
  15. the C code. I pass file information from the C program to the FORTRAN 
  16. program using C data structures to FORTRAN common blocks. The 
  17. general program flow is: C calls FORTRAN , waits, FORTRAN updates C, 
  18. FORTRAN returns to C, C calls FORTRAN ,etc.. The C and FORTRAN 
  19. routines are linked into one large binary program. All FORTRAN variables 
  20. required SAVE status. The main advantage to the above approach is the 
  21. ease to which I can exchange data between the C (graphics front end) and 
  22. the FORTRAN (number crunchier).
  23.  
  24. Everything works great until I try and call the FORTRAN a second time. 
  25. The variables and COMMON blocks still retain values from the first call. 
  26. (Not surprisingly) How can I reinitialize all the COMMON blocks and 
  27. variables to the state that existed at the beginning of the first call?  
  28. Normally the FORTRAN would be executed as a stand alone program 
  29. from the command line , loaded into memory and the variables initialized 
  30. each time it is used. This is the behavior I want to achieve with each call to 
  31. the FORTRAN. Initializing all the variables myself is out of the questions 
  32. because of the size of the code and the fact that all the variables have 
  33. been SAVEd. Is there a way to do this?  Any help or suggestions would be 
  34. GREATLY appreciated.
  35.  
  36.  
  37. Thanks
  38.  
  39. jchauvin@netcom.com
  40.  
  41. -------------------------- Configuration Information -------------------------------------
  42. Workstation:           Silicon Graphics Crimson Elan with 64 mb RAM
  43. Operating System      IRIX 4.0.5A (AT&T UNIX with Berkeley extensions)
  44. Development Options.....v4.1
  45. FORTRAN & C Compilers    v3.10
  46. --------------------------------------------------------------------------------------------------
  47. -- 
  48. John H. Chauvin jchauvin@netcom.COM
  49. Netcom - Online Communication Services San Jose, CA
  50.