Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!orstcs!jacobs.CS.ORST.EDU!louxj From: louxj@jacobs.CS.ORST.EDU (John W. Loux) Newsgroups: comp.lang.pascal Subject: Re: Constant declarations of type RECORD in UNIX pascal Message-ID: <11850@orstcs.CS.ORST.EDU> Date: 27 Jul 89 16:13:03 GMT References: <11843@orstcs.CS.ORST.EDU> Sender: usenet@orstcs.CS.ORST.EDU Reply-To: louxj@jacobs.CS.ORST.EDU.UUCP (John W. Loux) Distribution: usa Organization: Solve and Integrate, Corp. - Corvallis Oregon Lines: 75 In article <11843@orstcs.CS.ORST.EDU> duvalj@prism.CS.ORST.EDU (Joseph Edward Duval) writes: > >I am trying to declare a constant in my UNIX (HP) pascal program that is >is of TYPE record. In the manual it says it can be done but says nothing >about how. Does anyone out there know how to do this? > >What I have now is: > > type > sequence = record > first : byte; > next : byte; > pcount : byte; > param : packed array [1..8] of byte; > private : byte; > inter : byte; > nxtlast : byte; > last : byte; > end; > > . > . > . > const > NUL = 0; > NULSEQ = sequence (NUL, NUL, NUL, > (NUL, NUL, NUL, NUL, NUL, NUL, NUL, NUL), > (NUL, NUL, NUL, NUL); > >This doesn't work. > >Thanks for the help! > - Joe Duval {duvalj@prism.CS.ORST.EDU} The following compiles (and is fairly well documented in the HP-UX 6.5 Pascal Language Reference under records and arrays): program poop (input, output); type byte = 0..255; paramtype = packed array[1..8] of byte; sequence = record first : byte; next : byte; pcount : byte; param : paramtype; private : byte; inter : byte; nxtlast : byte; last : byte; end; const nul = 0; nulseq = sequence[ first : nul, next : nul, pcount : nul, param : paramtype[nul, nul, nul, nul, nul, nul, nul, nul], private : nul, inter : nul, nxtlast : nul, last : nul]; begin end. Note that you must declare the record fields, and that to initialize the param array, you must have a paramtype to build the constructor. John W. Loux louxj@jacobs.cs.orst.edu