public NamedDataTypeExtractor(IEnumerable <DeclSpec> specs, SymbolTable converter) { this.specs = specs; this.symbolTable = converter; this.callingConvention = CTokenType.None; this.eval = new CConstantEvaluator(converter.Constants); this.simpleSize = SimpleSize.None; foreach (var declspec in specs) { dt = declspec.Accept(this); } }
private void resize(SimpleSize size) { int dimensions = size == SimpleSize.Large ? dimensionsLarge : dimensionsSmall, factor = buttons.Length; foreach (Button button in buttons) { int horizontalMovement = factor-- *dimensionsDiff; button.Location = new Point(size == SimpleSize.Large ? button.Location.X - horizontalMovement : button.Location.X + horizontalMovement, button.Location.Y); button.Size = new Size(dimensions, dimensions); } this.size = size; }
private void resize(SimpleSize size) { int dimensions = size == SimpleSize.Large ? dimensionsLarge : dimensionsSmall, factor = buttons.Length; foreach(Button button in buttons) { int horizontalMovement = factor-- * dimensionsDiff; button.Location = new Point(size == SimpleSize.Large ? button.Location.X - horizontalMovement : button.Location.X + horizontalMovement, button.Location.Y); button.Size = new Size(dimensions, dimensions); } this.size = size; }
public SerializedType VisitSimpleType(SimpleTypeSpec simpleType) { switch (simpleType.Type) { default: throw new NotImplementedException(string.Format("{0}", simpleType.Type)); case CTokenType.Void: if (domain != Domain.None) { throw new FormatException(string.Format("Can't have 'void' after '{0}'.", domain)); } return(new VoidType_v1()); case CTokenType.__W64: return(dt); // Used by Microsoft compilers for 32->64 bit transition, deprecated. case CTokenType.Signed: if (domain != Domain.None) { throw new FormatException(string.Format("Can't have 'signed' after '{0}'.", domain)); } domain = Domain.SignedInt; byteSize = 4; // 'unsigned' == 'unsigned int' //$TODO: bitsize is platform-dependent. For instance, a 'long' is 32-bits on Windows x86-64 but 64-bits on 64-bit Unix return(CreatePrimitive()); case CTokenType.Unsigned: if (domain != Domain.None) { throw new FormatException(string.Format("Can't have 'unsigned' after '{0}'.", domain)); } domain = Domain.UnsignedInt; byteSize = 4; // 'unsigned' == 'unsigned int' //$TODO: bitsize is platform-dependent. For instance, a 'long' is 32-bits on Windows x86-64 but 64-bits on 64-bit Unix return(CreatePrimitive()); case CTokenType.Char: if (domain == Domain.None) { domain = Domain.Character; } else if (domain != Domain.SignedInt && domain != Domain.UnsignedInt) { throw new FormatException(string.Format("Unexpected domain {0}.", domain)); } simpleSize = SimpleSize.Char; return(CreatePrimitive()); case CTokenType.Wchar_t: if (domain == Domain.None) { domain = Domain.Character; } else if (domain != Domain.SignedInt && domain != Domain.UnsignedInt) { throw new FormatException(string.Format("Unexpected domain {0}", domain)); } simpleSize = SimpleSize.WChar_t; return(CreatePrimitive()); case CTokenType.Short: if (domain != Domain.None && domain != Domain.SignedInt && domain != Domain.UnsignedInt) { throw new FormatException(string.Format("Unexpected domain {0}", domain)); } simpleSize = SimpleSize.Short; return(CreatePrimitive()); case CTokenType.Int: if (domain == Domain.None) { domain = Domain.SignedInt; } else if (domain != Domain.SignedInt && domain != Domain.UnsignedInt) { throw new FormatException(string.Format("Unexpected domain {0}", domain)); } if (simpleSize == SimpleSize.None) { simpleSize = SimpleSize.Int; } return(CreatePrimitive()); //$TODO: bitsize is platform-dependent. For instance, an 'int' is 32-bits on Windows x86-64 but 16-bits on MS-DOS case CTokenType.Long: if (simpleSize == SimpleSize.None) { simpleSize = SimpleSize.Long; } else if (simpleSize == SimpleSize.Long) { simpleSize = SimpleSize.LongLong; } return(CreatePrimitive()); //$TODO: bitsize is platform-dependent. For instance, a 'long' is 32-bits on Windows x86-64 but 64-bits on 64-bit Unix case CTokenType.__Int64: if (domain == Domain.None) { domain = Domain.SignedInt; } else if (domain != Domain.SignedInt && domain != Domain.UnsignedInt) { throw new FormatException(string.Format("Unexpected domain {0}", domain)); } simpleSize = SimpleSize.Int64; return(CreatePrimitive()); case CTokenType.Float: if (domain != Domain.None) { throw new FormatException(string.Format("Unexpected domain {0} before float.", domain)); } domain = Domain.Real; simpleSize = SimpleSize.Float; return(CreatePrimitive()); case CTokenType.Double: if (domain != Domain.None && domain != Domain.SignedInt) //$REVIEW: short double? long double? long long double? { throw new FormatException(string.Format("Unexpected domain {0} before float.", domain)); } domain = Domain.Real; if (simpleSize == SimpleSize.None) { simpleSize = SimpleSize.Double; } else if (simpleSize == SimpleSize.Long) { simpleSize = SimpleSize.LongDouble; } return(CreatePrimitive()); } }