From 5879de82ac6ce5e4891408bfc9d6c58e563cc58b Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 11 Aug 2015 21:01:02 +0200 Subject: [PATCH] Remove old CBot console Not sure why we kept it; it probably doesn't even compile anymore --- cmake/colobot-lint.cmake | 20 +-- test/CMakeLists.txt | 3 - test/cbot/CBot_console/CBotConsole.cpp | 193 ------------------------- test/cbot/CBot_console/CBotConsole.h | 61 -------- test/cbot/CBot_console/CBotDoc.cpp | 140 ------------------ test/cbot/CBot_console/CBotDoc.h | 53 ------- test/cbot/CBot_console/CClass.cpp | 115 --------------- test/cbot/CBot_console/CClass.h | 36 ----- test/cbot/CBot_console/CMakeLists.txt | 16 -- test/cbot/CBot_console/main.cpp | 63 -------- test/cbot/CBot_console/routines.cpp | 144 ------------------ test/cbot/CMakeLists.txt | 2 - 12 files changed, 11 insertions(+), 835 deletions(-) delete mode 100644 test/cbot/CBot_console/CBotConsole.cpp delete mode 100644 test/cbot/CBot_console/CBotConsole.h delete mode 100644 test/cbot/CBot_console/CBotDoc.cpp delete mode 100644 test/cbot/CBot_console/CBotDoc.h delete mode 100644 test/cbot/CBot_console/CClass.cpp delete mode 100644 test/cbot/CBot_console/CClass.h delete mode 100644 test/cbot/CBot_console/CMakeLists.txt delete mode 100644 test/cbot/CBot_console/main.cpp delete mode 100644 test/cbot/CBot_console/routines.cpp delete mode 100644 test/cbot/CMakeLists.txt diff --git a/cmake/colobot-lint.cmake b/cmake/colobot-lint.cmake index ab2a293e..0fb019b2 100644 --- a/cmake/colobot-lint.cmake +++ b/cmake/colobot-lint.cmake @@ -13,17 +13,19 @@ macro(add_fake_header_sources subdir) file(GLOB_RECURSE all_header_files RELATIVE ${colobot_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h) - foreach(header_file ${all_header_files}) - string(REGEX REPLACE "\\.h$" ".cpp" fake_header_src_file "${fake_headers_src_dir}/${header_file}") + if(all_header_files) + foreach(header_file ${all_header_files}) + string(REGEX REPLACE "\\.h$" ".cpp" fake_header_src_file "${fake_headers_src_dir}/${header_file}") - get_filename_component(fake_header_src_dir ${fake_header_src_file} PATH) - file(MAKE_DIRECTORY ${fake_header_src_dir}) + get_filename_component(fake_header_src_dir ${fake_header_src_file} PATH) + file(MAKE_DIRECTORY ${fake_header_src_dir}) - file(WRITE ${fake_header_src_file} "#include \"${header_file}\"\n\n") + file(WRITE ${fake_header_src_file} "#include \"${header_file}\"\n\n") - list(APPEND all_fake_header_src_files ${fake_header_src_file}) - endforeach() + list(APPEND all_fake_header_src_files ${fake_header_src_file}) + endforeach() - include_directories(${colobot_SOURCE_DIR}) - add_library(colobot_${subdir}_fake_header_srcs STATIC ${all_fake_header_src_files}) + include_directories(${colobot_SOURCE_DIR}) + add_library(colobot_${subdir}_fake_header_srcs STATIC ${all_fake_header_src_files}) + endif() endmacro() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 79d29f1b..c30abe89 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,9 +3,6 @@ set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${MXE_CFLAGS} ${COLOBOT_GTEST_CXX_FLAG set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) -# CBot utils -add_subdirectory(cbot) - # Unit tests add_subdirectory(unit) diff --git a/test/cbot/CBot_console/CBotConsole.cpp b/test/cbot/CBot_console/CBotConsole.cpp deleted file mode 100644 index 1b0b185e..00000000 --- a/test/cbot/CBot_console/CBotConsole.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -/* - * CBotConsole.cpp - * - * Created on: 08-08-2012 - * Author: michal - */ - -#include "CBotConsole.h" -#include "CClass.h" -#include -#include - -CBotConsole::CBotConsole() { - // TODO Auto-generated constructor stub - m_pProg = NULL; - m_threadinfo.m_bRun = false; - m_code = 0; - -} - -CBotConsole::~CBotConsole() { - // TODO Auto-generated destructor stub -} - -uint ThreadProc(ThreadInfo *info) -{ - time_t t0,t1; - time(&t0); - - int Cpt = 0; - - info->m_pProg->Start("LaCommande"); - while ( !info->m_bStop && !info->m_pProg->Run() ) - { -#if 0 - const char* FunctionName; - const char* FN; - int start, end; - - info->m_pProg->GetRunPos(FunctionName, start, end); - - if ( FunctionName != NULL ) - { - info->m_pEditx->SetSel(start, end); - - char buffer[200]; - sprintf( buffer, "step %s, %d, %d",FunctionName, start, end); - AfxMessageBox( buffer ); - - int level = 0; - do - { - CBotVar* t = info->m_pProg->GetStackVars(FN, level--); - if ( FN != FunctionName ) break; - if ( t != NULL ) - { - CString s ; - while ( t != NULL ) - { - if (s.IsEmpty()) s+= "Stack -> "; - else s+= " , "; - s += t->GetValString(); - t = t->GetNext(); - } - AfxMessageBox(s); - } - } while (TRUE); - } -#endif - Cpt++; - if ( Cpt%50 == 0 ) std::cout << "."; - } - - if ( info->m_bStop ) - { - std::cout << "\nInterrupt\n"; - } - else if (info->m_pProg->GetError() == 0) - { - time(&t1); - double prog_time = difftime(t0,t1); - - char buffer[200]; - sprintf( buffer, "\nExecution terminated in %f seconds.\nInterrupted %d time(s).\n", - prog_time, Cpt); - - std::cout << buffer; - } - -// info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; - return 0 ; -} - -long CBotConsole::EndProg() -{ - m_threadinfo.m_bRun = false; - - if (m_pProg->GetError(m_code, m_start, m_end)) - { - CBotString TextError; - TextError = CBotProgram::GetErrorText(m_code); - std::cout << TextError; - return 1; - } - delete m_pProg; - m_pProg = NULL; - - return 0 ; -} - - -void CBotConsole::OnOK() -{ - m_code = 0; - - std::string Commande; - std::cin >> Commande; - - std::string s = "void LaCommande() { " + Commande + " ;}"; - m_pProg = new CBotProgram(); - CBotStringArray liste; - m_pProg->Compile(s.c_str(), liste); - - int err, start, end; - if ( m_pProg->GetError(err, start, end) ) - { - CBotString TextError; - TextError = CBotProgram::GetErrorText(err); - std::cout << TextError; - return; - } - - std::cout << "\n" + Commande + " ->\n"; - -// m_Edit2.SetWindowText(""); -// m_Edit1.SetFocus(); -// m_Edit2.EnableWindow(FALSE); -// m_cOK.EnableWindow(FALSE); - - // lance un processus paralèle pour l'exécution -// m_threadinfo.m_pWndMessage = this ; - -// m_threadinfo.m_pEdit1 = &m_Edit1; -// m_threadinfo.m_pEditx = m_pEditx; - m_threadinfo.m_pProg = m_pProg; - m_threadinfo.m_bStop = false; - m_threadinfo.m_bRun = true; - - ThreadProc(&m_threadinfo); - -// here program starts -// AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; -} - -void CBotConsole::OnCancel() -{ - m_threadinfo.m_bStop = true ; -} - -bool CBotConsole::OnInitDialog() -{ -// CDialog::OnInitDialog(); - - std::cout << "Following functions are availible:\n"; - for ( int i = 0; i < m_pListe->GetSize(); i++ ) - { - CBotString x = (*m_pListe)[i] + CBotString("\n"); - std::cout << x; - } - std::cout << "Enter a command:\n"; - - - return true; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/test/cbot/CBot_console/CBotConsole.h b/test/cbot/CBot_console/CBotConsole.h deleted file mode 100644 index 83556f5a..00000000 --- a/test/cbot/CBot_console/CBotConsole.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -/* - * CBotConsole.h - * - * Created on: 08-08-2012 - * Author: michal - */ - -#pragma once - -#include "CClass.h" - -struct ThreadInfo -{ -// CEdit* m_pEdit1 ; -// CEdit* m_pEditx ; - CBotProgram* m_pProg; -// CWnd* m_pWndMessage; - bool m_bStop; - bool m_bRun; -}; - -class CBotConsole { - -public: - CBotConsole(); - virtual ~CBotConsole(); - -// CEdit m_Edit1; - - CBotProgram* m_pProg; - ThreadInfo m_threadinfo; - - CBotStringArray* m_pListe; - int m_code, m_start, m_end; -// CEdit* m_pEditx; - - // Implementation - void OnOK(); - void OnCancel(); - bool OnInitDialog(); - long EndProg() ; -}; - diff --git a/test/cbot/CBot_console/CBotDoc.cpp b/test/cbot/CBot_console/CBotDoc.cpp deleted file mode 100644 index 5871fb56..00000000 --- a/test/cbot/CBot_console/CBotDoc.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -/* - * CBotDoc.cpp - * - * Created on: 08-08-2012 - * Author: michal - */ -#include "CBotDoc.h" -#include "CBotConsole.h" -#include - -CBotDoc::CBotDoc(std::string s) { - // TODO Auto-generated constructor stub - // TODO set m_DocText -// m_pEdit = NULL; - m_pProg = NULL; -// m_bModified = FALSE; - m_DocText = s; - std::cout << s << std::endl; -// std::cout << "Enter to continue..." << std::endl; -// getchar(); -} - -CBotDoc::~CBotDoc() { - -// delete m_pEdit; - delete m_pProg; -} - - -//static bool test = false; - -void CBotDoc::OnRun() -{ - -// m_pEdit->GetWindowText(m_DocText); - CBotString s; - - std::string TextError; - int code, start, end; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - if (!m_pProg->Compile(m_DocText.c_str(), m_Liste, NULL)) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - TextError = CBotProgram::GetErrorText( code ); - std::cout << TextError << std::endl; - return; - } - - if( m_Liste.GetSize() == 0 ) - { - std::cout << "No function marked \"extern\" !\n"; - return; - } - - for ( int i = 0; i < m_Liste.GetSize(); i++ ) - { - int start, stop; - m_pProg->GetPosition(m_Liste[i], start, stop, GetPosNom, GetPosParam); - CBotString s(m_DocText.substr( start, stop-start ).c_str()); - m_Liste[i] = s; - } -// TODO - CBotConsole dlg; - dlg.m_pListe = &m_Liste; -// dlg.m_pEditx = m_pEdit; - - dlg.OnInitDialog(); - dlg.OnOK(); - dlg.EndProg(); -// if ( dlg.m_code>0 ) -// { -// std::string TextError; -// -// TextError = m_pProg->GetErrorText( dlg.m_code ); -// -// std::cout <GetWindowText(m_DocText); - - std::string TextError; - int code, start, end; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - char buffer[100]; - strcpy(buffer, "a pointer move to see"); - - if (!m_pProg->Compile(m_DocText.c_str(), m_Liste, static_cast(buffer))) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - -// m_pEdit->SetSel( start, end ); -// m_pEdit->SetFocus(); // higlights part of problem - - TextError = CBotProgram::GetErrorText( code ); - std::cout << TextError ; - - return false; - } - -// if ( m_pProg->GetPosition( "TheTest", start, end) ) -// { -// m_pEdit->SetSel( start, end ); -// m_pEdit->SetFocus(); // higlights part of problem -// } - -// m_bModified = FALSE; - return true; -} diff --git a/test/cbot/CBot_console/CBotDoc.h b/test/cbot/CBot_console/CBotDoc.h deleted file mode 100644 index 5f58ed5b..00000000 --- a/test/cbot/CBot_console/CBotDoc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -/* - * CBotDoc.h - * - * Created on: 08-08-2012 - * Author: michal - */ - -#pragma once - -#include "CClass.h" -#include - -class CBotDoc { - -public: - CBotDoc(std::string); - virtual ~CBotDoc(); - -// CEdit* m_pEdit; // to memorize the text, and display - CBotProgram* m_pProg; // the compiled program - std::string m_DocText; - CBotStringArray m_Liste; - -// Operations - - bool Compile(); - -// virtual bool OnNewDocument(); - - void OnRun(); - void OnChangeEdit1(); - void OnTest(); - -}; - diff --git a/test/cbot/CBot_console/CClass.cpp b/test/cbot/CBot_console/CClass.cpp deleted file mode 100644 index ec6cd8fb..00000000 --- a/test/cbot/CBot_console/CClass.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -#include "CClass.h" - -#include "routines.cpp" - -void rMajObject( CBotVar* pThis, void* pUser ) -{ - if (!pThis->IsElemOfClass("object")) - return ; - CBotVar* pPos = pThis->GetItem("position"); - CBotVar* pX = pPos->GetItem("x"); - CBotVar* pY = pPos->GetItem("y"); - CBotVar* pZ = pPos->GetItem("z"); -// CBotVar* pPt = pThis->GetItem("transport"); - - CBotString p = pX->GetValString(); - -// pX->SetValFloat( pUser == (void*)1 ? (float)12.5 : (float)44.4 ); - pZ->SetValFloat( (float)0 ); - pY->SetValFloat( (float)-3.33 ); - pX->SetValFloat( pX->GetValFloat() + 10 ) ; - -// pX = pThis->GetItem( "xx" ); -// pX->SetValFloat( (float)22 ); - - // crée une instance sur une classe object -// CBotVar* pAutre = CBotVar::Create("autre", CBotTypClass, "object"); -// pAutre->SetUserPtr( (void*)3 ); -// pPt->SetPointer( pAutre ); -// pPt->SetPointer( NULL ); -// delete pAutre; -}; - -CClass::CClass() -{ - m_pClassPoint= NULL; -} - -bool CClass::InitInstance() -{ -////////////////////////////////////////////// -// défini les mots clefs supplémentaires -// ------------------------------------------- - - CBotProgram::Init(); - -////////////////////////////////////////////// -// défini les fonctions "show()" et "print()" -// ------------------------------------------- - - //CBotProgram::AddFunction("show", rShow, cShow); - CBotProgram::AddFunction("print", rPrint, cPrint); - CBotProgram::AddFunction("println", rPrintLn, cPrint); - - -/////////////////////////////////// -// définie la classe globale CPoint -// -------------------------------- - - m_pClassPoint = new CBotClass("CPoint", NULL); - // ajoute le composant ".x" - m_pClassPoint->AddItem("x", CBotTypFloat); - // ajoute le composant ".y" - m_pClassPoint->AddItem("y", CBotTypFloat); - - // ajoute le constructeur pour cette classe - m_pClassPoint->AddFunction("CPoint", rCPoint, cCPoint); - - m_pClassPointIntr = new CBotClass("point", NULL, true); - // ajoute le composant ".x" - m_pClassPointIntr->AddItem("x", CBotTypFloat); - // ajoute le composant ".y" - m_pClassPointIntr->AddItem("y", CBotTypFloat); - // ajoute le composant ".z" - m_pClassPointIntr->AddItem("z", CBotTypFloat); - - // ajoute le constructeur pour cette classe - m_pClassPointIntr->AddFunction("point", rCPoint, cCPoint); - - // défini la classe "object" - CBotClass* pClassObject = new CBotClass( "object", NULL ) ; - pClassObject->AddItem( "xx", CBotTypFloat ); - pClassObject->AddItem( "position", CBotTypResult( CBotTypIntrinsic, "point" ) ); - pClassObject->AddItem( "transport", CBotTypResult( CBotTypPointer, "object" ) ); - pClassObject->AddUpdateFunc( rMajObject ); - - InitClassFILE(); - - return true; -} - -void CClass::ExitInstance() -{ - delete m_pFuncFile; - - CBotProgram::Free(); - -} diff --git a/test/cbot/CBot_console/CClass.h b/test/cbot/CBot_console/CClass.h deleted file mode 100644 index 187d0908..00000000 --- a/test/cbot/CBot_console/CClass.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -#pragma once - -#include -#include - -extern std::string s; - -class CClass -{ -public: - CClass(); - - CBotClass* m_pClassPoint; - CBotClass* m_pClassPointIntr; - - bool InitInstance(); - void ExitInstance(); -}; diff --git a/test/cbot/CBot_console/CMakeLists.txt b/test/cbot/CBot_console/CMakeLists.txt deleted file mode 100644 index 5016a778..00000000 --- a/test/cbot/CBot_console/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(SOURCES -CClass.cpp -main.cpp -CBotDoc.cpp -CBotConsole.cpp -) - -set(LIBS -CBot -) - -include_directories(${colobot_SOURCE_DIR}/src) - -add_executable(CBot_console ${SOURCES}) - -target_link_libraries(CBot_console ${LIBS}) diff --git a/test/cbot/CBot_console/main.cpp b/test/cbot/CBot_console/main.cpp deleted file mode 100644 index 98c8c181..00000000 --- a/test/cbot/CBot_console/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ -#include "CClass.h" -#include "CBotDoc.h" -#include - - -#include - -std::string str; - -// routine to update the instance of the class Bot common - -int main(int argc, char* argv[]) -{ - CClass newclass; - CBotDoc *botdoc; - if (argc != 2) - { - std::cout << "Usage: "<" << std::endl; - return 0; - } - - std::ifstream in(argv[1]); - std::cout << argv[1] << std::endl; - if (!in.good()) - { - std::cout << "Oh no, error!" << std::endl; - return 1; - } - - std::string contents((std::istreambuf_iterator(in)), - std::istreambuf_iterator()); - str = contents; - - if(!newclass.InitInstance()) - { - std::cerr << "Initialization not complete!" << std::endl; - return 1; - } - - botdoc = new CBotDoc(str); -// std::cout << "Hello CBot!" << std::endl << s; - botdoc->OnRun(); - delete botdoc; - newclass.ExitInstance(); -} diff --git a/test/cbot/CBot_console/routines.cpp b/test/cbot/CBot_console/routines.cpp deleted file mode 100644 index a9673056..00000000 --- a/test/cbot/CBot_console/routines.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This file is part of the Colobot: Gold Edition source code - * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam - * http://epsiteс.ch; http://colobot.info; http://github.com/colobot - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://gnu.org/licenses - */ - -//////////////////////////////////////////////////////////////////// -// routine show() -// utilisable depuis le programme écrit en CBot - - -#include -#include -#include "CBot/ClassFILE.cpp" -//std::string s; -/* -// execution -bool rShow( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) -{ - string::string s; - - while ( pVar != NULL ) - { - string::string ss; - - ss.LoadString( TX_TYPENAMES + pVar->GetType() ); - s += ss + " "; - - ss = pVar->GetName(); - if (ss.IsEmpty()) ss = ""; - s += ss + " = "; - - s += pVar->GetValString(); - s += "\n"; - pVar = pVar->GetNext(); - } - - AfxMessageBox(s, MB_OK|MB_ICONINFORMATION); - - return TRUE; // pas d'interruption -} - -CBotTypResult cShow( CBotVar* &pVar, void* pUser) -{ - if ( pVar == NULL ) return CBotTypResult(5028); - return CBotTypResult(0); // tous paramètres acceptés, void en retour -} - -*/ - -//////////////////////////////////////////////////////////////////// -// routine print() -// utilisable depuis le programme écrit en CBot - -// exécution - -bool rPrintLn( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) -{ - std::string s; - while ( pVar != NULL ) - { - if ( !s.empty() ) s += " "; - s += pVar->GetValString(); - pVar = pVar->GetNext(); - } - s += "\n"; - - std::cout << s; - return true; // pas d'interruption -} - -bool rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) -{ - std::string s; - while ( pVar != NULL ) - { - if ( !s.empty() ) s += " "; - s += pVar->GetValString(); - pVar = pVar->GetNext(); - } - s += " "; - std::cout << s; - return true; // pas d'interruption -} - -CBotTypResult cPrint( CBotVar* &pVar, void* pUser) -{ - return CBotTypResult(0); // tous paramètres acceptés, un entier en retour -} - - -////////////////////////////////////////////////////////////////// -// class CPoint pour essayer - -// exécution -bool rCPoint( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - if ( pVar == NULL )return true; // constructor with no parameters is ok - - CBotVar* pX = pThis->GetItem("x"); - pX->SetValFloat( pVar->GetValFloat() ); - pVar = pVar->GetNext(); - - CBotVar* pY = pThis->GetItem("y"); - pY->SetValFloat( pVar->GetValFloat() ); - pVar = pVar->GetNext(); - - return true; // pas d'interruption -} - -CBotTypResult cCPoint( CBotVar* pThis, CBotVar* &pVar) -{ - // ok if no parameters! - if ( pVar == NULL ) return CBotTypResult(0); - - // numeric type of parameter please - if ( pVar->GetType() > CBotTypDouble ) return CBotTypResult(5011); - pVar = pVar->GetNext(); - - // there must be a second parameter - if ( pVar == NULL ) return 5028; - // also numeric - if ( pVar->GetType() > CBotTypDouble )return CBotTypResult(5011); - pVar = pVar->GetNext(); - - // and not more than 2 parameters please - if ( pVar != NULL ) return CBotTypResult(5026); - - return CBotTypResult(0); // This function returns void -} - diff --git a/test/cbot/CMakeLists.txt b/test/cbot/CMakeLists.txt deleted file mode 100644 index e087ea59..00000000 --- a/test/cbot/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# CBot console interpreter -#add_subdirectory(CBot_console)