This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <iostream> | |
| #include <vector> | |
| #include <numeric> | |
| #include <ctime> | |
| int main() | |
| { | |
| // Seed random generator (std::rand is awful but's what we got) | |
| std::srand(std::time(0)); | |
| // array of fitness values | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <boost/asio.hpp> | |
| #include <boost/bind.hpp> | |
| #include <boost/date_time/posix_time/posix_time.hpp> | |
| #include <boost/thread.hpp> | |
| #include <boost/shared_ptr.hpp> | |
| #include <iostream> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class display_class | |
| { | |
| public: | |
| display_class(boost::thread_group& threads, boost::asio::strand* st) : strand(st) | |
| { | |
| iosrv = &strand->get_io_service(); | |
| t = new boost::thread(boost::bind(&boost::asio::io_service::run, &strand->get_io_service())); | |
| strand->post(strand->wrap(boost::bind(&display_class::get, this))); | |
| threads.add_thread(t); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class queue | |
| { | |
| public: | |
| static std::vector<int> display_messages; | |
| static std::vector<int> app_messages; | |
| }; | |
| std::vector<int> queue::display_messages; | |
| std::vector<int> queue::app_messages; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class app_class | |
| { | |
| public: | |
| app_class(boost::thread_group& threads, boost::asio::strand* st) : strand(st) | |
| { | |
| iosrv = &strand->get_io_service(); | |
| t = new boost::thread(boost::bind(&boost::asio::io_service::run, &strand->get_io_service())); | |
| strand->post(strand->wrap(boost::bind(&app_class::send, this))); | |
| threads.add_thread(t); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | int main(int argc, char **argv) | |
| { | |
| boost::asio::io_service ios; | |
| boost::asio::strand strand(ios); | |
| boost::thread_group threads; | |
| app_class app_thread(threads, &strand); | |
| display_class display_thread(threads, &strand); | |
| threads.join_all(); | |
| return 0; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // main.cpp | |
| #include <owlsl/cwl.h> | |
| int main() | |
| { | |
| owlsl::cwl cwl; | |
| if (cwl.open("program1.c")) | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // program1.c | |
| class Program | |
| { | |
| void Main() | |
| { | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // program1.c | |
| class test | |
| { | |
| number num; | |
| void set_number(number val) | |
| { | |
| num = val; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // main.cpp | |
| #include <owlsl/cwl.h> | |
| class console | |
| { | |
| public: | |
| void print_line (const owlsl::text& text) | |
| { | |
| std::wcout << text.wstring() <<std::endl; | |
| } | 
OlderNewer