
Begin["System`"]
(* Attributes.m : to be loaded at dump time : drg *)

ClearAttributes::usage = 
"ClearAttributes[s, attr] removes attr from the list of attributes
of the symbol s."

SetAttributes::usage =
"SetAttributes[s, attr] adds attr to the list of attributes of
the symbol s."

Begin["`Private`"]

ClearAttributes[sym_,att_Symbol] := ClearAttributes[sym,{att}]
SetAttributes[sym_,att_Symbol] := SetAttributes[sym,{att}]
ClearAttributes[sym_List,att_] := (Scan[ClearAttributes[#,att]&,sym];)
SetAttributes[sym_List,att_] := (Scan[SetAttributes[#,att]&,sym];)

ClearAttributes[sym_Symbol,att_List] :=
	(Attributes[sym] = Complement[Attributes[sym],att];)

SetAttributes[sym_Symbol,att_List] :=
	(Attributes[sym] = Union[Attributes[sym],att];)

SetAttributes[args___] := Null /; attrError[SetAttributes, args]
ClearAttributes[args___] := Null /; attrError[ClearAttributes, args]

attrError[msghead_, sym_, _] :=
	Message[msghead::sym, sym, 1] /; Head[sym] =!= Symbol

attrError[msghead_, _, att_] :=
	Message[msghead::sym, att, 2] /; Head[att] =!= Symbol

attrError[msghead_, _] := Message[msghead::argr, msghead, 2]

attrError[msghead_, args___] :=
	Message[msghead::argrx, msghead, Length[{args}], 2]

Clear[nprot, prot];
Remove[nprot, prot];

End[ ]  (* "`Private`" *)

Protect[ClearAttributes, SetAttributes]

End[]  (* "System`" *)
