Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site hao.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!hao!woods From: woods@hao.UUCP (Greg Woods) Newsgroups: net.wanted,net.lang.f77 Subject: Re: Namelist Interpreter Message-ID: <1805@hao.UUCP> Date: Thu, 17-Oct-85 18:53:54 EDT Article-I.D.: hao.1805 Posted: Thu Oct 17 18:53:54 1985 Date-Received: Sat, 19-Oct-85 07:24:36 EDT References: <269@ukc.UUCP> <256@uwstat.UUCP> <582@bonnie.UUCP> Organization: High Altitude Obs./NCAR, Boulder CO Lines: 80 Xref: watmath net.wanted:7406 net.lang.f77:391 > Help! Does anyone have routines that mimic in any way > the namelist feature of VMS and IBM Fortran? We have implemented a limited NAMELIST capability here. The man page follows. If anyone wants it, we can get it to you. I'm not sure how big it is; if there's interest I'll check. If small enough I could email it to interested parties, otherwise if you sent me a tape I would gladly send you the software. It is written in a mixture of FORTRAN and C, which means your system must be able to link routines from both languages together. Unfortunately, ours is implemented as a subroutine library, which means syntax changes in your FORTRAN program will be required in order to use it. (Any other method would require compiler hacking anyway, I suppose). --Greg -- {ucbvax!hplabs | allegra!nbires | decvax!noao | harpo!seismo | ihnp4!noao} !hao!woods CSNET: woods@NCAR ARPA: woods%ncar@CSNET-RELAY ----------------------------------------------------------------------------- .TH READNAME PLIB acd .SH NAME readname \- simulate namelist read .SH SYNOPSIS .B integer function readname(iu,namelist,n,names,sizes,types,a\d1\u,a\d2\u...a\dn\u) .br .B integer iu,n,sizes(n),types(n) .br .B character*8 namelist,names(n) .SH DESCRIPTION Lines will be read on fortran logical unit .I iu (opened previously) and interpreted as namelist assignments for the variable a\d1\u,a\d2\u,...a\dn\u. The variable .I namelist should be set to the namelist name. .I n is the total number of variables. For each variable a\di\u, the corresponding entries names(i),sizes(i) and types(i) give the variable name, its dimension (1 for a scalar), and its type. The type is an integer code: .sp .TS box,center; c l. code type = -n character*n _ 0 logical _ 1 character*8 _ 2 integer _ 3 real _ 4 double .TE .SH FILES /usr/local/lib/libplib.a .SH SEE ALSO getoken,setvari,setvarc,setvarr,setvard .SH DIAGNOSTICS Readname returns 0 on success. -1 indicates a general error and a positive number indicates a probable error with that variable number. Error diagnostics are written to stderr. If a segmentation fault or other opaque error condition presents itself, check that n corresponds to the number of variables provided and that the types for the variables correspond. .SH BUGS N is currently limited to a maximum of 50. Input can have any number of leading spaces, not just one. Arrays may be only singly subscripted (give total length for multiply subscripted arrays). Only the full variable may be named, not a single element (eg: a(3)) or a range (a(i,i=2,5) are illegal). Character*N variables are currently limited to a maxiumum of 32 characters.