コード例 #1
0
ファイル: AmlLoader.cs プロジェクト: Paul1nh0/Singularity
 public override void Visit(AmlParser.ConstObj constObj)
 {
     if (constObj.op == AmlParser.ZeroOp)
     {
         result = AcpiObject.IntegerConstant.Zero.GetAsInt();
     }
     else if (constObj.op == AmlParser.OneOp)
     {
         result = AcpiObject.IntegerConstant.One.GetAsInt();
     }
     else if (constObj.op == AmlParser.OnesOp)
     {
         result = AcpiObject.IntegerConstant.Ones.GetAsInt();
     }
 }
コード例 #2
0
        public override void Visit(ComputationalData computationalData)
        {
            switch (computationalData.Tag)
            {
            case ComputationalData.TagValue.ByteConst:
                byte byteConst = computationalData.GetAsByteConst();
                result.Add(new PushConst(new AcpiObject.Integer(byteConst)));
                break;

            case ComputationalData.TagValue.WordConst:
                UInt16 wordConst = computationalData.GetAsWordConst();
                result.Add(new PushConst(new AcpiObject.Integer(wordConst)));
                break;

            case ComputationalData.TagValue.DWordConst:
                UInt32 dWordConst = computationalData.GetAsDWordConst();
                result.Add(new PushConst(new AcpiObject.Integer(dWordConst)));
                break;

            case ComputationalData.TagValue.QWordConst:
                UInt64 qWordConst = computationalData.GetAsQWordConst();
                result.Add(new PushConst(new AcpiObject.Integer(qWordConst)));
                break;

            case ComputationalData.TagValue.StringConst:
                string stringConst = computationalData.GetAsStringConst();
                result.Add(new PushConst(new AcpiObject.String(stringConst)));
                break;

            case ComputationalData.TagValue.ConstObj:
                AmlParser.ConstObj constObj = computationalData.GetAsConstObj();
                switch (constObj.op)
                {
                case AmlParser.ZeroOp:
                    result.Add(new PushConst(AcpiObject.IntegerConstant.Zero));
                    break;

                case AmlParser.OneOp:
                    result.Add(new PushConst(AcpiObject.IntegerConstant.One));
                    break;

                case AmlParser.OnesOp:
                    result.Add(new PushConst(AcpiObject.IntegerConstant.Ones));
                    break;
                }
                break;

            case ComputationalData.TagValue.RevisionOp:
                result.Add(new PushConst(AcpiObject.IntegerConstant.Revision));
                break;

            case ComputationalData.TagValue.DefBuffer:
                AmlParser.DefBuffer defBuffer = computationalData.GetAsDefBuffer();
                defBuffer.Accept(this);
                break;

            default:
                Debug.Assert(false, "Unhandled alternative in switch over 'ComputationalData'");
                break;
            }
        }
コード例 #3
0
 public virtual void Visit(AmlParser.ConstObj constObj)
 {
     UnhandledNodeType("ConstObj");
 }