Newsgroups: comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!uunet!cs.utexas.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!news.ecn.bgu.edu!wupost!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@swell.actrix.gen.nz (David Empson) Subject: Re: ORCA/Pascal: DINFO and VOLUME calls Organization: Actrix Information Exchange Date: Tue, 10 Aug 1993 15:16:30 GMT Message-ID: <1993Aug10.151630.16399@actrix.gen.nz> References: <2488ue$jsc@nz12.rz.uni-karlsruhe.de> Sender: dempson@actrix.gen.nz (David Empson) Lines: 100 In article <2488ue$jsc@nz12.rz.uni-karlsruhe.de> "Volker Herrmann" writes: > Has anybody used the GSOS calls VOLUME and DINFO in ORCA/Pascal 2.0? No, but I have done in ORCA/C 1.3, and the concept should be similar. Judging by ORCA/Pascal 1.4's GSOS.PAS file (GSOS unit), it uses Class 1 calls. Here is a quick attempt (off the top of my head) to do a DInfo/Volume loop in Pascal. Since this is keyed in while online, I haven't tested it. There may be typos or outright bugs. I hope it illustrates the general technique, and the units haven't changed much between 1.4 and 2.0. This simple example just writes a device list to the screen. It shows all devices, marking character devices and offline block devices as such. If you have any questions (or bug reports), please E-Mail me or post them here. I'll save a copy for myself and test it later. --- start of program --- program do_dinfo(output); uses common, gsos; { may need more } procedure write_gsos(name : gsosInString; minWidth : integer); { Write a GS/OS input string in a minimum width field } var i : integer; begin i := 1; while i <= name.size do write(name.theString[i]); while i <= minWidth do write(' '); end; {write_gsos} procedure process_device(name : gsosInString; di : dInfoOSDCB); { Process the record returned from a DInfo call } var volname : gsosOutString; vi : volumeOSDCB; error : word; begin write(di.devNum:2, ' '); write_gsos(name, 32); write(' '); if (di.characteristics and $80) = 0 then writeln('') else begin volname.maxSize := sizeof(volname); vi.pcount := 6; { up to blockSize } vi.devName := @name; vi.volName := @volname; VolumeGS(vi); error := ToolError; if error = $2E then { Volume switched - reread immediately } begin VolumeGS(vi); error := ToolError; end; if error = $2F then { Device offline } writeln('') else if error <> 0 then writeln('') else begin write_gsos(volname.theString, 0); writeln; end; end; end; {process_device} procedure scan_volumes; { Scan all devices in turn } var devname : gsosOutString; di : dInfoOSDCB; begin { The output string must have its "buffer size" initialized } devname.maxSize := sizeof(devname); { Set up the parameter block for the first DInfo call } di.pcount := 8; { up to deviceID } di.devNum := 1; { start at first device } di.devName := @devname; { pointer to device name } DInfoGS(di); { get info about the first device } while toolerror = 0 do begin process_device(devname.theString, di); di.devNum := di.devNum + 1; { move on to the next device } DInfoGS(di); { and get info about it } end; end; {scan_volumes} begin scan_volumes; end. -- David Empson dempson@swell.actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand