コード例 #1
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
 public StaticReference(
     NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
     TypeInfo type
     ) : base(parentNodeIndices, statementIndex, nodeIndex)
 {
     Type = type;
 }
コード例 #2
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
            public Invocation(
                NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
                JSVariable thisVariable, JSMethod method, object nonJSMethod,
                Dictionary <string, ArraySegment <string> > variables
                ) : base(parentNodeIndices, statementIndex, nodeIndex)
            {
                if (thisVariable != null)
                {
                    ThisVariable = thisVariable.Identifier;
                }
                else
                {
                    ThisVariable = null;
                }

                ThisType = null;
                Method   = method;
                if (method == null)
                {
                    NonJSMethod = nonJSMethod;
                }
                else
                {
                    NonJSMethod = null;
                }
                Variables = variables;
            }
コード例 #3
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
            public Assignment(
                NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
                string target, JSExpression newValue,
                JSOperator @operator,
                TypeReference targetType, TypeReference sourceType
                ) : base(parentNodeIndices, statementIndex, nodeIndex)
            {
                Target   = target;
                NewValue = newValue;

                var newVariable = newValue as JSVariable;

                if (newVariable != null)
                {
                    SourceVariable = newVariable.Identifier;
                }
                else
                {
                    SourceVariable = null;
                }

                SourceType   = sourceType;
                TargetType   = targetType;
                Operator     = @operator;
                IsConversion = !TypeUtil.TypesAreEqual(targetType, sourceType);
            }
コード例 #4
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
 public FieldAccess(
     NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
     JSField field, bool isRead
     ) : base(parentNodeIndices, statementIndex, nodeIndex)
 {
     Field  = field;
     IsRead = isRead;
 }
コード例 #5
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
 public SideEffect(
     NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
     string variable, string type
     ) : base(parentNodeIndices, statementIndex, nodeIndex)
 {
     Variable = variable;
     Type     = type;
 }
コード例 #6
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
 public Access(
     NodeIndices parentNodeIndices, int statementIndex, int nodeIndex,
     string source, bool isControlFlow
     ) : base(parentNodeIndices, statementIndex, nodeIndex)
 {
     Source        = source;
     IsControlFlow = isControlFlow;
 }
コード例 #7
0
ファイル: SymbolTable.cs プロジェクト: rzikm/NextGenSpice
        /// <summary>Tries to get node index corresponding to given node name. Returns true on success.</summary>
        /// <param name="name">Name of the node.</param>
        /// <param name="index">Index of the node.</param>
        /// <returns></returns>
        public bool TryGetNodeIndex(string name, out int index)
        {
            index = 0;
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new InvalidEnumArgumentException($"Parameter {nameof(name)} must be nonempty.");
            }

            return(NodeIndices.TryGetValue(name, out index));
        }
コード例 #8
0
ファイル: render_model.cs プロジェクト: XeCREATURE/TagTool
            public NodeIndexGroup(CacheBase Cache, int Address)
            {
                EndianReader Reader = Cache.Reader;

                Reader.SeekTo(Address);

                int iCount  = Reader.ReadInt32();
                int iOffset = Reader.ReadInt32() - Cache.Magic;

                for (int i = 0; i < iCount; i++)
                {
                    NodeIndices.Add(new NodeIndex(Cache, iOffset + 1 * i));
                }
            }
コード例 #9
0
ファイル: SymbolTable.cs プロジェクト: rzikm/NextGenSpice
 /// <summary>Returns whether given symbol is already used for a device or node.</summary>
 /// <param name="symbol"></param>
 /// <returns></returns>
 private bool IsDefined(string symbol)
 {
     return(DefinedDevices.Contains(symbol) || NodeIndices.ContainsKey(symbol));
 }
コード例 #10
0
ファイル: SymbolTable.cs プロジェクト: rzikm/NextGenSpice
 /// <summary>Returns dictionary with mappings from node id to their respective names.</summary>
 /// <returns></returns>
 public IDictionary <int, string> GetNodeIdMappings()
 {
     return(NodeIndices.ToDictionary(kvp => kvp.Value, kvp => kvp.Key));
 }
コード例 #11
0
ファイル: SymbolTable.cs プロジェクト: rzikm/NextGenSpice
 /// <summary>Gives set of node names for given set of indexes</summary>
 /// <param name="indexes"></param>
 /// <returns></returns>
 public IEnumerable <string> GetNodeNames(IEnumerable <int> indexes)
 {
     return(indexes.Select(id => NodeIndices.First(kvp => kvp.Value == id).Key));
 }
コード例 #12
0
ファイル: StaticAnalyzer.cs プロジェクト: dzeitlin/JSIL
 public Item(NodeIndices parentNodeIndices, int statementIndex, int nodeIndex)
 {
     ParentNodeIndices = parentNodeIndices;
     StatementIndex    = statementIndex;
     NodeIndex         = nodeIndex;
 }
コード例 #13
0
        /// <summary>
        ///     Aktualisiert den Baumstring.
        /// </summary>
        /// <param name="pTree">Der Baumstring.</param>
        public void UpdateTree(string pTree)
        {
            Debug.WriteLine(pTree);
            lock (_updateTreeLock)
            {
                Reset(pTree);            // Listen neu init. und Positionszeiger des Baumstrings auf 0(Anfang) setzen.
                //+ --------------------------------
                Hash  = Next <string>(); // Hash auslesen
                Index = Next <int>();    // Hauptknotenindex auslesen
                //+ --------------------------------
                // Füge X NULL-Werte in die Listen hinzu. 'X' steht hierbei für den Wert der 'Index'-Variable. In 90aeq und kleiner sind es 20 (gewesen).
                // Die NULL-Werte sind nicht Sinnlos, sondern dienen für bestimmte Befehle.
                // Hier eine Auflistung der Befehle in 90aeq:
                // 0 = Byte auslesen
                // 1 = Boolean auslesen
                // 2 = Byte auslesen
                // 3 = Short auslesen
                // 4 = int auslesen
                // 5 = long auslesen
                // 6 = Float auslesen
                // 7 = Double auslesen
                // 8 = Char auslesen
                // 9 = UTF-String auslesen
                // 11 = Neue Liste
                // 12 = Ende der Liste
                // 13 = Verschlüsselter String?
                // Alles über oder gleich dem Wert der 'Index'-Variable = Node
                for (int i = 0; i < Index; i++)
                {
                    NodeNames.Add(null);
                    NodeIndices.Add(null);
                }
                //+ --------------------------------
                // Füge nun alle Knotennamen in die Liste hinzu.
                while (!IsEmpty())
                {
                    NodeNames.Add(Next <string>());
                }
                //+ --------------------------------
                // Manche Knoten haben nicht wie andere Werte oder andere Knoten gespeichert sondern bestimmte Werte.
                for (int i = Index; i < NodeNames.Count; i++)
                {
                    if (!NodeValues.ContainsKey(NodeNames[i]))
                    {
                        NodeValues.Add(NodeNames[i], i);
                    }
                }
                //+ --------------------------------
                // Fügt alle Indices eines Knotens in eine Liste hinzu.
                // Key = Knotenname
                // Value = Index
                // Die Indices geben die Unterknoten des Knotens zurück.

                #region " BEISPIEL "

                // Baum: 1337;20;PROTOCOL_HASH;;5;;:
                // KEY = PROTOCOL_HASH
                // VALUE = List<int>() { 5 };
                // 5 Gibt an das der Knoten ein Long zurückgibt. Siehe oben in der Befehlsliste.

                #endregion

                while (NodeIndices.Count < NodeNames.Count)
                {
                    var indices = new List <int>();
                    while (!IsEmpty())
                    {
                        indices.Add(Next <int>());
                    }
                    NodeIndices.Add(indices);
                }
                //+ --------------------------------
                // Springt zur Stelle an der ':' steht.
                Next <object>(':');
                //+ --------------------------------
                for (int i = Index; i < NodeIndices.Count; i++)
                {
                    List <int> indices = NodeIndices[i];
                    foreach (int t in indices)
                    {
                        if (t != 0)
                        {
                            continue;
                        }
                        var values = new Dictionary <string, int>();
                        for (int k = 0; !IsEmpty(); k++)
                        {
                            values.Add(Next <string>(), k);
                        }
                        NodeValues[NodeNames[i]] = values;
                    }
                }
            }
        }