/*-*-Macsyma-*-*/
/*    (c) Copyright 1984 the Regents of the University of California.
          All Rights Reserved.
          This work was produced under the sponsorship of the
          U.S. Department of Energy.  The Government retains
          certain rights therein.                                     */

eval_when([translate,batch,demo],
	  load_package(sharem,"autolo"))$

herald_package(defstmrun)$

matchfix("{","}")$

reference_an_extend(x,accessor,expected_extend_type,slot_number):=
   block([type:extendp(x)],
      cond(type=false,not_an_extend(accessor,x),

	   type=expected_extend_type,extend_ref(x,slot_number),

	   true,
	   error("Attempt to use",accessor,"to access a slot of",X,
		 "Expected MACSYMA EXTEND type was:",expected_extend_type)))$

not_an_extend(alt,obj):=
   error(alt,"was not given a MACSYMA EXTEND object; argument was:",obj)$

alter_extend_check(x,alterant,expected_extend_type):=
   block([type:extendp(x)],
      cond(type=false,not_an_extend(alterant,x),

	   type#expected_extend_type,
	   error("Attempt to apply",alterant,"to alter",X,
		 "Expected MACSYMA EXTEND type was:",expected_extend_type)))$
