[net.lang.pasca] Peek and poke using variant records

essick (12/12/82)

#R:peri:-16000:uiucdcs:27900003:000:788
uiucdcs!essick    Dec 12 14:21:00 1982

	Under PASCAL-6000 and NOS-1.4 you can read the command line
and print it out with the following program segment. You have to
disable runtime checks for this portion of your program or
you will get invalid pointer errors (PASCAL-6000 keeps some info
laying around which it checks to see if the object pointed to is
the right type)

type  string = packed array [ 0.. 100] of char;
var cc : record
	case boolean of
	true : ( x : integer);
	false: ( strptr : ^ string);
	end;
begin
	cc.x := 67b;	(* point it at the record *)
	for i := 0 to whatever do
	    write (output, strptr^[i]);
	writeln (output);
end;

	I may have baubled the actual number for the command line. I
am not sure if the Berkeley Pascal behaves in the same way.

-- Ray Essick, University of Illinois at Urbana-Champaign