int main(int argc, const char *argv[]) { Node first(10, 20); Node second(30, 40); Node third(100, 50); Node forth(100, 33); first.setNext(&second); second.setNext(&third); std::cout << first.getTail()->getValue() << std::endl; std::cout << second.getTail()->getValue() << std::endl; std::cout << third.getTail()->getValue() << std::endl; Hash h; h.put(10,20); h.put(30,40); h.put(10,30); h.put(30,50); std::cout << h.get(10,20) << std::endl; std::cout << h.get(11,20) << std::endl; std::cout << h.get(10,30) << std::endl; std::cout << h.get(31,100) << std::endl; std::cout << h.get(30,40) << std::endl; std::cout << h.get(30,50) << std::endl; return 0; }
std::vector<int> forth(state& s, std::istream& istr) { auto pos = istr.tellg(); std::string token; if(istr >> token) { std::istringstream str(token); int num; if(str >> num) { s.stack.push_back(num); return forth(s,istr); } if(s.dict.count(token)) { s.dict.at(token)(s,istr); return forth(s,istr); } } return s.stack; }
// This is the routine that is run by main_task() from cpu_start.c, // i.e. the "call in" from FreeRTOS to Forth. void app_main(void) { nvs_flash_init(); forth(); }