public CallableHeader(Ident name, List <FormalParamSection> paramList, AstNode returnType = null) : base(AstNodeType.CallableHeader) { Name = name; ParamList = paramList; ReturnType = returnType; }
private static Comparison GetComparison(string inputString) { Regex opRegex = new Regex("if ([a-z]+) (<|<=|>|>=|!=|==) (-?[0-9]+)"); MatchCollection mc = opRegex.Matches(inputString); string name = mc[0].Groups[1].Value; int literal = int.Parse(mc[0].Groups[3].Value); Ident targetIdent; if (Registers.ContainsKey(name)) { targetIdent = Registers[name]; } else { targetIdent = new Ident() { Name = name, Value = 0 }; Registers.Add(targetIdent.Name, targetIdent); } Comparison comp = new Comparison() { Ident = targetIdent, Literal = literal }; string opString = mc[0].Groups[2].Value; switch (opString) { case "<": comp.ResultFunction = () => { return(targetIdent.Value < literal); }; break; case "<=": comp.ResultFunction = () => { return(targetIdent.Value <= literal); }; break; case ">": comp.ResultFunction = () => { return(targetIdent.Value > literal); }; break; case ">=": comp.ResultFunction = () => { return(targetIdent.Value >= literal); }; break; case "!=": comp.ResultFunction = () => { return(targetIdent.Value != literal); }; break; case "==": comp.ResultFunction = () => { return(targetIdent.Value == literal); }; break; default: throw new Exception($"Bad operator '{opString}'"); } return(comp); }
public VertexDeclaration GetDeclaration <T>(GraphicsDevice device) { ValidateDevice(device); int index = Ident.TypeIndex <T>(); while (index > this.declarations.Length) { Array.Resize(ref this.declarations, this.declarations.Length * 2); } if (this.declarations[index] != null) { return(this.declarations[index]); } VertexElement[] elements = GetDeclaration(typeof(T)); if (device == null) { return(null); } VertexDeclaration declaration; lock (hashingDecl) { hashingDecl.SetFrom(typeof(T), typeHash, ref typeIndex); if (declarationHash.TryGetValue(hashingDecl, out declaration)) { this.declarations[index] = declaration; return(declaration); } } for (int i = 0; i < elements.Length; i++) { ValidateFormat(typeof(T), elements[i].VertexElementFormat); } ElementHash ehash = new ElementHash(elements); elementHash.TryGetValue(ehash, out declaration); if (declaration == null) { declaration = new VertexDeclaration(device, elements); } this.declarations[index] = declaration; declarationHash.Add(new DeclarationHash(typeof(T), typeHash, ref typeIndex), declaration); if (elementHash.ContainsKey(ehash) == false) { elementHash.Add(ehash, declaration); } return(declaration); }
public (Token, string) Parse(string input) { // Declaration items var dataKeyword = new Word("data").Parse(input); var sp1 = new SkipWhitespace().Parse(dataKeyword.Item2); var name = new Ident().Parse(sp1.Item2); var sp2 = new SkipWhitespace().Parse(name.Item2); var lpar = new Char('(').Parse(sp2.Item2); var sp3 = new SkipWhitespace().Parse(lpar.Item2); var firstExpr = new Expr().Parse(sp3.Item2); var nextExprs = new Maybe( new Many( new Create(TokenType.Node) { new SkipWhitespace(), new Char(','), new Expr() } ) ).Parse(firstExpr.Item2); var sp4 = new SkipWhitespace().Parse(nextExprs.Item2); var rpar = new Char(')').Parse(sp4.Item2); // Combine var declr = dataKeyword.Item1 + name.Item1 + lpar.Item1 + firstExpr.Item1; if (nextExprs.Item1.type != TokenType.Failure) { declr += nextExprs.Item1; } declr += rpar.Item1; declr.type = TokenType.CompOrRecDec; return(declr, rpar.Item2); }
public (Token, string) Parse(string input) { var typeName = new TypeName().Parse(input); var sp1 = new SkipWhitespace().Parse(typeName.Item2); var name = new Ident().Parse(sp1.Item2); var suffix = new Maybe( new Many( new Create(TokenType.Node) { new SkipWhitespace(), new Char(','), new SkipWhitespace(), new TypeName(), new SkipWhitespace(), new Ident() } ) ).Parse(name.Item2); var typeArgList = typeName.Item1 + name.Item1; if (suffix.Item1.type != TokenType.Failure) { typeArgList += suffix.Item1; } typeArgList.type = TokenType.TypeArgList; return(typeArgList, suffix.Item2); }
public (Token, string) Parse(string input) { var defKeyword = new Word("def").Parse(input); var sp1 = new SkipWhitespace().Parse(defKeyword.Item2); var recKeyword = new Word("rec").Parse(sp1.Item2); var sp2 = new SkipWhitespace().Parse(recKeyword.Item2); var name = new Ident().Parse(sp2.Item2); var sp3 = new SkipWhitespace().Parse(name.Item2); var newLine = new Many(new Char('\n')).Parse(sp3.Item2); var functions = new Maybe( new Many( new Create(TokenType.FuncDef) { new SkipWhitespace(), new MiniFuncDef(), new SkipWhitespace(), new Many(new Char('\n')) } ) ).Parse(newLine.Item2); var sp4 = new SkipWhitespace().Parse(functions.Item2); var endKeyword = new Word("end").Parse(sp4.Item2); var token = defKeyword.Item1 + recKeyword.Item1 + name.Item1; if (functions.Item1.type != TokenType.Failure) { token += functions.Item1; } token += endKeyword.Item1; token.type = TokenType.RecDef; return(token, endKeyword.Item2); }
/// <summary> /// Create a new Ident if the name of Ident is not found or return the index of found Ident. /// </summary> /// <param name="buf"> A Buffer that sum chars in one word.</param> /// <returns>Returns a new variable index or an index of found variable.</returns> public int put(string buf) { for (int i = 0; i < p.Length; i++) { if (p[i] == null) { p[i] = new Ident(); } else { break; } } int tmp = Globals.curr_TID; while (tmp != -1) { for (int j = 1; j < top; j++) { if (buf.Equals(Globals.TID_List[tmp].p[j].get_name())) { return(j); } } tmp -= 1; } p[top].put_name(buf); top++; return(top - 1); }
public (Token, string) Parse(string input) { var letKeyword = new Word("let").Parse(input); var sp1 = new SkipWhitespace().Parse(letKeyword.Item2); var typeName = new TypeName().Parse(sp1.Item2); var sp2 = new SkipWhitespace().Parse(typeName.Item2); var name = new Ident().Parse(sp2.Item2); var sp3 = new SkipWhitespace().Parse(name.Item2); var assignment = new Maybe( new Create(TokenType.Assignment) { new SkipWhitespace(), new Char('='), new SkipWhitespace(), new Expr() } ).Parse(sp3.Item2); var decl = letKeyword.Item1 + typeName.Item1 + name.Item1; if (assignment.Item1.type != TokenType.Failure) { decl += assignment.Item1; } decl.type = TokenType.Declaration; return(decl, assignment.Item2); }
public static List <TechnicianRequirement> TestGetTourOfTechnician(Ident ident, int mandatorId, ID technicianID, DateTime date, VueTOView.Common.Environment environment) { List <TechnicianRequirement> list = new List <TechnicianRequirement>(); List <TechnicianRequirement> tours = new List <TechnicianRequirement>(); WebToolExtendedServiceClient client = ClientProvider.ProvideTOClient(environment); Task <ServiceReference2.ResultListOfAppointmentuukIAVwv> task = client.GetTourOfTechnicianAsync(ident, mandatorId, technicianID, date, null); ResultListOfAppointmentuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.DataList != null) && (result.DataList.Length > 0)) { List <Appointment> appointments = result.DataList.Where(x => x.State != ActivationState.Deleted).ToList(); foreach (Appointment appointment in appointments) { List <TechnicianRequirement> appointmenttours = appointment.TechnicianRequirements.Where(y => y.TechnicianID.SourceId == technicianID.SourceId && y.State != ActivationState.Deleted).ToList(); foreach (TechnicianRequirement tour in appointmenttours) { tour.Appointment = appointment; tour.Appointment.GeoLocation = TestGetGeoLocation(client, ident, mandatorId, tour.Appointment.GeoLocationID); if (tour.Appointment.GeoLocation != null) { tours.Add(tour); } } } list = tours.OrderBy(x => x.RealStart).ToList(); } return(list); }
public void Visit(Ident node) { if (node.name == "self") { node.computedType = currentType; return; } if ((node.computedType = currentContext.GetTypeFor(node.name)) != null) { return; } else { var attr = currentType.GetAttribute(node.name); if (attr != null) { node.computedType = attr.Type; } else { node.computedType = Context.GetType("Void"); errorLog.LogError(string.Format(VariableNotExist, node.Line, node.name)); } } }
public void TestCommutative() { var seq = new KSEQReplicatedList <string>("alice"); seq.Add("test"); Assert.AreEqual(1, seq.Count); var ident = new Ident(1, new[] { new Segment(0, "bob") }); var op1 = new KSEQOperation <string>() { id = ident, op = KSEQOperationTypes.Insert, realTime = DateTime.UtcNow.Ticks, replicaId = "bob", value = "hello" }; var op2 = new KSEQOperation <string>() { id = ident, op = KSEQOperationTypes.Remove, realTime = DateTime.UtcNow.Ticks, replicaId = "bob" }; seq.Apply(op2); Assert.AreEqual(1, seq.Count); seq.Apply(op1); Assert.AreEqual(1, seq.Count); }
public async void TestRefreshAndAccessTokens() { var org = await this.fixture.Ident.CreateOrganization(new Organization { Name = "test organization" }); var accessRefreshToken = await this.fixture.Ident.CreateToken(new JWTToken { Scope = "offline_access", OrganizationId = org.Id }); Assert.NotNull(accessRefreshToken.AccessToken); Assert.NotNull(accessRefreshToken.RefreshToken); Assert.NotNull(accessRefreshToken.ExpiresIn); Assert.Equal("offline_access", accessRefreshToken.Scope); var accessTokenIdent = Ident.InitIdent(accessRefreshToken.RefreshToken); var accessToken = await accessTokenIdent.CreateToken(new JWTToken { GrantType = "refresh_token" }); Assert.NotNull(accessToken.AccessToken); Assert.NotNull(accessToken.ExpiresIn); }
public void ValidateIdent_ShouldReturnFalse(string input) { ILexicalRules identValidator = new Ident(); bool result = identValidator.validate(input); Assert.False(result); }
public static int Main(string[] args) { // Create scanner that reads from standard input Scanner scanner = new Scanner(Console.In); if (args.Length > 1 || (args.Length == 1 && ! args[0].Equals("-d"))) { Console.Error.WriteLine("Usage: mono SPP [-d]"); return 1; } // If command line option -d is provided, debug the scanner. if (args.Length == 1 && args[0].Equals("-d")) { // Console.Write("Scheme 4101> "); Token tok = scanner.getNextToken(); while (tok != null) { TokenType tt = tok.getType(); Console.Write(tt); if (tt == TokenType.INT) Console.WriteLine(", intVal = " + tok.getIntVal()); else if (tt == TokenType.STRING) Console.WriteLine(", stringVal = " + tok.getStringVal()); else if (tt == TokenType.IDENT) Console.WriteLine(", name = " + tok.getName()); else Console.WriteLine(); // Console.Write("Scheme 4101> "); tok = scanner.getNextToken(); } return 0; } // Create parser TreeBuilder builder = new TreeBuilder(); Parser parser = new Parser(scanner, builder); Node root; // TODO: Create and populate the built-in environment and // create the top-level environment var env = new Tree.Environment(); // create built in environment for scheme functions var id = new Ident("car"); // TODO: create lines for definitions of built in functions from first page of docs id = new Ident("b+"); env.define(id, new BuiltIn(id)); // populates environment--puts car into built in environment--define manages tree for you env = new Tree.Environment(env); // root = (Node) parser.parseExp(); while (root != null) { root.print(0); root = (Node) parser.parseExp(); } return 0; }
private static void setIdentAndAssignedFrom(Env <Spec> env, Ident ident, Spec spec) { env.Set(ident, spec); foreach (var af in ident.DeclareBy.AssignedFrom) { env.Set(af, spec); } }
public VertexDeclaration GetDeclaration <T>() { int index = Ident.TypeIndex <T>(); while (index > _declarations.Length) { Array.Resize(ref _declarations, _declarations.Length * 2); } if (_declarations[index] != null) { return(_declarations[index]); } VertexElement[] elements = GetDeclaration(typeof(T)); if (_context == null) { return(null); } VertexDeclaration declaration; lock (_hashingDecl) { _hashingDecl.SetFrom(typeof(T), _typeHash, ref _typeIndex); if (_declarationHash.TryGetValue(_hashingDecl, out declaration)) { _declarations[index] = declaration; return(declaration); } } for (int i = 0; i < elements.Length; i++) { ValidateFormat(typeof(T), elements[i].Type); } ElementHash ehash = new ElementHash(elements); _elementHash.TryGetValue(ehash, out declaration); if (declaration == null) { declaration = new VertexDeclaration(_context, elements); } _declarations[index] = declaration; _declarationHash.Add(new DeclarationHash(typeof(T), _typeHash, ref _typeIndex), declaration); if (_elementHash.ContainsKey(ehash) == false) { _elementHash.Add(ehash, declaration); } return(declaration); }
/// <summary> /// Creates a new deep neural network based on the supplied inputs and layers. /// </summary> /// <param name="d">Descriptor object.</param> /// <param name="X">Training examples</param> /// <param name="y">Training labels</param> /// <param name="activationFunction">Activation Function for each output layer.</param> /// <param name="outputFunction">Ouput Function for each output layer.</param> /// <param name="hiddenLayers">The intermediary (hidden) layers / ensembles in the network.</param> /// <returns>A Deep Neural Network</returns> public static Network Create(this Network network, Descriptor d, Matrix X, Vector y, IFunction activationFunction, IFunction outputFunction = null, params NetworkLayer[] hiddenLayers) { // set output to number of choices of available // 1 if only two choices int distinct = y.Distinct().Count(); int output = distinct > 2 ? distinct : 1; // identity function for bias nodes IFunction ident = new Ident(); // creating input nodes network.In = new Neuron[X.Cols + 1]; network.In[0] = new Neuron { Label = "B0", ActivationFunction = ident }; for (int i = 1; i < X.Cols + 1; i++) { network.In[i] = new Neuron { Label = d.ColumnAt(i - 1), ActivationFunction = ident } } ; // creating output nodes network.Out = new Neuron[output]; for (int i = 0; i < output; i++) { network.Out[i] = new Neuron { Label = Network.GetLabel(i, d), ActivationFunction = activationFunction, OutputFunction = outputFunction } } ; for (int layer = 0; layer < hiddenLayers.Count(); layer++) { if (layer == 0 && hiddenLayers[layer].IsAutoencoder) { // init and train it. } // connect input with previous layer or input layer // connect last layer with output layer } // link input to hidden. Note: there are // no inputs to the hidden bias node //for (int i = 1; i < h.Length; i++) // for (int j = 0; j < nn.In.Length; j++) // Edge.Create(nn.In[j], h[i]); //// link from hidden to output (full) //for (int i = 0; i < nn.Out.Length; i++) // for (int j = 0; j < h.Length; j++) // Edge.Create(h[j], nn.Out[i]); return(network); }
public static IPacket Make(Ident id, byte[] data) { switch (id) { case Ident.BasicInformation: return(new BasicInformation(data)); } return(null); }
/// <summary>Defaults.</summary> /// <param name="network">The network.</param> /// <param name="d">The Descriptor to process.</param> /// <param name="x">The Vector to process.</param> /// <param name="y">The Vector to process.</param> /// <param name="activationFunction">The activation.</param> /// <param name="outputFunction">The ouput function for hidden nodes (Optional).</param> /// <param name="epsilon">epsilon</param> /// <returns>A Network.</returns> public static Network Create( this Network network, Descriptor d, Matrix x, Vector y, IFunction activationFunction, IFunction outputFunction = null, double epsilon = double.NaN) { // set output to number of choices of available // 1 if only two choices var distinct = y.Distinct().Count(); var output = distinct > 2 ? distinct : 1; // identity funciton for bias nodes IFunction ident = new Ident(); // set number of hidden units to (Input + Hidden) * 2/3 as basic best guess. var hidden = (int)System.Math.Ceiling((x.Cols + output) * 2.0 / 3.0); return(network.Create( x.Cols, output, activationFunction, outputFunction, fnNodeInitializer: (l, i) => { if (l == 0) { return new Neuron(false) { Label = d.ColumnAt(i - 1), ActivationFunction = activationFunction, NodeId = i, LayerId = l } } ; if (l == 2) { return new Neuron(false) { Label = Network.GetLabel(i, d), ActivationFunction = activationFunction, NodeId = i, LayerId = l } } ; return new Neuron(false) { ActivationFunction = activationFunction, NodeId = i, LayerId = l }; }, hiddenLayers: hidden)); }
/// <summary> /// Instantiates a new Autoencoder Generator object. /// </summary> public AutoencoderGenerator() { Density = -1; Sparsity = 0.2; SparsityWeight = 1.0; LearningRate = 0.01; Epsilon = double.NaN; Activation = new SteepLogistic(); OutputFunction = new Ident(); NormalizeFeatures = false; }
/// <summary> /// Initializes a new Network Layer. A network layer is sub neural network made up of inputs, hidden layer(s) and an /// output layer. /// </summary> /// <param name="inputNodes">Number of Nodes at the input layer (includes bias Node).</param> /// <param name="outputNodes">Number of Nodes at the output layer.</param> /// <param name="isFullyConnected"> /// Indicates whether the output layer of this network is fully connected with the next /// Network Layer / Network. /// </param> /// <param name="hiddenLayers"> /// Number of Nodes in each layer and the number of layers, where the array length is the number of /// layers and each value is the number of Nodes in that layer. /// </param> /// <param name="fnNodeInitializer"> /// Function for creating a new Node at each layer (zero-based) and Node index /// (zero-based). The 0 index layer corresponds to the input layer. /// </param> /// <param name="isAutoencoder">Determines whether this Network layer is an auto-encoding layer.</param> /// <param name="layerConnections"> /// (Optional) Connection properties for this Network where the first dimension is the layer, second the Node index in /// that layer, /// and third the Node indexes in the next layer to pair with. /// <para>For example: 1 => 2 => [2, 3] will link Node 2 in layer 1 to Nodes 2 + 3 in layer 2.</para> /// </param> /// <param name="createBiasNodes"> /// (Optional) Indicates whether bias nodes are automatically created (thus bypassing the /// <paramref name="fnNodeInitializer" /> function). /// </param> /// <param name="linkBiasNodes"> /// (Optional) Indicates whether bias nodes in hidden layers are automatically linked to their respective hidden nodes. /// <para> /// If this is set to True, it will override any bias node connections specified in parameter /// <paramref name="layerConnections" /> /// </para> /// </param> public NetworkLayer( int inputNodes, int outputNodes, bool isFullyConnected, int[] hiddenLayers, Func <int, int, Neuron> fnNodeInitializer, bool isAutoencoder = false, int[][][] layerConnections = null, bool createBiasNodes = true, bool linkBiasNodes = true) { IsFullyConnected = isFullyConnected; IsAutoencoder = isAutoencoder; if (!IsFullyConnected && (layerConnections == null || layerConnections.Length != 2 + hiddenLayers.Length)) { throw new ArgumentException( "Connections must be supplied when the output layer is not fully connected with the next Network Layer.", nameof(layerConnections)); } IFunction ident = new Ident(); In = new Neuron[inputNodes]; In[0] = new Neuron { Label = "B0", ActivationFunction = ident }; // create input nodes for (var i = 1; i < In.Length; i++) { In[i] = fnNodeInitializer(0, i); } // create hidden layers var hiddenNodes = new Neuron[hiddenLayers.Length][]; for (var hiddenLayer = 0; hiddenLayer < hiddenLayers.Count(); hiddenLayer++) { hiddenNodes[hiddenLayer] = new Neuron[hiddenLayers[hiddenLayer]]; for (var h = 0; h < hiddenLayers[hiddenLayer]; h++) { if (h == 0) { if (createBiasNodes) { hiddenNodes[hiddenLayer][0] = new Neuron { Label = $"B{hiddenLayer + 1}", ActivationFunction = ident } } } } ;
/// <summary> /// public constructor /// Creates or opens the *.db /// May create missing tables /// Uses the Cpu1 id for encryption /// </summary> internal ManastoneDatabase() { // _con = new SqliteConnector("Manastone.db"); //DEBUG _con = new SqliteConnector("Manastone.db", Ident.GetCPUId()); Log = new FnLog.FnLog(new FnLog.FnLog.FnLogInitPackage("https://app.fearvel.de:9020/", "MANASTONE", Version.Parse(ManastoneClient.ClientVersion), FnLog.FnLog.TelemetryType.LogLocalSendAll, "", ""), _con); CreateTables(); LoadLicenseInformation(); Log.AddToLogList(FnLog.FnLog.LogType.DrmDatabaseLog, "Manastone DB INIT Complete", ""); }
public (Token, string) Parse(string input) { var varName = new Ident().Parse(input); var sp1 = new SkipWhitespace().Parse(varName.Item2); var equ = new Char('=').Parse(sp1.Item2); var sp2 = new SkipWhitespace().Parse(equ.Item2); var expr = new Expr().Parse(sp2.Item2); var assignment = varName.Item1 + equ.Item1 + expr.Item1; return(assignment, expr.Item2); }
private Ident ParseIdent() { if (type != TokenType.Ident && type != TokenType.Op) { return(null); } markStart(); var i = new Ident(text, type); next(); return(post(i)); }
/// <summary> /// The write references. /// </summary> /// <remarks></remarks> public void WriteReferences() { BinaryWriter BW = new BinaryWriter(this.MS); for (int xx = 0; xx < this.items.Count; xx++) { Item i = this.items[xx]; if (i.intag != this.TagIndex) { continue; } switch (i.type) { case ItemType.Reflexive: Reflexive reflex = (Reflexive)i; int newreflex = this.offset + reflex.translation + this.magic; if (reflex.pointstoTagIndex != this.TagIndex) { newreflex = this.Map.MetaInfo.Offset[reflex.pointstoTagIndex] + reflex.translation + this.magic; } BW.BaseStream.Position = reflex.offset; BW.Write(reflex.chunkcount); BW.Write(newreflex); break; case ItemType.Ident: Ident id = (Ident)i; BW.BaseStream.Position = id.offset; BW.Write(id.ident); break; case ItemType.String: String ss = (String)i; byte bleh = 0; BW.BaseStream.Position = ss.offset; BW.Write((short)ss.id); BW.Write(bleh); BW.Write((byte)ss.name.Length); break; default: MessageBox.Show(i.type.ToString()); break; } } }
public async Task CreateTestInstance() { await this.CreateUser(); var authResponse = await Ident.Authenticate( new Auth { Email = this.User.Email, Password = TestUserPwd, } ); this.Ident = Ident.InitIdent(authResponse.Token.Token); }
public static async Task <Vault> InitVaultWithOrgToken() { var token = await TestUtil.CreateIdentForTestUser(); var ident = Ident.InitIdent(token); var org = await ident.CreateOrganization(new Organization { Name = "test org" }); var orgToken = await ident.CreateToken(new JWTToken { OrganizationId = org.Id }); return(Vault.InitVault(orgToken.Token)); }
private static Ident LoginFromService(LoginRequest loginRequest) { Ident ident = null; AuthorizerInternalClient client = ClientProvider.ProvideAuthClient(loginRequest.Environment); Task <ServiceReference1.ResultOfIdentvcrQC78O> task = client.LoginAsync(loginRequest.Loginname, loginRequest.Password); ResultOfIdentvcrQC78O result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.Data != null)) { ident = result.Data as Ident; } return(ident); }
public static Ident TestLogin(string loginname, string password, VueTOView.Common.Environment environment) { Ident ident = null; AuthorizerInternalClient client = ClientProvider.ProvideAuthClient(environment); Task <ServiceReference1.ResultOfIdentvcrQC78O> task = client.LoginAsync(loginname, password); ResultOfIdentvcrQC78O result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.Data != null)) { ident = result.Data as Ident; } return(ident); }
public void GetGroupObjectList(int sceneId, int groupId, Ident objId) { ReqGroupObjectList xData = new ReqGroupObjectList { id = objId, sceneid = sceneId, groupid = groupId }; MemoryStream stream = new MemoryStream(); Serializer.Serialize(stream, xData); NetLogic.Instance().SendToServerByPb(EGameMsgID.EGMI_REQ_GET_OBJECT_LIST, stream); }
public void Dispose() { if (Host == null) { return; } Host.Dispose(); Host = null; Ident.Dispose(); Ident = null; Name.Dispose(); Name = null; }
/// <summary> /// The load ent controls. /// </summary> /// <param name="entArray">The ent array.</param> /// <remarks></remarks> private void LoadENTControls(object[] entArray) { this.selectedTagType = map.SelectedMeta.type; this.toolStripTagType.Text = "[" + this.selectedTagType + "]"; this.toolStripTagName.Text = map.SelectedMeta.name; // this.Padding = new Padding(10); int colorSpaceCount = 4; // Custom Plugins access //ra = new RegistryAccess( // Registry.CurrentUser, // RegistryAccess.RegPaths.Halo2CustomPlugins + pluginName + "\\" + this.selectedTagType); //if (pluginName == null) //{ // ra.CloseReg(); //} if (entArray != null) foreach (object o in entArray) { IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o; if (tempbase.visible == false) { if (ShowInvisibles == false) { continue; } } // skip hidden custom plugins variables (mark reflexives to be removed if empty) bool skipEmptyReflex = false; //if (ra.isOpen && ra.getValue(tempbase.offset.ToString()) == bool.FalseString) //{ // if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct) // { // skipEmptyReflex = true; // } // else // { // continue; // } //} switch (tempbase.ObjectType) { case IFPIO.ObjectEnum.Struct: { if (ShowReflexives == false) { break; } // tempLabel is a blank space located above reflexives Label tempLabel = new Label(); tempLabel.AutoSize = true; tempLabel.Location = new Point(0, 0); tempLabel.Name = "label1"; tempLabel.Dock = DockStyle.Top; tempLabel.Size = new Size(35, 13); tempLabel.TabIndex = tabIndex; // tempReflexive is the reflexive and all data (incl other reflexives) within it ReflexiveControl tempReflexive = new ReflexiveControl( map, map.SelectedMeta.offset, ((IFPIO.Reflexive)tempbase).HasCount, tempbase.lineNumber, this); // tempReflexive.Location = new System.Drawing.Point(10, 0); tempReflexive.Name = "reflexive"; tempReflexive.TabIndex = tabIndex; tempReflexive.LoadENTControls( (IFPIO.Reflexive)tempbase, ((IFPIO.Reflexive)tempbase).items, true, 0, ref tabIndex, tempbase.offset.ToString()); // Label, Combobox & Button are always added ( = 3) if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex)) { this.Controls[0].Controls.Add(tempLabel); tempLabel.BringToFront(); this.Controls[0].Controls.Add(tempReflexive); tempReflexive.BringToFront(); } break; } case IFPIO.ObjectEnum.Ident: { if (ShowIdents == false) { break; } Ident tempident = new Ident( tempbase.name, map, tempbase.offset, ((IFPIO.Ident)tempbase).hasTagType, tempbase.lineNumber); tempident.Name = "ident"; tempident.TabIndex = tabIndex; tempident.Populate(map.SelectedMeta.offset); tempident.Tag = "[" + tempident.Controls[2].Text + "] " + tempident.Controls[1].Text; tempident.Controls[1].ContextMenuStrip = identContext; this.Controls[0].Controls.Add(tempident); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.StringID: { if (ShowSIDs == false) { break; } SID tempSID = new SID(tempbase.name, map, tempbase.offset, tempbase.lineNumber); tempSID.Name = "sid"; tempSID.TabIndex = tabIndex; tempSID.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempSID); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Float: { if (ShowFloats == false) { break; } DataValues tempFloat = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber); tempFloat.TabIndex = tabIndex; tempFloat.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempFloat); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.String32: { if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) { break; } EntStrings tempstring = new EntStrings( tempbase.name, map, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.UnicodeString256: { if (ShowUnicodeString256s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String256: { if (ShowString256s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.UnicodeString64: { if (ShowUnicodeString64s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String: { if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) { break; } EntStrings tempstring = new EntStrings( tempbase.name, map, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Int: { if (((IFPIO.IFPInt)tempbase).entIndex.nulled) { if ((ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) || (ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) || (ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) || (ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) { break; } DataValues tempdatavalues = new DataValues( tempbase.name, map, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber); tempdatavalues.TabIndex = tabIndex; tempdatavalues.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if ((ShowBlockIndex32s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Int | tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) || (ShowBlockIndex16s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Short | tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) || (ShowBlockIndex8s == false && tempbase.ObjectType == IFPIO.ObjectEnum.Byte)) { break; } Indices tempdatavalues = new Indices( tempbase.name, map, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPInt)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Short: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UShort: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UInt: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.Unknown: { if (ShowUndefineds == false) { break; } DataValues tempUnknown = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte_Flags: { if (ShowBitmask8s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Word_Flags: { if (ShowBitmask16s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Flags: { if (ShowBitmask32s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Char_Enum: { if (ShowEnum8s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Enum: { if (ShowEnum16s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Enum: { if (ShowEnum32s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte: { if (((IFPIO.IFPByte)tempbase).entIndex.nulled) { if (ShowBytes == false) { break; } DataValues tempByte = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber); tempByte.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempByte); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if (ShowBlockIndex8s == false) { break; } Indices tempdatavalues = new Indices( tempbase.name, map, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPByte)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Unused: { DataValues tempUnknown = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.TagType: continue; } if (!(tempbase is IFPIO.Reflexive)) { ToolTip1.SetToolTip(this.Controls[0].Controls[0].Controls[0], "offset: " + tempbase.offset); } if (this.Controls[0].Controls.Count > 0 && this.Controls[0].Controls[0] is DataValues) { // if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) || // tempbase.name.ToLower().Contains("alpha"))& alphaControl == null) if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha")) { alphaControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" r") & redControl == null) else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red")) { redControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" g") & greenControl == null) else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green")) { greenControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" b") & blueControl == null) else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue")) { blueControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } else { colorSpaceCount++; if (colorSpaceCount == 1) { alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } if (redControl != null & greenControl != null & blueControl != null) { // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. ColorWheel cw = new ColorWheel(); if (alphaControl != null) { cw.setTextBox(alphaControl.textBox1, Color.White); } cw.setTextBox(redControl.textBox1, Color.Red); cw.setTextBox(greenControl.textBox1, Color.Green); cw.setTextBox(blueControl.textBox1, Color.Blue); // p.I.AddRange(new Rectangle[] { SelectedColorRectangle }); cw.Dock = DockStyle.Top; this.Controls[0].Controls.Add(cw); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); // Reset for next batch colorSpaceCount++; alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } else { colorSpaceCount++; } tabIndex++; } //ra.CloseReg(); }
/// <summary> /// Load meta from an XML file. /// </summary> /// <param name="inputFileName">The XML file name.</param> /// <remarks></remarks> public void LoadMetaFromFile(string inputFileName) { // write memorysteam of meta to file FileStream FS = new FileStream(inputFileName, FileMode.Open); BinaryReader BR = new BinaryReader(FS); this.size = (int)FS.Length; this.MS = new MemoryStream(this.size); BR.BaseStream.Position = 0; this.MS.Write(BR.ReadBytes(this.size), 0, this.size); BR.Close(); FS.Close(); // write idents,strings,reflexives XmlTextReader xtr = new XmlTextReader(inputFileName + ".xml"); xtr.WhitespaceHandling = WhitespaceHandling.None; while (xtr.Read()) { // MessageBox.Show(xtr.Name); switch (xtr.NodeType) { case XmlNodeType.Element: if (xtr.Name == "Meta") { this.type = xtr.GetAttribute("TagType"); this.name = xtr.GetAttribute("TagName"); this.parsed = xtr.GetAttribute("Parsed") == "True" ? true : false; this.size = Convert.ToInt32(xtr.GetAttribute("Size")); this.magic = Convert.ToInt32(xtr.GetAttribute("Magic")); this.padding = Convert.ToChar(xtr.GetAttribute("Padding")); this.offset = Convert.ToInt32(xtr.GetAttribute("Offset")); } else if (xtr.Name == "Reflexive") { Reflexive r = new Reflexive(); r.description = xtr.GetAttribute("Description"); r.offset = Convert.ToInt32(xtr.GetAttribute("Offset")); r.chunkcount = Convert.ToInt32(xtr.GetAttribute("ChunkCount")); r.chunksize = Convert.ToInt32(xtr.GetAttribute("ChunkSize")); r.translation = Convert.ToInt32(xtr.GetAttribute("Translation")); r.pointstotagtype = xtr.GetAttribute("PointsToTagType"); r.pointstotagname = xtr.GetAttribute("PointsToTagName"); r.pointstoTagIndex = Map.Functions.ForMeta.FindByNameAndTagType( r.pointstotagtype, r.pointstotagname); r.intagtype = xtr.GetAttribute("TagType"); r.intagname = xtr.GetAttribute("TagName"); r.intag = Map.Functions.ForMeta.FindByNameAndTagType(r.intagtype, r.intagname); this.items.Add(r); } else if (xtr.Name == "Ident") { Ident id = new Ident(); id.description = xtr.GetAttribute("Description"); id.offset = Convert.ToInt32(xtr.GetAttribute("Offset")); id.pointstotagtype = xtr.GetAttribute("PointsToTagType"); id.pointstotagname = xtr.GetAttribute("PointsToTagName"); id.pointstoTagIndex = Map.Functions.ForMeta.FindByNameAndTagType( id.pointstotagtype, id.pointstotagname); id.intagtype = xtr.GetAttribute("TagType"); id.intagname = xtr.GetAttribute("TagName"); id.intag = Map.Functions.ForMeta.FindByNameAndTagType(id.intagtype, id.intagname); this.items.Add(id); } else if (xtr.Name == "String") { String s = new String(); s.description = xtr.GetAttribute("Description"); s.offset = Convert.ToInt32(xtr.GetAttribute("Offset")); s.name = xtr.GetAttribute("StringName"); s.intagtype = xtr.GetAttribute("TagType"); s.intagname = xtr.GetAttribute("TagName"); s.intag = Map.Functions.ForMeta.FindByNameAndTagType(s.intagtype, s.intagname); this.items.Add(s); } break; default: break; } } xtr.Close(); // ///check for raw this.rawType = Map.Functions.ForMeta.CheckForRaw(this.type); if (this.rawType != RawDataContainerType.Empty) { this.raw = new RawDataContainer(); this.raw = this.raw.LoadRawFromFile(inputFileName, this); } }
//v_ident : 0 : usine, 1 : change sens (v_nbrPas -> sens), 2 : arret sur Z, 3 : Pas à Pas public c_InfoCode(Ident ident, int pasX, int pasY, int nextX, int nextY, bool accel, bool deccel, int posZ) { //pour usiner ligne sur seult X ou Y v_ident = ident; v_nbrPasX = pasX; v_nbrPasY = pasY; v_nextX = nextX; v_nextY = nextY; v_acceleration = accel; v_deceleration = deccel; v_posZ = posZ; }
public c_InfoCode(Ident ident, List<byte> liste, int nextX, int nextY, bool accel, bool deccel, int posZ) { //pour usiner ligne en X et Y v_ident = ident; v_liste = liste; v_nextX = nextX; v_nextY = nextY; v_acceleration = accel; v_deceleration = deccel; v_posZ = posZ; }
public c_InfoCode(Ident ident, int posZ, bool AvancerLigneTraduite) { //arret sur Z v_ident = ident; v_posZ = posZ; v_avancerLigneTraduite = AvancerLigneTraduite; }
public c_InfoCode(Ident ident) { //pour stop, fin bloc, Sans avance ligne traduite v_ident = ident; }
public c_InfoCode(Ident ident, double diam) { //pour diamètre Outil v_ident = ident; v_diamOutil = diam; }
/// <summary> /// The button 1_ click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void button1_Click(object sender, EventArgs e) { ControlSwapper parent = (ControlSwapper)this.Parent.Parent.Parent; // Add selected control IFPIO.Option[] options = null; //int strLength = 0; Control con = null; switch (((dataTypeStruct)comboBox1.SelectedItem).name.ToLower()) { /* parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Byte, parent.lineNum)); parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Short, parent.lineNum)); parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Int, parent.lineNum)); parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Float, parent.lineNum)); */ case "byte": case "short": case "ushort": case "int": case "uint": case "float": case "unknown": case "unused": con = new DataValues( parent.name, null, parent.chunkoffset, (IFPIO.ObjectEnum) Enum.Parse(typeof(IFPIO.ObjectEnum), ((dataTypeStruct)comboBox1.SelectedItem).name, true), parent.lineNum); break; case "char_enum": case "enum": case "long_enum": options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3]; // Size * 8 bits for (int x = 0; x < options.Length; x++) { options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum); } if (parent.splitContainer1.Panel1.Controls[0] is Bitmask) { Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0]; foreach (IFPIO.Option o in b.Options) { if (o.value < options.Length) { options[o.value].name = o.name; } } } ; if (parent.splitContainer1.Panel1.Controls[0] is Enums) { Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0]; foreach (IFPIO.Option o in en.Options) { if (o.value < options.Length) { options[o.value].name = o.name; } } } ; con = new Enums(parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum); break; case "byte_flags": case "word_flags": case "long_flags": options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3]; // Size * 8 bits for (int x = 0; x < options.Length; x++) { options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum); } if (parent.splitContainer1.Panel1.Controls[0] is Bitmask) { Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0]; foreach (IFPIO.Option o in b.Options) { options[o.value].name = o.name; } } ; if (parent.splitContainer1.Panel1.Controls[0] is Enums) { Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0]; foreach (IFPIO.Option o in en.Options) { options[o.value].name = o.name; } } ; con = new Bitmask( parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum); break; case "stringid": con = new SID(parent.name, null, parent.chunkoffset, parent.lineNum); break; case "string": con = new EntStrings( parent.name, null, parent.chunkoffset, ((dataTypeStruct)comboBox1.SelectedItem).size, false, parent.lineNum); break; case "unicodestring": con = new EntStrings( parent.name, null, parent.chunkoffset, ((dataTypeStruct)comboBox1.SelectedItem).size, true, parent.lineNum); break; case "block": con = new TagBlock(parent.name, null, parent.chunkoffset, parent.lineNum); break; case "ident": con = new Ident(parent.name, null, parent.chunkoffset, true, parent.lineNum); break; case "struct": // Unhandled //int ifkdn = 0; break; default: { return; } } Button but = new Button(); but.Dock = DockStyle.Right; but.Size = new Size(30, 30); but.Text = "-"; but.Click += but_Click; if (con != null) { con.Controls.Add(but); // con.Enabled = false; con.Dock = DockStyle.Top; Point loc = con.Controls[con.Controls.Count - 2].Location; loc.X -= 50; con.Controls[con.Controls.Count - 2].Location = loc; // con.TabIndex--; parent.splitContainer1.Panel2.Controls.Add(con); con.BringToFront(); ((ControlSwapper)this.TopLevelControl).newControlSize += ((ControlSwapper)this.TopLevelControl).getSizeOf(((dataTypeStruct)comboBox1.SelectedItem).name); if (((ControlSwapper)this.TopLevelControl).label1.Text.Contains(" :: ")) { ((ControlSwapper)this.TopLevelControl).label1.Text = ((ControlSwapper)this.TopLevelControl).label1.Text.Remove( ((ControlSwapper)this.TopLevelControl).label1.Text.IndexOf(" :: ")); } ((ControlSwapper)this.TopLevelControl).label1.Text += " :: New Control Size : " + ((ControlSwapper)this.TopLevelControl). newControlSize; } parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)]. BringToFront(); parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)].TabIndex++; }
public c_InfoCode(Ident ident, int vitesse) { v_ident = ident; v_modifVitesse = vitesse; }
public c_InfoCode(Ident ident, bool Lineaire, int distanceBloc) { //pour debut de bloc v_ident = ident; v_lineaire = Lineaire; v_distanceBloc = distanceBloc; }
void IDENT(out pBaseLangObject outObj, pBaseLangObject parent) { Expect(3); outObj = new Ident(parent, t.val, t.line, t.col); }
public static int Main(string[] args) { // Create scanner that reads from standard input Scanner scanner = new Scanner(Console.In); if (args.Length > 1 || (args.Length == 1 && ! args[0].Equals("-d"))) { Console.Error.WriteLine("Usage: mono SPP [-d]"); return 1; } // If command line option -d is provided, debug the scanner. if (args.Length == 1 && args[0].Equals("-d")) { // Console.Write("Scheme 4101> "); Token tok = scanner.getNextToken(); while (tok != null) { TokenType tt = tok.getType(); Console.Write(tt); if (tt == TokenType.INT) Console.WriteLine(", intVal = " + tok.getIntVal()); else if (tt == TokenType.STRING) Console.WriteLine(", stringVal = " + tok.getStringVal()); else if (tt == TokenType.IDENT) Console.WriteLine(", name = " + tok.getName()); else Console.WriteLine(); // Console.Write("Scheme 4101> "); tok = scanner.getNextToken(); } return 0; } // Create parser TreeBuilder builder = new TreeBuilder(); Parser parser = new Parser(scanner, builder); Node root = new Node(); // TODO: Create and populate the built-in environment and // create the top-level environment Tree.Environment env = new Tree.Environment(); Ident id = new Ident("b+"); env.define(id, new BuiltIn(id)); env = new Tree.Environment(env); Ident test = new Ident("xxxx"); IntLit test2 = new IntLit(3); env.define(test, test2); root = (Node) parser.parseExp(); while (root != null) { root.eval(env).print(0); root = (Node) parser.parseExp(); } // Read-eval-print loop // TODO: print prompt and evaluate the expression /* root = (Node) parser.parseExp(); while (root != null) { root.print(0); root = (Node) parser.parseExp(); } */ return 0; }
public static int Main(string[] args) { // Create scanner that reads from standard input Scanner scanner = new Scanner(Console.In); if (args.Length > 1 || (args.Length == 1 && ! args[0].Equals("-d"))) { Console.Error.WriteLine("Usage: mono SPP [-d]"); return 1; } // If command line option -d is provided, debug the scanner. if (args.Length == 1 && args[0].Equals("-d")) { // Console.Write("Scheme 4101> "); Token tok = scanner.getNextToken(); while (tok != null) { TokenType tt = tok.getType(); Console.Write(tt); if (tt == TokenType.INT) Console.WriteLine(", intVal = " + tok.getIntVal()); else if (tt == TokenType.STRING) Console.WriteLine(", stringVal = " + tok.getStringVal()); else if (tt == TokenType.IDENT) Console.WriteLine(", name = " + tok.getName()); else Console.WriteLine(); // Console.Write("Scheme 4101> "); tok = scanner.getNextToken(); } return 0; } // Create parser TreeBuilder builder = new TreeBuilder(); Parser parser = new Parser(scanner, builder); Node root; Tree.Environment env = new Tree.Environment(); // create built-in environment //Populate the builtin environment Ident id; string[] builtins = new string[] {"symbol?","number?","b+","b-","b*","b/","b=","b<","car","cdr","cons","set-car!","set-cdr!","null?","pair?","eq?","procedure?","read","write","display","newline","eval","apply","interaction-environment" }; foreach(string function in builtins) { id = new Ident(function); env.define(id, new BuiltIn(id)); } env = new Tree.Environment(env); // create top-level environment // Read-eval-print loop // TODO: print prompt and evaluate the expression root = (Node) parser.parseExp(); while (root != null) { root.eval(env).print(0); root = (Node) parser.parseExp(); } return 0; }
public static NamespaceResolver createNSR(Ident ident, bool takeFirst = false) { return createNSR(ident.FullyQualifiedName, takeFirst); }
public c_InfoCode(Ident ident, char Axe, int pas, int sensX, int sensY) { //pour chgt sens v_ident = ident; v_Axe = Axe; v_nbrPas = pas; //v_paramPic = paramPic; v_sensX = sensX; v_sensY = sensY; }