Xref: utzoo comp.os.vms:5938 comp.lang.pascal:864 Path: utzoo!mnetor!uunet!mcvax!ukc!mupsy!liv-cs!sqkeith From: sqkeith@csvax.liv.ac.uk Newsgroups: comp.os.vms,comp.lang.pascal Subject: Re: Quoted string parameters in VAX Pascal? Message-ID: <1411@csvax.liv.ac.uk> Date: 4 May 88 12:07:48 GMT References: <2812@bsu-cs.UUCP> Lines: 45 Organisation: Computer Science CSVAX (VAX1), Liverpool University In article <2812@bsu-cs.UUCP>, cfchiesa@bsu-cs.UUCP (Christopher Chiesa) writes: > In article , elkins@elbereth.rutgers.edu (George Elkins) writes: >> >> Is there a way in VAX Pascal to define a procedure that will take >> a variable length quoted string as a parameter? What I would like >> to do is imitate the variable length quoted string parameter behavior >> of the WRITE and WRITELN procedures, although this is not possible >> for user-written procedures in STANDARD Pascal. > TYPE > vstring: ^vrec; > > vrec: RECORD > body : PACKED ARRAY [1..maxstring] OF char; > length : INTEGER; > END; > > VARYING [...] OF char; > > This creates an "implicit record" type, containing the fields "body" and > "length" pretty much as I declared 'em above for (semi-) standard Pascal. > VAX Pascal extends the notion of conformant array schemas to that of conformant variant schemas. For example: procedure my_writeln ( s : varying [x] of char ); var i : integer; begin for i := 1 to x do operate_upon(s[i]); end; . . my_writeln('This is a test that will work with any length string'); . . Hope this helps.. Keith +-----------------------------------------------------------------------------+ | Keith Halewood, Janet: sqkeith@csvax.liv.ac.uk | | UUCP: ...!mcvax!ukc!mupsy!liv-cs!sqkeith | | Internet: sqkeith%csvax.liv.ac.uk@cunyvm.cuny.edu | +-----------------------------------------------------------------------------+