Cpp/ForthWrapper/CppPhysicsEngine/Cpp11/car.cpp
bool parse(btosgDictionary& dictionary, int argc, char* argv[])
{
    g_argv = argv; // global access
    int number;

    std::cout << "Running command line script:" << std::endl;
    for (IP = 1; IP < argc; ++IP)
    {
        const char* word = argv[IP];

        std::cout << "Forth: Execute word '" << word << "'" << std::endl;
        auto it = dictionary.find(word);
        if (it != dictionary.end())
        {
            it->second(); // execute its definition
        }
        else if (isInteger(word, number))
        {
            std::cout << "Is int ? " << word << std::endl;
            DS.push(number);
        }
        else
        {
            std::cerr << "Forth: Unknown word '" << word
                      << "'. Abort !" << std::endl;
            return false;
        }
    }

    return true;
}
// QQ Interpret a Forth script given on the command line
QQ Interpret a Forth script given on the command line
QQ Interpret a Forth script given on the command line
bool parse(btosgDictionary& dictionary, int argc, char* argv[])
{
    g_argv = argv; 
    int number;
    std::cout << "Running command line script:" << std::endl;
    for (IP = 1; IP < argc; ++IP)
    {
        const char* word = argv[IP];
        std::cout << "Forth: Execute word '" << word << "'" << std::endl;
        auto it = dictionary.find(word);
        if (it != dictionary.end())
        {
            it->second(); 
        }
        else if (isInteger(word, number))
        {
            std::cout << "Is int ? " << word << std::endl;
            DS.push(number);
        }
        else
        {
            std::cerr << "Forth: Unknown word '" << word
                      << "'. Abort !" << std::endl;
            return false;
        }
    }
    return true;
}
bool parse ( btosgDictionary & dictionary , int argc , char * argv [ ] ) { g_argv = argv ; int number ; std :: cout << " " << std :: endl ; for ( IP = 1 ; IP < argc ; ++ IP ) { const char * word = argv [ IP ] ; std :: cout << " " << word << " " << std :: endl ; auto it = dictionary . find ( word ) ; if ( it != dictionary . end ( ) ) { it -> second ( ) ; } else if ( isInteger ( word , number ) ) { std :: cout << " " << word << std :: endl ; DS . push ( number ) ; } else { std :: cerr << " " << word << " " << std :: endl ; return false ; } } return true ; }
QQ Interpret a Forth script given on the command line
QQ Interpret a Forth script given on the command line
// global access // execute its definition