bool RecIntVar( void ) { //=================== if( !IsVariable() ) return( false ); return( _IsTypeInteger( CITNode->typ ) ); }
bool ReqDoVar( void ) { //================== if( IsVariable() ) { if( ( CITNode->typ >= FT_INTEGER_1 ) && ( CITNode->typ <= FT_EXTENDED ) ) { return( true ); } } Error( SX_NO_NUMBER_VAR ); return( false ); }
bool GetFloatVariable(char** sIn, const char* sTok, float* pfVal) { if (IsVariable(sIn, sTok)) { if (GetFloat(sIn, pfVal)) { return true; } } return false; }
bool GetBoolVariable(char** sIn, const char* sTok, bool* pbVal) { if (IsVariable(sIn, sTok)) { if (GetBool(sIn, pbVal)) { return true; } } return false; }
bool GetDWORDVariable(char** sIn, const char* sTok, unsigned long* pNum) { if (IsVariable(sIn, sTok)) { if (GetDWORD(sIn, pNum)) { return true; } } return false; }
bool GetLONGVariable(char** sIn, const char* sTok, long* pNum) { if (IsVariable(sIn, sTok)) { if (GetLONG(sIn, pNum)) { return true; } } return false; }
JBoolean SCCircuitVarList::SetValue ( const JIndex index, const JFloat value ) { if (IsVariable(index)) { VarInfo info = itsVars->GetElement(index); if (value != info.value) { info.value = value; itsVars->SetElement(index, info); Broadcast(VarValueChanged(index,1)); } return kJTrue; } else { return kJFalse; } }
void ProcessingDlg::CheckFilter( const wxString& OldBasePath, const wxStringStringMap& OldVars, const wxArrayString& OldCompilers, const LibraryDetectionConfig* Config, const LibraryDetectionConfigSet* Set, int WhichFilter) { if ( (int)Config->Filters.size() <= WhichFilter ) { FoundLibrary(OldBasePath,OldVars,OldCompilers,Config,Set); return; } const LibraryDetectionFilter& Filter = Config->Filters[WhichFilter]; switch ( Filter.Type ) { case LibraryDetectionFilter::File: { // Split path wxArrayString Pattern; SplitPath(Filter.Value,Pattern); // Fetch list of files with filename matching last pattern's element const wxArrayString& PathArray = Map[Pattern[Pattern.Count()-1]]; if ( PathArray.empty() ) return; // Process those files for ( size_t i=0; i<PathArray.Count(); i++ ) { wxArrayString Path; wxStringStringMap Vars = OldVars; SplitPath(PathArray[i],Path); int path_index = (int)Path.Count() - 1; int pattern_index = (int)Pattern.Count() - 1; // Check if patterns do match while ( ( path_index >= 0 ) && ( pattern_index >= 0 ) ) { wxString& PatternPart = Pattern[pattern_index]; if ( IsVariable(PatternPart) ) { wxString VarName = PatternPart.Mid(3,PatternPart.Len()-4); if ( Vars[VarName].empty() ) { Vars[VarName] = Path[path_index]; } else { if ( Vars[VarName] != Path[path_index] ) break; } } else { if ( PatternPart != Path[path_index] ) break; } path_index--; pattern_index--; } // This is when patterns did not match if ( pattern_index >= 0 ) continue; // Construct base path from the rest of file's name wxString BasePath; for ( int j=0; j<=path_index; j++ ) { BasePath += Path[j] + wxFileName::GetPathSeparator(); } // And check if base path match the previous one if ( !OldBasePath.IsEmpty() ) { if ( BasePath != OldBasePath ) continue; } // Ok, this filter matches, let's advance to next filet CheckFilter(BasePath,Vars,OldCompilers,Config,Set,WhichFilter+1); } break; } case LibraryDetectionFilter::Platform: { wxStringTokenizer Tokenizer(Filter.Value,_T("| \t")); bool IsPlatform = false; while ( Tokenizer.HasMoreTokens() ) { wxString Platform = Tokenizer.GetNextToken(); if ( platform::windows ) { if ( Platform==_T("win") || Platform==_T("windows") ) { IsPlatform = true; break; } } if ( platform::macosx ) { if ( Platform==_T("mac") || Platform==_T("macosx") ) { IsPlatform = true; break; } } if ( platform::linux ) { if ( Platform==_T("lin") || Platform==_T("linux") ) { IsPlatform = true; break; } } if ( platform::freebsd ) { if ( Platform==_T("bsd") || Platform==_T("freebsd") ) { IsPlatform = true; break; } } if ( platform::netbsd ) { if ( Platform==_T("bsd") || Platform==_T("netbsd") ) { IsPlatform = true; break; } } if ( platform::openbsd ) { if ( Platform==_T("bsd") || Platform==_T("openbsd") ) { IsPlatform = true; break; } } if ( platform::darwin ) { if ( Platform==_T("darwin") ) { IsPlatform = true; break; } } if ( platform::solaris ) { if ( Platform==_T("solaris") ) { IsPlatform = true; break; } } if ( platform::unix ) { if ( Platform==_T("unix") || Platform==_T("un*x") ) { IsPlatform = true; break; } } } if ( IsPlatform ) { CheckFilter(OldBasePath,OldVars,OldCompilers,Config,Set,WhichFilter+1); } break; } case LibraryDetectionFilter::Exec: { bool IsExec = false; if ( wxIsAbsolutePath(Filter.Value) ) { // If this is absolute path, we don't search in PATH evironment var IsExec = wxFileName::IsFileExecutable(Filter.Value); } else { // Let's search for the name in search paths wxString Path; if ( wxGetEnv(_T("PATH"),&Path) ) { wxString Splitter = _T(":"); if ( platform::windows ) Splitter = _T(";"); wxStringTokenizer Tokenizer(Path,Splitter); while ( Tokenizer.HasMoreTokens() ) { wxString OnePath = Tokenizer.GetNextToken(); // Let's skip relative paths (f.ex. ".") if ( !wxIsAbsolutePath(OnePath) ) continue; OnePath += wxFileName::GetPathSeparator()+Filter.Value; if ( wxFileName::IsFileExecutable(OnePath) ) { IsExec = true; break; } } } } if ( IsExec ) { CheckFilter(OldBasePath,OldVars,OldCompilers,Config,Set,WhichFilter+1); } break; } case LibraryDetectionFilter::PkgConfig: { if ( m_KnownResults[rtPkgConfig].IsShortCode(Filter.Value) ) { CheckFilter(OldBasePath,OldVars,OldCompilers,Config,Set,WhichFilter+1); } break; } case LibraryDetectionFilter::Compiler: { if ( OldCompilers.IsEmpty() ) { // If this is the first compiler filter, let's build new list and continue CheckFilter(OldBasePath,OldVars,wxStringTokenize(Filter.Value,_T("| \t")),Config,Set,WhichFilter+1); } else { // We've set compiler list before, leave only the intersection // of previous and current list wxArrayString Compilers; wxStringTokenizer Tokenizer(Filter.Value,_T("| \t")); while ( Tokenizer.HasMoreTokens() ) { wxString Comp = Tokenizer.GetNextToken(); if ( OldCompilers.Index(Comp) != wxNOT_FOUND ) { Compilers.Add(Comp); } } if ( !Compilers.IsEmpty() ) { CheckFilter(OldBasePath,OldVars,Compilers,Config,Set,WhichFilter+1); } } break; } case LibraryDetectionFilter::None: { CheckFilter(OldBasePath,OldVars,OldCompilers,Config,Set,WhichFilter+1); break; } } }
ScriptEventList::Var* ScriptToken::GetVar() const { return IsVariable() ? value.var : NULL; }
string Eval (const string& o_operation) { string operation = OperatorsToFunctionCalls (o_operation); //really redundant operation = StripWhitespaceBE (operation); operation = StripParens (operation); //auto operands = SeparateOperands (operation); operand count has to be one at this point list <string> operands = SeparateOperands (operation); if (operands.size() == 1) { // literal value if (IsNumericValue (operation)) return tostr (NumEval (operation)); //maybe return operation directly function_t fcode; string function_name = GetFunctionName(operation); //function if (IsFunctionCall (operation)) { SeparateArguments (StripB (function_name, operation)); return run_function (function_name, SeparateArguments (StripB (function_name, operation))); } // if // only one operand at this point, which is a variable if (IsVariable (operation)) return GetVariable (operands.front())-> Value (); // check for Literals // TODO: OperationType does so many unncessasry checks (for variables, waveforms, etc) // its better to figure out some way to skip those checks type_t optype = OperationType (operation); if (optype == TYPE_TEXT or optype == TYPE_NUM) return operation; // NaV: Not a value if (operation == "NaV") error ("operation did not return a valid value"); // Unknown object error ("object `" + operation + "' is unsupported."); } // if else { string result = ""; for (list<string>::iterator o = operands.begin(); o != operands.end(); o++) { if (IsOperator (*o)) { result += *o; } /* if */ else { result += Eval (*o); } /* else */ } /* for */ return StripE (" ", result); } /* else */ } /* eval */