// IsConstOrVar - Checkes whether a specified word is a constant or a variable // Input: Atom - the name of the atom // Output: Returns true if the specified word is a constant or a variable private bool IsConstOrVar(string Atom) { bool bConstOrVar = false; // Search constant name space for (int i = 0; i < GlobalConstants.Count; i++) { ForthConstant fc = (ForthConstant)GlobalConstants[i]; if (fc.Name.ToUpper() == Atom.ToUpper()) { bConstOrVar = true; } } // Search variable name space for (int i = 0; i < GlobalVariables.Count; i++) { ForthVariable fv = (ForthVariable)GlobalVariables[i]; if (fv.Name.ToUpper() == Atom.ToUpper()) { bConstOrVar = true; } } return(bConstOrVar); }
// GetConstIntValue - Retrieves the value of an integer constant (if found) // Input: ConstName - the name of the constant // Output: ConstValue - The integer value of the constant private bool GetConstIntValue(string ConstName, out int ConstValue) { bool ConstFound = false; ConstValue = 0; IEnumerator ConstEnum = GlobalConstants.GetEnumerator(); while (ConstEnum.MoveNext()) { ForthConstant fc = (ForthConstant)ConstEnum.Current; if ((fc.Name.ToLower() == ConstName.ToLower()) && (fc.Value.GetType() == typeof(int))) { ConstValue = (int)fc.Value; ConstFound = true; } } return(ConstFound); }