GENERIC MODULENot (Rep); IMPORT CG, CallExpr, Expr, ExprRep, Procedure, Target, TWord; IMPORT IntegerExpr, Value, Formal, Type, ProcType, TInt; FROM Rep IMPORT T; FROM TargetMap IMPORT Integer_types; VAR Z: CallExpr.MethodList; VAR formals: Value.T; VAR rep: [FIRST (Integer_types) .. LAST (Integer_types)]; PROCEDURECheck (ce: CallExpr.T; VAR cs: Expr.CheckState) = BEGIN EVAL Formal.CheckArgs (cs, ce.args, formals, ce.proc); ce.type := T; END Check; PROCEDURECompile (ce: CallExpr.T) = BEGIN Expr.Compile (ce.args[0]); CG.Not (Integer_types[rep].cg_type); END Compile; PROCEDUREFold (ce: CallExpr.T): Expr.T = VAR e: Expr.T; w, result: Target.Int; t: Type.T; BEGIN e := Expr.ConstValue (ce.args[0]); IF (e # NIL) AND IntegerExpr.Split (e, w, t) THEN TWord.Not (w, result); EVAL TInt.Extend (result, Integer_types[rep].bytes, result); RETURN IntegerExpr.New (T, result); END; RETURN NIL; END Fold; PROCEDUREInitialize (r: INTEGER) = VAR f0 := Formal.NewBuiltin ("x", 0, T); t := ProcType.New (T, f0); BEGIN rep := r; Z := CallExpr.NewMethodList (1, 1, TRUE, TRUE, TRUE, T, NIL, CallExpr.NotAddressable, Check, CallExpr.PrepArgs, Compile, CallExpr.NoLValue, CallExpr.NoLValue, CallExpr.NotBoolean, CallExpr.NotBoolean, Fold, CallExpr.NoBounds, CallExpr.IsNever, (* writable *) CallExpr.IsNever, (* designator *) CallExpr.NotWritable (* noteWriter *)); Procedure.Define ("Not", Z, FALSE, t); formals := ProcType.Formals (t); END Initialize; BEGIN END Not.