//---------------------------------------------------------------------------------------- public static int Enroques(cPosicion pos, cMov[] mlist, int mPos, color us, cInfoJaque ci, enroque Cr, bool Checks, bool Chess960) { bool KingSide = (Cr==cEnroque.OO_BLANCAS||Cr==cEnroque.OO_NEGRAS); if(pos.CanNotEnroque(Cr)||0==pos.PosibleEnrocar(Cr)) return mPos; sq kfrom = pos.GetRey(us); sq rfrom = pos.CasillaTorreEnroque(Cr); sq kto = cTypes.CasillaProxima(us, KingSide ? cCasilla.G1 : cCasilla.C1); bitbrd enemies = pos.PiezasColor(cTypes.Contrario(us)); sq K = Chess960 ? kto>kfrom ? cCasilla.OESTE : cCasilla.ESTE : KingSide ? cCasilla.OESTE : cCasilla.ESTE; for(sq s = kto; s!=kfrom; s+=K) if((pos.AtaquesA(s)&enemies)!=0) return mPos; if(Chess960&&(cBitBoard.AtaquesPieza(kto, pos.Piezas()^cBitBoard.m_nCasillas[rfrom], cPieza.TORRE)&pos.PiezasColor(cTypes.Contrario(us), cPieza.TORRE, cPieza.DAMA))!=0) return mPos; mov m = cTypes.CreaMov(kfrom, rfrom, cMovType.ENROQUE, cPieza.CABALLO); if(Checks&&!pos.IsJaque(m, ci)) return mPos; mlist[mPos++].m=m; return mPos; }
public Texture(PlatformTexture texture, int sourceWidth, int sourceHeight, int left, int right, int top, int bottom, bool isTransparent) { Debug.Assert(sourceWidth > 0); Debug.Assert(sourceHeight > 0); Debug.Assert(left >= 0 && left <= sourceWidth); Debug.Assert(right >= 0 && right <= sourceWidth); Debug.Assert(right >= left); Debug.Assert(top >= 0 && top <= sourceHeight); Debug.Assert(bottom >= 0 && bottom <= sourceHeight); Debug.Assert(bottom >= top); this.PlatformTexture = texture; this.SourceWidth = sourceWidth; this.SourceHeight = sourceHeight; this.Width = right - left; this.Height = bottom - top; this.Left = (float)left / sourceWidth; this.Right = (float)right / sourceWidth; this.Top = (float)top / sourceHeight; this.Bottom = (float)bottom / sourceHeight; this.IsTransparent = isTransparent; }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; data = BitConverter.ToInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(data).Length; return (curIndex - startIndex); }
public void IDTest() { var value = new System.Int32(); var target = new EnglishSentences(); target.ID = value; Assert.AreEqual(value, target.ID); }
/// <summary>Initializes a new instance of the Abstract1 class.</summary> protected Abstract1( System.UInt32 identity, System.Int32 abstract1Field1, System.Int32 abstract1Field2, ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>)) { this.identity = identity; this.abstract1Field1 = abstract1Field1; this.abstract1Field2 = abstract1Field2; }
//---------------------------------------------------------------------------------------- public static int Capturas(cPosicion pos, cMov[] mlist, int mPos, type Type) { color us = pos.ColorMueve(); bitbrd target = Type==cMovType.CAPTURES ? pos.PiezasColor(cTypes.Contrario(us)) : Type==cMovType.QUIETS ? ~pos.Piezas() : Type==cMovType.NON_EVASIONS ? ~pos.PiezasColor(us) : 0; return us==cColor.BLANCO ? ToDO(pos, mlist, mPos, target, cColor.BLANCO, Type, null) : ToDO(pos, mlist, mPos, target, cColor.NEGRO, Type, null); }
/// <summary>Initializes a new instance of the A class.</summary> protected A( System.UInt32 identity, System.Int32 field1, ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>)) { this.identity = identity; this.field1 = field1; if (!skipValidation.Value) { this.Validate(); } }
/// <summary>Initializes a new instance of the Fruit class.</summary> protected Fruit( System.UInt32 identity, System.String color, System.Int32 skinThickness, ImmutableObjectGraph.Optional<bool> skipValidation = default(ImmutableObjectGraph.Optional<bool>)) { this.identity = identity; this.color = color; this.skinThickness = skinThickness; if (!skipValidation.Value) { this.Validate(); } }
// TODO: this parameter won't be optional public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f) { Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix); MyBuilderInstanceData builderInstanceData; if (!m_instanceParts.TryGetValue(model, out builderInstanceData)) { builderInstanceData = new MyBuilderInstanceData(); builderInstanceData.Model = model; m_instanceParts.Add(model, builderInstanceData); } //if (bones == null) //{ // builderInstanceData.InstanceData.Add(new MyCubeInstanceData() // { // ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0), // EnableSkinning = false, // LocalMatrix = localMatrix // }); //} //else //{ // var cubeInstance = new MyCubeInstanceData() // { // ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0), // EnableSkinning = true, // LocalMatrix = localMatrix, // }; // cubeInstance.BoneRange = gridSize; // for (int i = 0; i < 9; i++) // { // cubeInstance[i] = bones[i]; // } // builderInstanceData.InstanceData.Add(cubeInstance); //} builderInstanceData.InstanceData.Add(new MyInstanceData() { ColorMaskHSV = new VRageMath.PackedVector.HalfVector4(new Vector4(MyPlayer.SelectedColor, 0)), LocalMatrix = localMatrix }); }
private string GetResult(Number number) { if (number < 0) { number = -number; } if (number < 4 || number > 10000000) { return null; } var factors = new List<Number>(); var bound = number / 2; for (Number i = 2; i <= bound; i++) { if (i > 3) { // skip further even divisors i++; } while (number % i == 0) { number /= i; factors.Add(i); } if (number == 1) { break; } } if (number != 1) { return "Prime number."; } var sb = new StringBuilder(); sb.Append("Factors: "); sb.Append(string.Join(" ", factors)); return sb.ToString(); }
// TODO: this parameter won't be optional public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f) { Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix); MyBuilderInstanceData builderInstanceData; if (!m_instanceParts.TryGetValue(model, out builderInstanceData)) { builderInstanceData = new MyBuilderInstanceData(); builderInstanceData.Model = model; m_instanceParts.Add(model, builderInstanceData); } if (bones == null) { builderInstanceData.InstanceData.Add(new MyCubeInstanceData() { ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0), EnableSkinning = false, LocalMatrix = localMatrix }); } else { var cubeInstance = new MyCubeInstanceData() { ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0), EnableSkinning = true, LocalMatrix = localMatrix, }; cubeInstance.BoneRange = gridSize; for (int i = 0; i < 9; i++) { cubeInstance[i] = bones[i]; } builderInstanceData.InstanceData.Add(cubeInstance); } m_cubeBuilderAABB = m_cubeBuilderAABB.Include( new BoundingBox(new Vector3(-MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)), new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large))).Transform(localMatrix)); }
public static bool Scan(this ITdfaSimulation automaton, int[] input, out State action) { State state = automaton.Start; State? acceptingState = null; foreach (var item in input) { State nextState; if (automaton.TryNext(state, item, out nextState)) { state = nextState; } else if (automaton.Tunnel(state, out nextState)) { state = nextState; } else { break; } if (automaton.IsAccepting(state)) { acceptingState = state; } } if (!acceptingState.HasValue) { action = -1; return false; } var optAction = automaton.GetAction(acceptingState.Value); action = optAction.GetValueOrDefault(-1); return true; }
public Int32() { data = 0; }
public IReadOnlyList <int> this[Symbol symbol] => odds[symbol];
partial void OnNumberOfFriendsChanging(ref bool handled, ref System.Int32 _numberOfFriends);
public override void Convert(byte[] data) { byte[] l_bytes = new byte[4]; for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 0]; } this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 4]; } this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 8]; } this.m_Impt_link_8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 12]; } this.m_Impt_link_C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 16]; } this.m_Impt_link_10 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 20]; } this.m_Impt_link_14 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 24]; } this.m_Impt_link_18 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 28]; } this.m_Impt_link_1C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32]; } this.m_Impt_link_20 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 36]; } this.m_Impt_link_24 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 40]; } this.m_Impt_link_28 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 44]; } this.m_Impt_link_2C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 48]; } this.m_Impt_link_30 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 52]; } this.m_Impt_link_34 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 56]; } this.m_Impt_link_38 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 60]; } this.m_Impt_link_3C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 64]; } this.m_Impt_link_40 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 68]; } this.m_Impt_link_44 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 72]; } this.m_Impt_link_48 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 76]; } this.m_Impt_link_4C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 80]; } this.m_Impt_link_50 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 84]; } this.m_Impt_link_54 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 88]; } this.m_Impt_link_58 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 92]; } this.m_Impt_link_5C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 96]; } this.m_Impt_link_60 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 100]; } this.m_Impt_link_64 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 104]; } this.m_Impt_link_68 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 108]; } this.m_Impt_link_6C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 112]; } this.m_Impt_link_70 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 116]; } this.m_Impt_link_74 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 120]; } this.m_Impt_link_78 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 124]; } this.m_Impt_link_7C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 128]; } this.m_Impt_link_80 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 132]; } this.m_Impt_link_84 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 136]; } this.m_Impt_link_88 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 140]; } this.m_Impt_link_8C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 144]; } this.m_Impt_link_90 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 148]; } this.m_Impt_link_94 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 152]; } this.m_Impt_link_98 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 156]; } this.m_Impt_link_9C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 160]; } this.m_Impt_link_A0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 164]; } this.m_Impt_link_A4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 168]; } this.m_Impt_link_A8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 172]; } this.m_Impt_link_AC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 176]; } this.m_Impt_link_B0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 180]; } this.m_Impt_link_B4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 184]; } this.m_Impt_link_B8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 188]; } this.m_Impt_link_BC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 192]; } this.m_Impt_link_C0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 196]; } this.m_Impt_link_C4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 200]; } this.m_Impt_link_C8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 204]; } this.m_Impt_link_CC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 208]; } this.m_Impt_link_D0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 212]; } this.m_Impt_link_D4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 216]; } this.m_Impt_link_D8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 220]; } this.m_Impt_link_DC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 224]; } this.m_Impt_link_E0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 228]; } this.m_Impt_link_E4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 232]; } this.m_Impt_link_E8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 236]; } this.m_Not_used_EC = (System.Int32)BinaryDatReader.ConverterStub(l_bytes, 4); }
public override void Claim(System.Int32 timeout) { }
public void GenderChanged(System.Int32 index) { gender = (Model.Enum.Gender)index; Invoke("buildVoicesList", 0.2f); }
bool ParseType() { /* * Type ::= ( BOOLEAN | CHAR | I1 | U1 | U2 | U2 | I4 | U4 | I8 | U8 | R4 | R8 | I | U | | VALUETYPE TypeDefOrRefEncoded | CLASS TypeDefOrRefEncoded | STRING | OBJECT | PTR CustomMod* VOID | PTR CustomMod* Type | FNPTR MethodDefSig | FNPTR MethodRefSig | ARRAY Type ArrayShape | SZARRAY CustomMod* Type | GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type * | VAR Number | MVAR Number | */ NotifyBeginType(); sig_elem_type elem_type; sig_index index; sig_mem_number number; sig_index_type indexType; if (!ParseByte(out elem_type)) { return(false); } switch (elem_type) { case ELEMENT_TYPE_BOOLEAN: case ELEMENT_TYPE_CHAR: case ELEMENT_TYPE_I1: case ELEMENT_TYPE_U1: case ELEMENT_TYPE_U2: case ELEMENT_TYPE_I2: case ELEMENT_TYPE_I4: case ELEMENT_TYPE_U4: case ELEMENT_TYPE_I8: case ELEMENT_TYPE_U8: case ELEMENT_TYPE_R4: case ELEMENT_TYPE_R8: case ELEMENT_TYPE_I: case ELEMENT_TYPE_U: case ELEMENT_TYPE_STRING: case ELEMENT_TYPE_OBJECT: // simple types NotifyTypeSimple(elem_type); break; case ELEMENT_TYPE_PTR: // PTR CustomMod* VOID // PTR CustomMod* Type NotifyTypePointer(); if (!ParseOptionalCustomMods()) { return(false); } if (pbCur >= pbEnd) { return(false); } if (pb[pbCur] == ELEMENT_TYPE_VOID) { pbCur++; NotifyVoid(); break; } if (!ParseType()) { return(false); } break; case ELEMENT_TYPE_CLASS: // CLASS TypeDefOrRefEncoded NotifyTypeClass(); sig_index encodedC; if (!ParseTypeDefOrRefEncoded(out encodedC, out indexType, out index)) { return(false); } NotifyTypeDefOrRef(encodedC, indexType, index); break; case ELEMENT_TYPE_VALUETYPE: //VALUETYPE TypeDefOrRefEncoded NotifyTypeValueType(); sig_index encodedV; if (!ParseTypeDefOrRefEncoded(out encodedV, out indexType, out index)) { return(false); } NotifyTypeDefOrRef(encodedV, indexType, index); break; case ELEMENT_TYPE_FNPTR: // FNPTR MethodDefSig // FNPTR MethodRefSig NotifyTypeFunctionPointer(); if (!ParseByte(out elem_type)) { return(false); } if (!ParseMethod(elem_type)) { return(false); } break; case ELEMENT_TYPE_ARRAY: // ARRAY Type ArrayShape NotifyTypeArray(); if (!ParseType()) { return(false); } if (!ParseArrayShape()) { return(false); } break; case ELEMENT_TYPE_SZARRAY: // SZARRAY CustomMod* Type NotifyTypeSzArray(); if (!ParseOptionalCustomMods()) { return(false); } if (!ParseType()) { return(false); } break; case ELEMENT_TYPE_GENERICINST: // GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type * if (!ParseType()) { return(false); } if (!ParseNumber(out number)) { return(false); } for (sig_mem_number i = 0; i < number; i++) { if (!ParseType()) { return(false); } } NotifyTypeGenericInst(number); break; case ELEMENT_TYPE_VAR: // VAR Number if (!ParseNumber(out number)) { return(false); } NotifyTypeGenericTypeVariable(number); break; case ELEMENT_TYPE_MVAR: // MVAR Number if (!ParseNumber(out number)) { return(false); } NotifyTypeGenericMemberVariable(number); break; case ELEMENT_TYPE_INTERNAL: // Used for DynamicMethod when signature helper does not have a module set if (!ParseInternal()) { return(false); } break; } NotifyEndType(); return(true); }
bool ParseNumber(out sig_count pOut) { pOut = 0; // parse the variable length number format (0-4 bytes) sig_byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; // at least one byte in the encoding, read that if (!ParseByte(out b1)) { return(false); } if (b1 == 0xff) { // special encoding of 'NULL' // not sure what this means as a number, don't expect to see it except for string lengths // which we don't encounter anyway so calling it an error return(false); } // early out on 1 byte encoding if ((b1 & 0x80) == 0) { pOut = (int)b1; return(true); } // now at least 2 bytes in the encoding, read 2nd byte if (!ParseByte(out b2)) { return(false); } // early out on 2 byte encoding if ((b1 & 0x40) == 0) { pOut = (((b1 & 0x3f) << 8) | b2); return(true); } // must be a 4 byte encoding if ((b1 & 0x20) != 0) { // 4 byte encoding has this bit clear -- error if not return(false); } if (!ParseByte(out b3)) { return(false); } if (!ParseByte(out b4)) { return(false); } pOut = ((b1 & 0x1f) << 24) | (b2 << 16) | (b3 << 8) | b4; return(true); }
// number of generic parameters in this method signature (if any) protected virtual void NotifyGenericParamCount(sig_count count) { }
public void Int02(System.Int32 p = default(short)) { }
bool ParseTypeDefOrRefEncoded(out sig_index pEncoded, out sig_index_type pIndexTypeOut, out sig_index pIndexOut) { pIndexTypeOut = 0; pIndexOut = 0; // parse an encoded typedef or typeref if (!ParseNumber(out pEncoded)) { return(false); } pIndexTypeOut = (sig_index_type)(pEncoded & 0x3); pIndexOut = (pEncoded >> 2); return(true); }
public static lua_Integer luaL_opt_integer(lua_State L, luaL_opt_delegate_integer f, int n, lua_Integer d) { return(lua_isnoneornil(L, n) ? d : f(L, n)); }
public static long luaL_optlong(lua_State L, int n, lua_Integer d) { return(luaL_optinteger(L, n, d)); }
public static int luaL_optint(lua_State L, int n, lua_Integer d) { return((int)luaL_optinteger(L, n, d)); }
public static int B_ToNumber(ILuaState lua) { LuaType t = lua.Type(2); if (t == LuaType.LUA_TNONE || t == LuaType.LUA_TNIL) // standard conversion { bool isnum; double n = lua.ToNumberX(1, out isnum); if (isnum) { lua.PushNumber(n); return(1); } // else not a number; must be something lua.L_CheckAny(1); } else { string s = lua.L_CheckString(1); int numBase = lua.L_CheckInteger(2); bool negative = false; lua.L_ArgCheck((2 <= numBase && numBase <= 36), 2, "base out of range"); s = s.Trim(' ', '\f', '\n', '\r', '\t', '\v'); s = s + '\0'; // guard int pos = 0; if (s[pos] == '-') { pos++; negative = true; } else if (s[pos] == '+') { pos++; } if (Char.IsLetterOrDigit(s, pos)) { double n = 0.0; do { int digit; if (Char.IsDigit(s, pos)) { digit = Int32.Parse(s[pos].ToString()); } else { digit = Char.ToUpper(s[pos]) - 'A' + 10; } if (digit >= numBase) { break; // invalid numeral; force a fail } n = n * (double)numBase + (double)digit; pos++; } while(Char.IsLetterOrDigit(s, pos)); if (pos == s.Length - 1) // except guard, no invalid trailing characters? { lua.PushNumber(negative ? -n : n); return(1); } // else not a number } // else not a number } lua.PushNil(); // not a number return(1); }
// count of locals with a block protected virtual void NotifyLocalsCount(sig_count count) { }
public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus) { if (@default) { gtk_window_set_default (gtkPlus.window, widget); gtk_paint_box ( style, window, GtkStateType.GTK_STATE_NORMAL, GtkShadowType.GTK_SHADOW_IN, ref area, widget, "buttondefault", x, y, width, height); gtk_window_set_default (gtkPlus.window, IntPtr.Zero); } else gtk_paint_box ( style, window, (GtkStateType)state, state == GtkPlusState.Pressed ? GtkShadowType.GTK_SHADOW_IN : GtkShadowType.GTK_SHADOW_OUT, ref area, widget, "button", x, y, width, height); }
public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus) { gtk_paint_box ( gtkPlus.tool_bar_button_style, window, (GtkStateType)state, state == GtkPlusState.Pressed ? GtkShadowType.GTK_SHADOW_IN : GtkShadowType.GTK_SHADOW_OUT, ref area, gtkPlus.tool_bar_button, "button", x, y, width, height); }
bool ParseMethod(sig_elem_type elem_type) { // MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|GENERIC GenParamCount) // ParamCount RetType Param* [SENTINEL Param+] NotifyBeginMethod(elem_type); sig_count gen_param_count; sig_count param_count; if ((elem_type & SIG_GENERIC) != 0) { if (!ParseNumber(out gen_param_count)) { return(false); } NotifyGenericParamCount(gen_param_count); } if (!ParseNumber(out param_count)) { return(false); } NotifyParamCount(param_count); if (!ParseRetType()) { return(false); } bool fEncounteredSentinel = false; for (sig_count i = 0; i < param_count; i++) { if (pbCur >= pbEnd) { return(false); } if (pb[pbCur] == ELEMENT_TYPE_SENTINEL) { if (fEncounteredSentinel) { return(false); } fEncounteredSentinel = true; NotifySentinel(); pbCur++; } if (!ParseParam()) { return(false); } } NotifyEndMethod(); return(true); }
static extern void gdk_draw_rectangle (GdkDrawablePointer drawable, GdkGCPointer gc, gboolean filled, gint x, gint y, gint width, gint height);
private static int str_find_aux(lua_State L, int find) { uint l1, l2; CharPtr s = luaL_checklstring(L, 1, out l1); CharPtr p = luaL_checklstring(L, 2, out l2); ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; if (init < 0) { init = 0; } else if ((uint)(init) > l1) { init = (ptrdiff_t)l1; } if ((find != 0) && ((lua_toboolean(L, 4) != 0) || /* explicit request? */ strpbrk(p, SPECIALS) == null)) /* or no special characters? */ /* do a plain search */ { CharPtr s2 = lmemfind(s + init, (uint)(l1 - init), p, (uint)(l2)); if (s2 != null) { lua_pushinteger(L, s2 - s + 1); lua_pushinteger(L, (int)(s2 - s + l2)); return(2); } } else { MatchState ms = new MatchState(); int anchor = 0; if (p[0] == '^') { p = p.next(); anchor = 1; } CharPtr s1 = s + init; ms.L = L; ms.src_init = s; ms.src_end = s + l1; do { CharPtr res; ms.level = 0; if ((res = match(ms, s1, p)) != null) { if (find != 0) { lua_pushinteger(L, s1 - s + 1); /* start */ lua_pushinteger(L, res - s); /* end */ return(push_captures(ms, null, null) + 2); } else { return(push_captures(ms, s1, res)); } } } while (((s1 = s1.next()) <= ms.src_end) && (anchor == 0)); } lua_pushnil(L); /* not found */ return(1); }
public GdkRectangle (Rectangle value) { x = value.X; y = value.Y; width = value.Width; height = value.Height; }
public override void Convert(byte[] data) { byte[] l_bytes = new byte[4]; for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 0]; } this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 4]; } this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 8]; } this.m_Mtrl_link_8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 12]; } this.m_Mtrl_link_C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 16]; } this.m_Mtrl_link_10 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 20]; } this.m_Mtrl_link_14 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 24]; } this.m_Mtrl_link_18 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 28]; } this.m_Mtrl_link_1C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32]; } this.m_Mtrl_link_20 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 36]; } this.m_Mtrl_link_24 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 40]; } this.m_Mtrl_link_28 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 44]; } this.m_Mtrl_link_2C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 48]; } this.m_Mtrl_link_30 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 52]; } this.m_Mtrl_link_34 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 56]; } this.m_Mtrl_link_38 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 60]; } this.m_Mtrl_link_3C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 64]; } this.m_Mtrl_link_40 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 68]; } this.m_Mtrl_link_44 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 72]; } this.m_Mtrl_link_48 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 76]; } this.m_Mtrl_link_4C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 80]; } this.m_Mtrl_link_50 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 84]; } this.m_Not_used_54 = (System.Int32)BinaryDatReader.ConverterStub(l_bytes, 4); }
static extern gint gtk_tree_view_insert_column ( GtkTreeViewPointer tree_view, GtkTreeViewColumnPointer column, gint position);
partial void OnIdChanging(ref bool handled, ref System.Int32 _id);
static extern void gtk_paint_expander ( GtkStylePointer style, GdkWindowPointer window, GtkStateType state_type, ref GdkRectangle area, GtkWidgetPointer widget, string detail, gint x, gint y, GtkExpanderStyle expander_style);
public override void Convert(byte[] data) { byte[] l_bytes = new byte[4]; for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 0]; } this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 4]; } this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 8]; } this.m_Not_used_8 = (System.Int32)BinaryDatReader.ConverterStub(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 28]; } this.m_Packages_1C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); m_pkg_20 = new Package[this.m_Packages_1C]; for (int j = 0; j < this.m_Packages_1C; j++) { for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32 + j * 12 + 0]; } { Package l_pkg; l_pkg = m_pkg_20[j] == null ? m_pkg_20[j] = new Package() : m_pkg_20[j]; l_pkg.m_x_coordinate_0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); } } for (int j = 0; j < this.m_Packages_1C; j++) { for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32 + j * 12 + 4]; } { Package l_pkg; l_pkg = m_pkg_20[j] == null ? m_pkg_20[j] = new Package() : m_pkg_20[j]; l_pkg.m_y_coordinate_4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); } } for (int j = 0; j < this.m_Packages_1C; j++) { for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32 + j * 12 + 8]; } { Package l_pkg; l_pkg = m_pkg_20[j] == null ? m_pkg_20[j] = new Package() : m_pkg_20[j]; l_pkg.m_z_coordinate_8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); } } }
static extern void gtk_paint_flat_box ( GtkStylePointer style, GdkWindowPointer window, GtkStateType state_type, GtkShadowType shadow_type, ref GdkRectangle area, GtkWidgetPointer widget, string detail, gint x, gint y, gint width, gint height);
private void Init() { bit = nextBit; nextBit = nextBit << 1; id = nextId++; }
static extern void gtk_paint_slider ( GtkStylePointer style, GdkWindowPointer window, GtkStateType state_type, GtkShadowType shadow_type, ref GdkRectangle area, GtkWidgetPointer widget, string detail, gint x, gint y, gint width, gint height, GtkOrientation orientation);
// array rank (total number of dimensions) protected virtual void NotifyRank(sig_count count) { }
public void UnlockBuffer(System.Int32 bytes) { }
public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus) { gtk_paint_box ( gtkPlus.tool_bar_toggle_button_style, window, GtkStateType.GTK_STATE_ACTIVE, GtkShadowType.GTK_SHADOW_IN, ref area, gtkPlus.tool_bar_toggle_button, "button", x, y, width, height); }
// number of dimensions with specified sizes followed by the size of each protected virtual void NotifyNumSizes(sig_count count) { }
static extern GdkPixmapPointer gdk_pixmap_new (GdkDrawablePointer drawable, gint width, gint height, gint depth);
protected virtual void NotifySize(sig_count count) { }
static extern void gtk_widget_style_get (GtkWidgetPointer widget, string property1, out gint value1, string property2, out gint value2, IntPtr nullTerminator);
// BUG BUG lower bounds can be negative, how can this be encoded? // number of dimensions with specified lower bounds followed by lower bound of each protected virtual void NotifyNumLoBounds(sig_count count) { }
static extern void gtk_toolbar_insert ( GtkToolbarPointer toolbar, GtkToolItemPointer item, gint pos);
protected virtual void NotifyLoBound(sig_count count) { }
static extern void gtk_paint_extension ( GtkStylePointer style, GdkWindowPointer window, GtkStateType state_type, GtkShadowType shadow_type, ref GdkRectangle area, GtkWidgetPointer widget, string detail, gint x, gint y, gint width, gint height, GtkPositionType gap_side);
// the type has the indicated custom modifiers (which can be optional or required) protected virtual void NotifyCustomMod(sig_elem_type cmod, sig_index token, sig_index_type indexType, sig_index index) { }
static extern void gtk_paint_resize_grip ( GtkStylePointer style, GdkWindowPointer window, GtkStateType state_type, ref GdkRectangle area, GtkWidgetPointer widget, string detail, GdkWindowEdge edge, gint x, gint y, gint width, gint height);
// the type is specified by the given index of the given index type (normally a type index in the type metadata) // this callback is normally qualified by other ones such as NotifyTypeClass or NotifyTypeValueType protected virtual void NotifyTypeDefOrRef(sig_index token, sig_index_type indexType, int index) { }
public abstract void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus);
// number indicates the number of type specifications for the generic types that will follow protected virtual void NotifyTypeGenericInst(sig_mem_number number) { }
public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus) { PaintFunction ( style, window, (GtkStateType)state, (GtkShadowType)value, ref area, widget, Detail, x, y, width,height); }
// the type is the type of the nth generic type parameter for the member protected virtual void NotifyTypeGenericMemberVariable(sig_mem_number number) { }