From a760e8a749af60cd3598ebe113b7692bc6592f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Konopacki?= Date: Wed, 8 Aug 2012 02:23:38 +0200 Subject: Cleanups --- src/CBot/CBot.aps | Bin 44112 -> 0 bytes src/CBot/TestCBot/B.txt | 18 - src/CBot/TestCBot/BUG2.txt | 107 ---- src/CBot/TestCBot/CBotConsoleDlg.cpp | 221 ------- src/CBot/TestCBot/CBotConsoleDlg.h | 85 --- src/CBot/TestCBot/ChildFrm.cpp | 74 --- src/CBot/TestCBot/ChildFrm.h | 66 -- src/CBot/TestCBot/Deleted.txt | 23 - src/CBot/TestCBot/MaClass.txt | 16 - src/CBot/TestCBot/MainFrm.cpp | 116 ---- src/CBot/TestCBot/MainFrm.h | 72 --- src/CBot/TestCBot/Mc2.txt | 4 - src/CBot/TestCBot/Mon fichier.txt | 2 - src/CBot/TestCBot/Nop.txt | 4 - src/CBot/TestCBot/POS.txt | 14 - src/CBot/TestCBot/PerformDlg.cpp | 177 ------ src/CBot/TestCBot/PerformDlg.h | 78 --- src/CBot/TestCBot/Routines.cpp | 153 ----- src/CBot/TestCBot/StdAfx.cpp | 20 - src/CBot/TestCBot/StdAfx.h | 40 -- src/CBot/TestCBot/T.txt | 4 - src/CBot/TestCBot/TESTALL.txt | 161 ----- src/CBot/TestCBot/TestCB1.txt | 18 - src/CBot/TestCBot/TestCBot.clw | 316 ---------- src/CBot/TestCBot/TestCBot.cpp | 267 -------- src/CBot/TestCBot/TestCBot.dsp | 201 ------ src/CBot/TestCBot/TestCBot.h | 78 --- src/CBot/TestCBot/TestCBot.rc | 564 ----------------- src/CBot/TestCBot/TestCBot1.txt | 27 - src/CBot/TestCBot/TestCBot3.txt | 24 - src/CBot/TestCBot/TestCBotDoc.cpp | 697 --------------------- src/CBot/TestCBot/TestCBotDoc.h | 78 --- src/CBot/TestCBot/TestCBotView.cpp | 142 ----- src/CBot/TestCBot/TestCBotView.h | 78 --- src/CBot/TestCBot/TestNull.txt | 15 - src/CBot/TestCBot/TestRestoreState.txt | 67 -- src/CBot/TestCBot/TestStatic.txt | 31 - src/CBot/TestCBot/TestStr.txt | 17 - src/CBot/TestCBot/Z.txt | 14 - src/CBot/TestCBot/array.txt | 24 - "src/CBot/TestCBot/a\2361.txt" | 96 --- "src/CBot/TestCBot/a\2471.txt" | 96 --- src/CBot/TestCBot/bug.txt | 12 - src/CBot/TestCBot/bugmw.txt | 9 - src/CBot/TestCBot/ccc.txt | 8 - src/CBot/TestCBot/enum.txt | 9 - src/CBot/TestCBot/fibo.txt | 25 - src/CBot/TestCBot/file.txt | 70 --- src/CBot/TestCBot/h.txt | 5 - src/CBot/TestCBot/include.txt | 27 - src/CBot/TestCBot/intrinsic.txt | 16 - src/CBot/TestCBot/methode1.txt | 57 -- src/CBot/TestCBot/methode2.txt | 50 -- src/CBot/TestCBot/mp1.txt | 25 - src/CBot/TestCBot/mp2.txt | 28 - src/CBot/TestCBot/mw.txt | 16 - src/CBot/TestCBot/null.txt | 5 - src/CBot/TestCBot/opnew.txt | 20 - src/CBot/TestCBot/plante.txt | 25 - src/CBot/TestCBot/pointer.txt | 41 -- src/CBot/TestCBot/postinc.txt | 7 - src/CBot/TestCBot/radar.txt | 39 -- src/CBot/TestCBot/res/TestCBot.ico | Bin 1078 -> 0 bytes src/CBot/TestCBot/res/TestCBot.rc2 | 13 - src/CBot/TestCBot/res/TestCBotDoc.ico | Bin 1078 -> 0 bytes src/CBot/TestCBot/res/Toolbar.bmp | Bin 1198 -> 0 bytes src/CBot/TestCBot/resource.h | 44 -- src/CBot/TestCBot/solution.txt | 13 - src/CBot/TestCBot/test.txt | 8 - src/CBot/TestCBot/test23.txt | 10 - src/CBot/TestCBot/testmw.txt | 14 - src/CBot/TestCBot/this.txt | 13 - src/CBot/TestCBot/tt.txt | 12 - src/CBot/TestCBot/tt2.txt | 5 - src/CBot/TestCBot/vide.txt | 0 src/CBot/TestCBot/xTestCBot.clw | 245 -------- src/CBot/TestCBot/zz.txt | 6 - src/CBot/_Copy.bat | 2 - src/CBot/colobot.ini | 49 -- src/CBot/old TstCBot/BotConsoleDlg.cpp | 164 ----- src/CBot/old TstCBot/BotConsoleDlg.h | 65 -- src/CBot/old TstCBot/BotErrorDlg.cpp | 56 -- src/CBot/old TstCBot/BotErrorDlg.h | 51 -- src/CBot/old TstCBot/CBotTest.txt | 36 -- src/CBot/old TstCBot/CMyThread.cpp | 107 ---- src/CBot/old TstCBot/CMyThread.h | 44 -- src/CBot/old TstCBot/MainFrm.cpp | 91 --- src/CBot/old TstCBot/MainFrm.h | 55 -- src/CBot/old TstCBot/ReadMe.txt | 93 --- src/CBot/old TstCBot/Resource.h | 68 -- src/CBot/old TstCBot/StdAfx.cpp | 6 - src/CBot/old TstCBot/StdAfx.h | 26 - src/CBot/old TstCBot/TstCBot.clw | 189 ------ src/CBot/old TstCBot/TstCBot.cpp | 412 ------------ src/CBot/old TstCBot/TstCBot.dsp | 180 ------ src/CBot/old TstCBot/TstCBot.h | 62 -- src/CBot/old TstCBot/TstCBot.rc | 471 -------------- src/CBot/old TstCBot/TstCBotDoc.cpp | 83 --- src/CBot/old TstCBot/TstCBotDoc.h | 55 -- src/CBot/old TstCBot/TstCBotView.cpp | 291 --------- src/CBot/old TstCBot/TstCBotView.h | 81 --- src/CBot/old TstCBot/res/TstCBot.ico | Bin 1078 -> 0 bytes src/CBot/old TstCBot/res/TstCBot.rc2 | 13 - src/CBot/old TstCBot/res/TstCBotDoc.ico | Bin 1078 -> 0 bytes src/CBot/old TstCBot/test complet 1.txt | 213 ------- src/CBot/old TstCBot/x.txt | 43 -- src/CBot/resource.h | 5 +- src/CBot/tests/TestCBot/CBotConsoleDlg.cpp | 221 +++++++ src/CBot/tests/TestCBot/CBotConsoleDlg.h | 85 +++ src/CBot/tests/TestCBot/ChildFrm.cpp | 74 +++ src/CBot/tests/TestCBot/ChildFrm.h | 66 ++ src/CBot/tests/TestCBot/MainFrm.cpp | 116 ++++ src/CBot/tests/TestCBot/MainFrm.h | 72 +++ src/CBot/tests/TestCBot/PerformDlg.cpp | 177 ++++++ src/CBot/tests/TestCBot/PerformDlg.h | 78 +++ src/CBot/tests/TestCBot/Routines.cpp | 153 +++++ src/CBot/tests/TestCBot/StdAfx.cpp | 20 + src/CBot/tests/TestCBot/StdAfx.h | 40 ++ src/CBot/tests/TestCBot/TestCBot.clw | 316 ++++++++++ src/CBot/tests/TestCBot/TestCBot.cpp | 267 ++++++++ src/CBot/tests/TestCBot/TestCBot.dsp | 201 ++++++ src/CBot/tests/TestCBot/TestCBot.h | 78 +++ src/CBot/tests/TestCBot/TestCBot.rc | 564 +++++++++++++++++ src/CBot/tests/TestCBot/TestCBotDoc.cpp | 697 +++++++++++++++++++++ src/CBot/tests/TestCBot/TestCBotDoc.h | 78 +++ src/CBot/tests/TestCBot/TestCBotView.cpp | 142 +++++ src/CBot/tests/TestCBot/TestCBotView.h | 78 +++ "src/CBot/tests/TestCBot/a\2471.txt~" | 96 +++ src/CBot/tests/TestCBot/res/TestCBot.ico | Bin 0 -> 1078 bytes src/CBot/tests/TestCBot/res/TestCBot.rc2 | 13 + src/CBot/tests/TestCBot/res/TestCBotDoc.ico | Bin 0 -> 1078 bytes src/CBot/tests/TestCBot/res/Toolbar.bmp | Bin 0 -> 1198 bytes src/CBot/tests/TestCBot/resource.h | 44 ++ src/CBot/tests/TestCBot/scenarios/B.txt | 18 + src/CBot/tests/TestCBot/scenarios/BUG2.txt | 107 ++++ src/CBot/tests/TestCBot/scenarios/Deleted.txt | 23 + src/CBot/tests/TestCBot/scenarios/MaClass.txt | 16 + src/CBot/tests/TestCBot/scenarios/Mc2.txt | 4 + src/CBot/tests/TestCBot/scenarios/Mon fichier.txt | 2 + src/CBot/tests/TestCBot/scenarios/Nop.txt | 4 + src/CBot/tests/TestCBot/scenarios/POS.txt | 14 + src/CBot/tests/TestCBot/scenarios/T.txt | 4 + src/CBot/tests/TestCBot/scenarios/TESTALL.txt | 161 +++++ src/CBot/tests/TestCBot/scenarios/TestCB1.txt | 18 + src/CBot/tests/TestCBot/scenarios/TestCBot1.txt | 27 + src/CBot/tests/TestCBot/scenarios/TestCBot3.txt | 24 + src/CBot/tests/TestCBot/scenarios/TestNull.txt | 15 + .../tests/TestCBot/scenarios/TestRestoreState.txt | 67 ++ src/CBot/tests/TestCBot/scenarios/TestStatic.txt | 31 + src/CBot/tests/TestCBot/scenarios/TestStr.txt | 17 + src/CBot/tests/TestCBot/scenarios/Z.txt | 14 + src/CBot/tests/TestCBot/scenarios/a1.txt | 96 +++ src/CBot/tests/TestCBot/scenarios/array.txt | 24 + "src/CBot/tests/TestCBot/scenarios/a\2361.txt" | 96 +++ "src/CBot/tests/TestCBot/scenarios/a\2471.txt" | 96 +++ src/CBot/tests/TestCBot/scenarios/bug.txt | 12 + src/CBot/tests/TestCBot/scenarios/bugmw.txt | 9 + src/CBot/tests/TestCBot/scenarios/ccc.txt | 8 + src/CBot/tests/TestCBot/scenarios/enum.txt | 9 + src/CBot/tests/TestCBot/scenarios/fibo.txt | 25 + src/CBot/tests/TestCBot/scenarios/file.txt | 70 +++ src/CBot/tests/TestCBot/scenarios/h.txt | 5 + src/CBot/tests/TestCBot/scenarios/include.txt | 27 + src/CBot/tests/TestCBot/scenarios/intrinsic.txt | 16 + src/CBot/tests/TestCBot/scenarios/methode1.txt | 57 ++ src/CBot/tests/TestCBot/scenarios/methode2.txt | 50 ++ src/CBot/tests/TestCBot/scenarios/mp1.txt | 25 + src/CBot/tests/TestCBot/scenarios/mp2.txt | 28 + src/CBot/tests/TestCBot/scenarios/mw.txt | 16 + src/CBot/tests/TestCBot/scenarios/null.txt | 5 + src/CBot/tests/TestCBot/scenarios/opnew.txt | 20 + src/CBot/tests/TestCBot/scenarios/plante.txt | 25 + src/CBot/tests/TestCBot/scenarios/pointer.txt | 41 ++ src/CBot/tests/TestCBot/scenarios/postinc.txt | 7 + src/CBot/tests/TestCBot/scenarios/radar.txt | 39 ++ src/CBot/tests/TestCBot/scenarios/solution.txt | 13 + src/CBot/tests/TestCBot/scenarios/test.txt | 8 + src/CBot/tests/TestCBot/scenarios/test23.txt | 10 + src/CBot/tests/TestCBot/scenarios/testmw.txt | 14 + src/CBot/tests/TestCBot/scenarios/this.txt | 13 + src/CBot/tests/TestCBot/scenarios/tt.txt | 12 + src/CBot/tests/TestCBot/scenarios/tt2.txt | 5 + src/CBot/tests/TestCBot/scenarios/vide.txt | 0 src/CBot/tests/TestCBot/scenarios/zz.txt | 6 + src/CBot/tests/TestCBot/xTestCBot.clw | 245 ++++++++ src/CBot/tests/old TstCBot/BotConsoleDlg.cpp | 164 +++++ src/CBot/tests/old TstCBot/BotConsoleDlg.h | 65 ++ src/CBot/tests/old TstCBot/BotErrorDlg.cpp | 56 ++ src/CBot/tests/old TstCBot/BotErrorDlg.h | 51 ++ src/CBot/tests/old TstCBot/CBotTest.txt | 36 ++ src/CBot/tests/old TstCBot/CMyThread.cpp | 107 ++++ src/CBot/tests/old TstCBot/CMyThread.h | 44 ++ src/CBot/tests/old TstCBot/MainFrm.cpp | 91 +++ src/CBot/tests/old TstCBot/MainFrm.h | 55 ++ src/CBot/tests/old TstCBot/ReadMe.txt | 93 +++ src/CBot/tests/old TstCBot/Resource.h | 68 ++ src/CBot/tests/old TstCBot/StdAfx.cpp | 6 + src/CBot/tests/old TstCBot/StdAfx.h | 26 + src/CBot/tests/old TstCBot/TstCBot.clw | 189 ++++++ src/CBot/tests/old TstCBot/TstCBot.cpp | 412 ++++++++++++ src/CBot/tests/old TstCBot/TstCBot.dsp | 180 ++++++ src/CBot/tests/old TstCBot/TstCBot.h | 62 ++ src/CBot/tests/old TstCBot/TstCBot.rc | 471 ++++++++++++++ src/CBot/tests/old TstCBot/TstCBotDoc.cpp | 83 +++ src/CBot/tests/old TstCBot/TstCBotDoc.h | 55 ++ src/CBot/tests/old TstCBot/TstCBotView.cpp | 291 +++++++++ src/CBot/tests/old TstCBot/TstCBotView.h | 81 +++ src/CBot/tests/old TstCBot/res/TstCBot.ico | Bin 0 -> 1078 bytes src/CBot/tests/old TstCBot/res/TstCBot.rc2 | 13 + src/CBot/tests/old TstCBot/res/TstCBotDoc.ico | Bin 0 -> 1078 bytes src/CBot/tests/old TstCBot/test complet 1.txt | 213 +++++++ src/CBot/tests/old TstCBot/x.txt | 43 ++ 212 files changed, 8332 insertions(+), 8190 deletions(-) delete mode 100644 src/CBot/CBot.aps delete mode 100644 src/CBot/TestCBot/B.txt delete mode 100644 src/CBot/TestCBot/BUG2.txt delete mode 100644 src/CBot/TestCBot/CBotConsoleDlg.cpp delete mode 100644 src/CBot/TestCBot/CBotConsoleDlg.h delete mode 100644 src/CBot/TestCBot/ChildFrm.cpp delete mode 100644 src/CBot/TestCBot/ChildFrm.h delete mode 100644 src/CBot/TestCBot/Deleted.txt delete mode 100644 src/CBot/TestCBot/MaClass.txt delete mode 100644 src/CBot/TestCBot/MainFrm.cpp delete mode 100644 src/CBot/TestCBot/MainFrm.h delete mode 100644 src/CBot/TestCBot/Mc2.txt delete mode 100644 src/CBot/TestCBot/Mon fichier.txt delete mode 100644 src/CBot/TestCBot/Nop.txt delete mode 100644 src/CBot/TestCBot/POS.txt delete mode 100644 src/CBot/TestCBot/PerformDlg.cpp delete mode 100644 src/CBot/TestCBot/PerformDlg.h delete mode 100644 src/CBot/TestCBot/Routines.cpp delete mode 100644 src/CBot/TestCBot/StdAfx.cpp delete mode 100644 src/CBot/TestCBot/StdAfx.h delete mode 100644 src/CBot/TestCBot/T.txt delete mode 100644 src/CBot/TestCBot/TESTALL.txt delete mode 100644 src/CBot/TestCBot/TestCB1.txt delete mode 100644 src/CBot/TestCBot/TestCBot.clw delete mode 100644 src/CBot/TestCBot/TestCBot.cpp delete mode 100644 src/CBot/TestCBot/TestCBot.dsp delete mode 100644 src/CBot/TestCBot/TestCBot.h delete mode 100644 src/CBot/TestCBot/TestCBot.rc delete mode 100644 src/CBot/TestCBot/TestCBot1.txt delete mode 100644 src/CBot/TestCBot/TestCBot3.txt delete mode 100644 src/CBot/TestCBot/TestCBotDoc.cpp delete mode 100644 src/CBot/TestCBot/TestCBotDoc.h delete mode 100644 src/CBot/TestCBot/TestCBotView.cpp delete mode 100644 src/CBot/TestCBot/TestCBotView.h delete mode 100644 src/CBot/TestCBot/TestNull.txt delete mode 100644 src/CBot/TestCBot/TestRestoreState.txt delete mode 100644 src/CBot/TestCBot/TestStatic.txt delete mode 100644 src/CBot/TestCBot/TestStr.txt delete mode 100644 src/CBot/TestCBot/Z.txt delete mode 100644 src/CBot/TestCBot/array.txt delete mode 100644 "src/CBot/TestCBot/a\2361.txt" delete mode 100644 "src/CBot/TestCBot/a\2471.txt" delete mode 100644 src/CBot/TestCBot/bug.txt delete mode 100644 src/CBot/TestCBot/bugmw.txt delete mode 100644 src/CBot/TestCBot/ccc.txt delete mode 100644 src/CBot/TestCBot/enum.txt delete mode 100644 src/CBot/TestCBot/fibo.txt delete mode 100644 src/CBot/TestCBot/file.txt delete mode 100644 src/CBot/TestCBot/h.txt delete mode 100644 src/CBot/TestCBot/include.txt delete mode 100644 src/CBot/TestCBot/intrinsic.txt delete mode 100644 src/CBot/TestCBot/methode1.txt delete mode 100644 src/CBot/TestCBot/methode2.txt delete mode 100644 src/CBot/TestCBot/mp1.txt delete mode 100644 src/CBot/TestCBot/mp2.txt delete mode 100644 src/CBot/TestCBot/mw.txt delete mode 100644 src/CBot/TestCBot/null.txt delete mode 100644 src/CBot/TestCBot/opnew.txt delete mode 100644 src/CBot/TestCBot/plante.txt delete mode 100644 src/CBot/TestCBot/pointer.txt delete mode 100644 src/CBot/TestCBot/postinc.txt delete mode 100644 src/CBot/TestCBot/radar.txt delete mode 100644 src/CBot/TestCBot/res/TestCBot.ico delete mode 100644 src/CBot/TestCBot/res/TestCBot.rc2 delete mode 100644 src/CBot/TestCBot/res/TestCBotDoc.ico delete mode 100644 src/CBot/TestCBot/res/Toolbar.bmp delete mode 100644 src/CBot/TestCBot/resource.h delete mode 100644 src/CBot/TestCBot/solution.txt delete mode 100644 src/CBot/TestCBot/test.txt delete mode 100644 src/CBot/TestCBot/test23.txt delete mode 100644 src/CBot/TestCBot/testmw.txt delete mode 100644 src/CBot/TestCBot/this.txt delete mode 100644 src/CBot/TestCBot/tt.txt delete mode 100644 src/CBot/TestCBot/tt2.txt delete mode 100644 src/CBot/TestCBot/vide.txt delete mode 100644 src/CBot/TestCBot/xTestCBot.clw delete mode 100644 src/CBot/TestCBot/zz.txt delete mode 100644 src/CBot/_Copy.bat delete mode 100644 src/CBot/colobot.ini delete mode 100644 src/CBot/old TstCBot/BotConsoleDlg.cpp delete mode 100644 src/CBot/old TstCBot/BotConsoleDlg.h delete mode 100644 src/CBot/old TstCBot/BotErrorDlg.cpp delete mode 100644 src/CBot/old TstCBot/BotErrorDlg.h delete mode 100644 src/CBot/old TstCBot/CBotTest.txt delete mode 100644 src/CBot/old TstCBot/CMyThread.cpp delete mode 100644 src/CBot/old TstCBot/CMyThread.h delete mode 100644 src/CBot/old TstCBot/MainFrm.cpp delete mode 100644 src/CBot/old TstCBot/MainFrm.h delete mode 100644 src/CBot/old TstCBot/ReadMe.txt delete mode 100644 src/CBot/old TstCBot/Resource.h delete mode 100644 src/CBot/old TstCBot/StdAfx.cpp delete mode 100644 src/CBot/old TstCBot/StdAfx.h delete mode 100644 src/CBot/old TstCBot/TstCBot.clw delete mode 100644 src/CBot/old TstCBot/TstCBot.cpp delete mode 100644 src/CBot/old TstCBot/TstCBot.dsp delete mode 100644 src/CBot/old TstCBot/TstCBot.h delete mode 100644 src/CBot/old TstCBot/TstCBot.rc delete mode 100644 src/CBot/old TstCBot/TstCBotDoc.cpp delete mode 100644 src/CBot/old TstCBot/TstCBotDoc.h delete mode 100644 src/CBot/old TstCBot/TstCBotView.cpp delete mode 100644 src/CBot/old TstCBot/TstCBotView.h delete mode 100644 src/CBot/old TstCBot/res/TstCBot.ico delete mode 100644 src/CBot/old TstCBot/res/TstCBot.rc2 delete mode 100644 src/CBot/old TstCBot/res/TstCBotDoc.ico delete mode 100644 src/CBot/old TstCBot/test complet 1.txt delete mode 100644 src/CBot/old TstCBot/x.txt create mode 100644 src/CBot/tests/TestCBot/CBotConsoleDlg.cpp create mode 100644 src/CBot/tests/TestCBot/CBotConsoleDlg.h create mode 100644 src/CBot/tests/TestCBot/ChildFrm.cpp create mode 100644 src/CBot/tests/TestCBot/ChildFrm.h create mode 100644 src/CBot/tests/TestCBot/MainFrm.cpp create mode 100644 src/CBot/tests/TestCBot/MainFrm.h create mode 100644 src/CBot/tests/TestCBot/PerformDlg.cpp create mode 100644 src/CBot/tests/TestCBot/PerformDlg.h create mode 100644 src/CBot/tests/TestCBot/Routines.cpp create mode 100644 src/CBot/tests/TestCBot/StdAfx.cpp create mode 100644 src/CBot/tests/TestCBot/StdAfx.h create mode 100644 src/CBot/tests/TestCBot/TestCBot.clw create mode 100644 src/CBot/tests/TestCBot/TestCBot.cpp create mode 100644 src/CBot/tests/TestCBot/TestCBot.dsp create mode 100644 src/CBot/tests/TestCBot/TestCBot.h create mode 100644 src/CBot/tests/TestCBot/TestCBot.rc create mode 100644 src/CBot/tests/TestCBot/TestCBotDoc.cpp create mode 100644 src/CBot/tests/TestCBot/TestCBotDoc.h create mode 100644 src/CBot/tests/TestCBot/TestCBotView.cpp create mode 100644 src/CBot/tests/TestCBot/TestCBotView.h create mode 100644 "src/CBot/tests/TestCBot/a\2471.txt~" create mode 100644 src/CBot/tests/TestCBot/res/TestCBot.ico create mode 100644 src/CBot/tests/TestCBot/res/TestCBot.rc2 create mode 100644 src/CBot/tests/TestCBot/res/TestCBotDoc.ico create mode 100644 src/CBot/tests/TestCBot/res/Toolbar.bmp create mode 100644 src/CBot/tests/TestCBot/resource.h create mode 100644 src/CBot/tests/TestCBot/scenarios/B.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/BUG2.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/Deleted.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/MaClass.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/Mc2.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/Mon fichier.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/Nop.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/POS.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/T.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TESTALL.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestCB1.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestCBot1.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestCBot3.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestNull.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestStatic.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/TestStr.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/Z.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/a1.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/array.txt create mode 100644 "src/CBot/tests/TestCBot/scenarios/a\2361.txt" create mode 100644 "src/CBot/tests/TestCBot/scenarios/a\2471.txt" create mode 100644 src/CBot/tests/TestCBot/scenarios/bug.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/bugmw.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/ccc.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/enum.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/fibo.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/file.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/h.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/include.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/intrinsic.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/methode1.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/methode2.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/mp1.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/mp2.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/mw.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/null.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/opnew.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/plante.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/pointer.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/postinc.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/radar.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/solution.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/test.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/test23.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/testmw.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/this.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/tt.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/tt2.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/vide.txt create mode 100644 src/CBot/tests/TestCBot/scenarios/zz.txt create mode 100644 src/CBot/tests/TestCBot/xTestCBot.clw create mode 100644 src/CBot/tests/old TstCBot/BotConsoleDlg.cpp create mode 100644 src/CBot/tests/old TstCBot/BotConsoleDlg.h create mode 100644 src/CBot/tests/old TstCBot/BotErrorDlg.cpp create mode 100644 src/CBot/tests/old TstCBot/BotErrorDlg.h create mode 100644 src/CBot/tests/old TstCBot/CBotTest.txt create mode 100644 src/CBot/tests/old TstCBot/CMyThread.cpp create mode 100644 src/CBot/tests/old TstCBot/CMyThread.h create mode 100644 src/CBot/tests/old TstCBot/MainFrm.cpp create mode 100644 src/CBot/tests/old TstCBot/MainFrm.h create mode 100644 src/CBot/tests/old TstCBot/ReadMe.txt create mode 100644 src/CBot/tests/old TstCBot/Resource.h create mode 100644 src/CBot/tests/old TstCBot/StdAfx.cpp create mode 100644 src/CBot/tests/old TstCBot/StdAfx.h create mode 100644 src/CBot/tests/old TstCBot/TstCBot.clw create mode 100644 src/CBot/tests/old TstCBot/TstCBot.cpp create mode 100644 src/CBot/tests/old TstCBot/TstCBot.dsp create mode 100644 src/CBot/tests/old TstCBot/TstCBot.h create mode 100644 src/CBot/tests/old TstCBot/TstCBot.rc create mode 100644 src/CBot/tests/old TstCBot/TstCBotDoc.cpp create mode 100644 src/CBot/tests/old TstCBot/TstCBotDoc.h create mode 100644 src/CBot/tests/old TstCBot/TstCBotView.cpp create mode 100644 src/CBot/tests/old TstCBot/TstCBotView.h create mode 100644 src/CBot/tests/old TstCBot/res/TstCBot.ico create mode 100644 src/CBot/tests/old TstCBot/res/TstCBot.rc2 create mode 100644 src/CBot/tests/old TstCBot/res/TstCBotDoc.ico create mode 100644 src/CBot/tests/old TstCBot/test complet 1.txt create mode 100644 src/CBot/tests/old TstCBot/x.txt diff --git a/src/CBot/CBot.aps b/src/CBot/CBot.aps deleted file mode 100644 index cd294ec..0000000 Binary files a/src/CBot/CBot.aps and /dev/null differ diff --git a/src/CBot/TestCBot/B.txt b/src/CBot/TestCBot/B.txt deleted file mode 100644 index 53715f8..0000000 --- a/src/CBot/TestCBot/B.txt +++ /dev/null @@ -1,18 +0,0 @@ - - float [ ] TEST2 ( int [ ] param ) - { - float [ ] z; - for ( int i = 0 ; i < sizeof( param ) ; i++ ) try { z [i] = param [i] / 3; } - return z; - } - -extern public void T() -{ - int a [4]; - for ( int i = 0 ; i < 3 ; i++ ) a[i] = 4*i; - a [2] = 22; - - float [] b ; - b = TEST2 ( a ) ; - show ( a, b ); -} diff --git a/src/CBot/TestCBot/BUG2.txt b/src/CBot/TestCBot/BUG2.txt deleted file mode 100644 index 44de05a..0000000 --- a/src/CBot/TestCBot/BUG2.txt +++ /dev/null @@ -1,107 +0,0 @@ -object object :: TT ( int n ) -{ - object XX = radar(); - if ( n == 0 ) return null; - - while ( null == XX ) XX = radar(); - return XX; -} - -extern void object::Attack( ) -{ - show ( TT ( 0 ) ) ; - show ( TT ( 1 ) ) ; - return; - - int list[]; - int i; - object p; - float dist, prox; - point dest; - boolean advance = true; - - TEST(0); // ne stoppe pas si erreur -// while ( F () != 0 ) F(1); - - i = 0; - list[i++] = WingedGrabber; - list[i++] = TrackedGrabber; - list[i++] = WheeledGrabber; - list[i++] = LeggedGrabber; - list[i++] = WingedShooter; - list[i++] = TrackedShooter; - list[i++] = WheeledShooter; - list[i++] = LeggedShooter; - list[i++] = WingedOrgaShooter; - list[i++] = TrackedOrgaShooter; - list[i++] = WheeledOrgaShooter; - list[i++] = LeggedOrgaShooter; - list[i++] = WingedSniffer; - list[i++] = TrackedSniffer; - list[i++] = WheeledSniffer; - list[i++] = LeggedSniffer; - list[i++] = Thumper; - list[i++] = PhazerShooter; - list[i++] = Recycler; - list[i++] = Shielder; - list[i++] = Subber; - list[i++] = Me; - list[i++] = 3333; - list[i++] = 3334; - list[i++] = 3335; - list[i++] = 3336; - list[i++] = 3337; - list[i++] = 3338; - list[i++] = 3339; - list[i++] = 3331; - list[i++] = 3332; - list[i++] = 3330; - list[i++] = 1111; - list[i++] = 1112; - - F(F(0)); - - while ( true ) - { - p = radar(list, 0, 360, 0, 1000); - if ( p == null ) - { - F(2); - } - else - { - dist = F(p.position, position); - if ( dist <= 40 && !advance ) - { - fire(p.position); - advance = true; - } - else - { -//? if ( RetBaseDistance() > 20 ) - { - prox = dist-(5+F()*5); - if ( prox < 5 ) prox = 5; - dest.x = (position.x-p.position.x)*prox/dist + p.position.x; - dest.y = (position.y-p.position.y)*prox/dist + p.position.y; - dest.z = (position.z-p.position.z)*prox/dist + p.position.z; - goto(dest); - advance = false; - } - } - } - } -} - -// Calcule la distance jusqu'à la base. - -float object::RetBaseDistance() -{ - object p; - float dist; - - p = radar(4444, 0, 360, 0, 1000); - if ( p == null ) return 1000; - dist = F(p.position, position); - return dist; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/CBotConsoleDlg.cpp b/src/CBot/TestCBot/CBotConsoleDlg.cpp deleted file mode 100644 index 55a271a..0000000 --- a/src/CBot/TestCBot/CBotConsoleDlg.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// CBotConsoleDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "TestCBot.h" -#include "CBotConsoleDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg dialog - - -CBotConsoleDlg::CBotConsoleDlg(CWnd* pParent /*=NULL*/) - : CDialog(CBotConsoleDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CBotConsoleDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_pProg = NULL; - m_threadinfo.m_bRun = FALSE; - m_code = 0; -} - - -void CBotConsoleDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CBotConsoleDlg) - DDX_Control(pDX, IDOK, m_cOK); - DDX_Control(pDX, IDC_EDIT2, m_Edit2); - DDX_Control(pDX, IDC_EDIT1, m_Edit1); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CBotConsoleDlg, CDialog) - //{{AFX_MSG_MAP(CBotConsoleDlg) - ON_MESSAGE(WM_ENDPROG, EndProg) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg message handlers - -UINT ThreadProc(ThreadInfo *info) -{ - CTime t0 = CTime::GetCurrentTime(); - 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->GivStackVars(FN, level--); - if ( FN != FunctionName ) break; - if ( t != NULL ) - { - CString s ; - while ( t != NULL ) - { - if (s.IsEmpty()) s+= "Stack -> "; - else s+= " , "; - s += t->GivValString(); - t = t->GivNext(); - } - AfxMessageBox(s); - } - } while (TRUE); - } -#endif - Cpt++; - if ( Cpt%50 == 0 ) info->m_pEdit1->ReplaceSel("."); - } - - if ( info->m_bStop ) - { - info->m_pEdit1->ReplaceSel("\r\nInterrompu\r\n"); - } - else if (info->m_pProg->GivError() == 0) - { - CTime t = CTime::GetCurrentTime(); - CTimeSpan ts = t - t0; - - char buffer[200]; - sprintf( buffer, "\r\nExécution terminée en %d secondes.\r\nInterrompue %d fois.\r\n", - ts.GetTotalSeconds(), Cpt); - - info->m_pEdit1->ReplaceSel(buffer); - } - - info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; - return 0 ; -} - -LONG CBotConsoleDlg::EndProg(UINT wparam, LONG lparam) -{ - m_threadinfo.m_bRun = FALSE; - - if (m_pProg->GetError(m_code, m_start, m_end)) - { - CBotString TextError; - TextError = CBotProgram::GivErrorText(m_code); - AfxMessageBox(TextError); - CDialog::OnCancel(); - return 1; - } - delete m_pProg; - m_pProg = NULL; - - m_Edit2.EnableWindow(TRUE); - m_cOK.EnableWindow(TRUE); - - m_Edit2.SetWindowText(""); - m_Edit2.SetFocus(); - return 0 ; -} - -void CBotConsoleDlg::OnOK() -{ - CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); - pApp->m_pConsole = &m_Edit1; - m_code = 0; - - CString Commande; - m_Edit2.GetWindowText(Commande); - - CString s = "void LaCommande() { " + Commande + " ;}"; - m_pProg = new CBotProgram(); - CBotStringArray liste; - m_pProg->Compile(s, liste); - - int err, start, end; - if ( m_pProg->GetError(err, start, end) ) - { - CBotString TextError; - TextError = CBotProgram::GivErrorText(err); - AfxMessageBox(TextError); - m_Edit2.SetSel(start-20, end-20); - return; - } - - m_Edit1.ReplaceSel("\r\n" + Commande + " ->\r\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; - - AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; -} - -void CBotConsoleDlg::OnCancel() -{ - if (!m_threadinfo.m_bRun) CDialog::OnCancel(); - m_threadinfo.m_bStop = TRUE ; -} - - -BOOL CBotConsoleDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n"); - for ( int i = 0; i < m_pListe->GivSize(); i++ ) - { - CBotString x = (*m_pListe)[i] + CBotString("\r\n"); - m_Edit1.ReplaceSel(x); - } - m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n"); - - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/src/CBot/TestCBot/CBotConsoleDlg.h b/src/CBot/TestCBot/CBotConsoleDlg.h deleted file mode 100644 index f289a4d..0000000 --- a/src/CBot/TestCBot/CBotConsoleDlg.h +++ /dev/null @@ -1,85 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) -#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// CBotConsoleDlg.h : header file -// - -struct ThreadInfo -{ - CEdit* m_pEdit1 ; - CEdit* m_pEditx ; - CBotProgram* m_pProg; - CWnd* m_pWndMessage; - BOOL m_bStop; - BOOL m_bRun; -}; - - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg dialog - -class CBotConsoleDlg : public CDialog -{ -// Construction -public: - CBotConsoleDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CBotConsoleDlg) - enum { IDD = IDD_CONSOLE }; - CButton m_cOK; - CEdit m_Edit2; - CEdit m_Edit1; - //}}AFX_DATA - - CBotProgram* m_pProg; - ThreadInfo m_threadinfo; - - CBotStringArray* - m_pListe; - int m_code, m_start, m_end; - CEdit* m_pEditx; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBotConsoleDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CBotConsoleDlg) - virtual void OnOK(); - virtual void OnCancel(); - virtual BOOL OnInitDialog(); - afx_msg LONG EndProg(UINT wparam, LONG lparam) ; - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/ChildFrm.cpp b/src/CBot/TestCBot/ChildFrm.cpp deleted file mode 100644 index 4c40f90..0000000 --- a/src/CBot/TestCBot/ChildFrm.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// ChildFrm.cpp : implementation of the CChildFrame class -// - -#include "stdafx.h" -#include "TestCBot.h" - -#include "ChildFrm.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CChildFrame - -IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) - -BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) - //{{AFX_MSG_MAP(CChildFrame) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CChildFrame construction/destruction - -CChildFrame::CChildFrame() -{ -} - -CChildFrame::~CChildFrame() -{ -} - -BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - return CMDIChildWnd::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CChildFrame diagnostics - -#ifdef _DEBUG -void CChildFrame::AssertValid() const -{ - CMDIChildWnd::AssertValid(); -} - -void CChildFrame::Dump(CDumpContext& dc) const -{ - CMDIChildWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CChildFrame message handlers diff --git a/src/CBot/TestCBot/ChildFrm.h b/src/CBot/TestCBot/ChildFrm.h deleted file mode 100644 index 2ad57b6..0000000 --- a/src/CBot/TestCBot/ChildFrm.h +++ /dev/null @@ -1,66 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// ChildFrm.h : interface of the CChildFrame class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CChildFrame : public CMDIChildWnd -{ - DECLARE_DYNCREATE(CChildFrame) -public: - CChildFrame(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CChildFrame) - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CChildFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -// Generated message map functions -protected: - //{{AFX_MSG(CChildFrame) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/Deleted.txt b/src/CBot/TestCBot/Deleted.txt deleted file mode 100644 index 469a624..0000000 --- a/src/CBot/TestCBot/Deleted.txt +++ /dev/null @@ -1,23 +0,0 @@ -public extern void object :: ESSAI() -{ - while(true) - { - if ( true ) - { - goto(12); - break; - } - } - object x = null ; - - while ( x == null ) x = radar(); - - show ( x.position ) ; - - TEST(5, x); - - if ( x == null ) show ( "DELETED" ); - - show ( x.position ) ; - -} \ No newline at end of file diff --git a/src/CBot/TestCBot/MaClass.txt b/src/CBot/TestCBot/MaClass.txt deleted file mode 100644 index ac472b4..0000000 --- a/src/CBot/TestCBot/MaClass.txt +++ /dev/null @@ -1,16 +0,0 @@ - -class MaClass -{ - int a = 1 ; - MaClass pointeur ; - MaClass next = null ; - CPoint autre = new CPoint( 1 , 1 ) ; -} - -extern public void Test ( ) -{ - MaClass x () ; - x.next = new MaClass ( ) ; - println ( x ) ; -} - diff --git a/src/CBot/TestCBot/MainFrm.cpp b/src/CBot/TestCBot/MainFrm.cpp deleted file mode 100644 index 6669350..0000000 --- a/src/CBot/TestCBot/MainFrm.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "TestCBot.h" - -#include "MainFrm.h" -#include "TestCBotDoc.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) - ON_WM_CREATE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() -{ -} - -CMainFrame::~CMainFrame() -{ -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndToolBar.Create(this) || - !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) - { - TRACE0("Failed to create toolbar\n"); - return -1; // fail to create - } - - if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - - m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | - CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); - - m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); - EnableDocking(CBRS_ALIGN_ANY); - DockControlBar(&m_wndToolBar); - - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - return CMDIFrameWnd::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - CMDIFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - CMDIFrameWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers - - diff --git a/src/CBot/TestCBot/MainFrm.h b/src/CBot/TestCBot/MainFrm.h deleted file mode 100644 index a1d34f4..0000000 --- a/src/CBot/TestCBot/MainFrm.h +++ /dev/null @@ -1,72 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// MainFrm.h : interface of the CMainFrame class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CMainFrame : public CMDIFrameWnd -{ - DECLARE_DYNAMIC(CMainFrame) -public: - CMainFrame(); - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainFrame) - public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; - -// Generated message map functions -protected: - //{{AFX_MSG(CMainFrame) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/Mc2.txt b/src/CBot/TestCBot/Mc2.txt deleted file mode 100644 index 172c259..0000000 --- a/src/CBot/TestCBot/Mc2.txt +++ /dev/null @@ -1,4 +0,0 @@ -class MaClass -{ - int t = 12; -} diff --git a/src/CBot/TestCBot/Mon fichier.txt b/src/CBot/TestCBot/Mon fichier.txt deleted file mode 100644 index 6b35bf8..0000000 --- a/src/CBot/TestCBot/Mon fichier.txt +++ /dev/null @@ -1,2 +0,0 @@ -Voici encore du texte -et une seconde ligne diff --git a/src/CBot/TestCBot/Nop.txt b/src/CBot/TestCBot/Nop.txt deleted file mode 100644 index 6a66f6f..0000000 --- a/src/CBot/TestCBot/Nop.txt +++ /dev/null @@ -1,4 +0,0 @@ -public extern void Nop() -{ - while ( true ) {} -} \ No newline at end of file diff --git a/src/CBot/TestCBot/POS.txt b/src/CBot/TestCBot/POS.txt deleted file mode 100644 index 688e4fb..0000000 --- a/src/CBot/TestCBot/POS.txt +++ /dev/null @@ -1,14 +0,0 @@ -void object :: T ( ) -{ - show ( position ) ; -} - -public extern void object :: POS() -{ - for ( int i = 0; i < 10 ; i++ ) - { - if ( i == 2 ) TEST ( 12 ) ; -// show ( position ); - T ( ) ; - } -} \ No newline at end of file diff --git a/src/CBot/TestCBot/PerformDlg.cpp b/src/CBot/TestCBot/PerformDlg.cpp deleted file mode 100644 index 8abbb4b..0000000 --- a/src/CBot/TestCBot/PerformDlg.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// PerformDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "testcbot.h" -#include "PerformDlg.h" - -//#include -#include -//#include - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CPerformDlg dialog - - -CPerformDlg::CPerformDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPerformDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CPerformDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void CPerformDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CPerformDlg) - DDX_Control(pDX, IDC_EDIT3, m_Edit3); - DDX_Control(pDX, IDC_EDIT1, m_Edit1); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CPerformDlg, CDialog) - //{{AFX_MSG_MAP(CPerformDlg) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CPerformDlg message handlers - -/* Pauses for a specified number of milliseconds. */ - -/*void sleep( double waitseconds ) -{ - clock_t wait = (clock_t)(waitseconds * CLOCKS_PER_SEC); - clock_t goal; - goal = wait + clock(); - while( goal > clock() ) - ; -}*/ - -void sleep( clock_t wait ) -{ - clock_t goal; - goal = wait + clock(); - while( goal > clock() ) - TRACE("%d \n", clock() ); -} - -void sleep2( clock_t wait ) -{ - struct _timeb timebuffer; - char *timeline; - - _ftime( &timebuffer ); - timeline = ctime( & ( timebuffer.time ) ); - long x = timebuffer.millitm; - while( x == timebuffer.millitm ) _ftime( &timebuffer ); -} - -#define NBLP 20 - -UINT ThreadProc2(ThreadInfo2 *info) -{ - int lp = NBLP; - int i; - clock_t start = clock(); - - while ( !info->m_bStop ) - { - for ( i = 0; i< info->m_nbscripts; i++ ) - { - info->m_pProg[i]->Run(); - } - -#ifdef _DEBUG - sleep2( 1 ); -#else - CString s ( "xx" ); - for ( long z = 0x5000; z>0; z-- ) s = s.Left(1); -#endif - if ( --lp == 0 ) - { - clock_t finish = clock(); - double n = (double)NBLP / (double)(finish-start) * CLOCKS_PER_SEC; - char b[30]; - sprintf( b, "%f", n); - info->m_pEdit->SetWindowText(b); - - n = n * 1100 / 200; // performances - sprintf( b, "%f", n); - info->m_pEdit3->SetWindowText(b); - start = finish; - lp = NBLP; - } - } - - return 0 ; -} - -BOOL CPerformDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - - CBotStringArray liste; - // crée les scripts pour les tests - for ( int i = 0; i < 100; i++ ) - { - m_pProg[i] = new CBotProgram(); - m_pProg[i]->Compile(m_Script, liste); - m_pProg[i]->Start(liste[0]); - } - - // lance un processus paralèle pour l'exécution -// m_threadinfo2.m_pWndMessage = this ; - - m_threadinfo2.m_pEdit = &m_Edit1; - m_threadinfo2.m_pEdit3 = &m_Edit3; - m_threadinfo2.m_pProg = m_pProg; - m_threadinfo2.m_bStop = FALSE; - m_threadinfo2.m_nbscripts = 30; - - - AfxBeginThread((AFX_THREADPROC)ThreadProc2, &m_threadinfo2) ; - // TODO: Add extra initialization here - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - -void CPerformDlg::OnCancel() -{ - m_threadinfo2.m_bStop = TRUE; - sleep ( 2000 ); - - CDialog::OnCancel(); - - for ( int i = 0; i < 100; i++ ) - { - delete m_pProg[i]; - } -} diff --git a/src/CBot/TestCBot/PerformDlg.h b/src/CBot/TestCBot/PerformDlg.h deleted file mode 100644 index 29d567f..0000000 --- a/src/CBot/TestCBot/PerformDlg.h +++ /dev/null @@ -1,78 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -#if !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_) -#define AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// PerformDlg.h : header file -// - -struct ThreadInfo2 -{ - CEdit* m_pEdit ; - CEdit* m_pEdit3 ; - - CBotProgram** m_pProg; - BOOL m_bStop; - int m_nbscripts; -}; - - -///////////////////////////////////////////////////////////////////////////// -// CPerformDlg dialog - -class CPerformDlg : public CDialog -{ -// Construction -public: - CPerformDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CPerformDlg) - enum { IDD = IDD_DIALOG1 }; - CEdit m_Edit3; - CEdit m_Edit1; - //}}AFX_DATA - - CBotProgram* m_pProg[100]; - ThreadInfo2 m_threadinfo2; - CString m_Script; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CPerformDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CPerformDlg) - virtual BOOL OnInitDialog(); - virtual void OnCancel(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/Routines.cpp b/src/CBot/TestCBot/Routines.cpp deleted file mode 100644 index b37f027..0000000 --- a/src/CBot/TestCBot/Routines.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -//////////////////////////////////////////////////////////////////// -// routine show() -// utilisable depuis le programme écrit en CBot - -// exécution -BOOL rShow( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) -{ - CString s; - - while ( pVar != NULL ) - { - CString ss; - ss.LoadString( TX_TYPENAMES + pVar->GivType() ); - s += ss + " "; - - ss = pVar->GivName(); - if (ss.IsEmpty()) ss = ""; - s += ss + " = "; - - s += pVar->GivValString(); - s += "\n"; - pVar = pVar->GivNext(); - } - - 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 ) -{ - CString s; - - CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); - CEdit* pEdit = pApp->m_pConsole; - - if (pEdit == NULL) return TRUE; - pEdit->GetWindowText(s); - - while ( pVar != NULL ) - { - if ( !s.IsEmpty() ) s += " "; - s += pVar->GivValString(); - pVar = pVar->GivNext(); - } - s += "\r\n"; - - pEdit->SetWindowText(s); - pEdit->SetSel(s.GetLength(), s.GetLength()); - pEdit->SetFocus(); - return TRUE; // pas d'interruption -} - -BOOL rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) -{ - CString s; - - CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); - CEdit* pEdit = pApp->m_pConsole; - - if (pEdit == NULL) return TRUE; - pEdit->GetWindowText(s); - - while ( pVar != NULL ) - { - if ( !s.IsEmpty() ) s += " "; - s += pVar->GivValString(); - pVar = pVar->GivNext(); - } - - pEdit->SetWindowText(s); - pEdit->SetSel(s.GetLength(), s.GetLength()); - pEdit->SetFocus(); - 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 ) -{ - CString s; - - if ( pVar == NULL )return TRUE; // constructeur sans paramètres est ok - - CBotVar* pX = pThis->GivItem("x"); - pX->SetValFloat( pVar->GivValFloat() ); - pVar = pVar->GivNext(); - - CBotVar* pY = pThis->GivItem("y"); - pY->SetValFloat( pVar->GivValFloat() ); - pVar = pVar->GivNext(); - - return TRUE; // pas d'interruption -} - -CBotTypResult cCPoint( CBotVar* pThis, CBotVar* &pVar) -{ - // ok si aucun paramètres ! - if ( pVar == NULL ) return CBotTypResult(0); - - // paramètre de type numérique svp - if ( pVar->GivType() > CBotTypDouble ) return CBotTypResult(5011); - pVar = pVar->GivNext(); - - // il doit y avoir un second paramètre - if ( pVar == NULL ) return 5028; - // également de type numérique - if ( pVar->GivType() > CBotTypDouble )return CBotTypResult(5011); - pVar = pVar->GivNext(); - - // et pas plus de 2 paramètres svp - if ( pVar != NULL ) return CBotTypResult(5026); - - return CBotTypResult(0); // cette fonction retourne void -} - - diff --git a/src/CBot/TestCBot/StdAfx.cpp b/src/CBot/TestCBot/StdAfx.cpp deleted file mode 100644 index 7dd0f00..0000000 --- a/src/CBot/TestCBot/StdAfx.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// stdafx.cpp : source file that includes just the standard includes -// TestCBot.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - diff --git a/src/CBot/TestCBot/StdAfx.h b/src/CBot/TestCBot/StdAfx.h deleted file mode 100644 index c3659fb..0000000 --- a/src/CBot/TestCBot/StdAfx.h +++ /dev/null @@ -1,40 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC OLE automation classes -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/T.txt b/src/CBot/TestCBot/T.txt deleted file mode 100644 index 50a792b..0000000 --- a/src/CBot/TestCBot/T.txt +++ /dev/null @@ -1,4 +0,0 @@ -public extern int T ( float n ) -{ - return n * 1.1; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/TESTALL.txt b/src/CBot/TestCBot/TESTALL.txt deleted file mode 100644 index 82247a0..0000000 --- a/src/CBot/TestCBot/TESTALL.txt +++ /dev/null @@ -1,161 +0,0 @@ -int T ( int z ) -{ - return 45 + z ; -} - -class toto -{ - int val = 3 ; - int x = 3 * 3 ; - void toto( int n ) - { val = n + 3 ; } - int retval ( int param ) - { int r = val + param + x ; - val = param ; - return r ; } -} - -public extern void object :: Chose( ) -{ - int z [ 6 ]; - for ( int i = 0 ; i < 6 ; ) z [ i++ ] = 3 - i ; - show ( z ) ; - return; - - // test des tableaux - int [ ] a [ 3 ] ; -// a = null; - if ( a == null ) show ( "NULL" ); - - a [ 2 / 2 ] [ 2 ]= 5 ; - int [ ] b ; b = a [1] ; - b [ 0 ] = -4; - a [ 4 / 2 ] [ 1 ]= 1 ; - show ( a , b ) ; - return ; - { - toto chose = new toto (5 ) ; - toto truc = chose ; - show ( chose, chose.retval( 100 ) , - truc, truc.retval (40 ) ) ; - - return; - } - { - point A = new - point ( 4 * 4 , 2 ) ; - show ( A ) ; - return; - } - { - show ( T ( 1 ) , T ( 3.7 ) ) ; - return; - } - - { - point A ( 3, 4 ) , - B = A ; - - int n = -4; - show ( n ); - - show ( A, B ) ; - - boolean a = false; - boolean b = a or true; - if ( not a and b ) ; - return; - } - { - // test try - float x = nan ; int z = 0 ; - try { -// throw ( 3 * 4 + 33 ) ; - int zz ; goto ( 12 ) ; z = 1 ; z = 0 / 0 ; z = 2 ; - } - catch ( 45 + 0 * 6000 ) - { - show( "Exception 6000", z ) ; - } - catch ( x == 0 ) { show( "x nul" ) ; } - finally { show ( "fini" ) ; } - show ( "continue" ); - return; - } - { - // test des if - int a = 3; - if ( a == 3 ) show ( "33"); - else show ( "44"); - if ( a != 3 ) show ( "333"); - else show ( "444"); - return; - } - { - int a = 0; - // test break -un: - while ( true ) - { -deux: - while ( true ) - { - a++; - if ( a == 2 ) continue; - if ( a == 3 ) break deux; - show ( a ) ; - if ( a == 5 ) break un; - } - show ( "DEUX" ); - } - return; - } - { - // test switch - int a = 0; - - switch ( a ) - { - case 1 : show( "un" ) ; break; - case 2 : show( "deux" ) ; // break; - case 3 : show( "trois" ) ; break; - case 4 : show( "quatre" ) ; // break; - default : show( "par défaut" ) ; - } - return; - } - { - // test boucle while - float z = 3.3; - while ( z > 0 ) - { show ( z-- ) ; } - return; - } - - { - // test boucle do - float y = 3.3; - do { int x = 0; show(y); y++; } while ( y < 7 ) ; - return; - } - // test boucle for - int j = -7; show ( j ); - for ( int ii = 3, j = 31; ii < 6 ; ++ii, j = j -3 ) - { - j = 10 * j; - show ( ii, j ); - } - return; -{ - // déclarations de variables - int a; int b = 3; int c = 4*b, d = 1, e; - float x; float y = 3.3; float z = y / 2, u = 1, v; - boolean t; boolean tt = true or false; boolean ttt = false, tttt = true, t5; - string s; string ss = "hello"; string s2 = ss + " plus", s3 = "s3", s4; - - show( b, c, d ); - show( y, z, u ); - show( tt, ttt, tttt ); - show( ss, s2, s3 ); -} -} \ No newline at end of file diff --git a/src/CBot/TestCBot/TestCB1.txt b/src/CBot/TestCBot/TestCB1.txt deleted file mode 100644 index 516db47..0000000 --- a/src/CBot/TestCBot/TestCB1.txt +++ /dev/null @@ -1,18 +0,0 @@ -extern public void toto() -{ - print( "hello" ) ; - print( fac(5) ); - print( t() ) ; -} - -public int fac(int n) -{ - if ( n<2 ) return 1; - return n * fac(n-1); -} - -point t() -{ - point a(1,2); - return a; -} diff --git a/src/CBot/TestCBot/TestCBot.clw b/src/CBot/TestCBot/TestCBot.clw deleted file mode 100644 index 13f20f4..0000000 --- a/src/CBot/TestCBot/TestCBot.clw +++ /dev/null @@ -1,316 +0,0 @@ -; CLW file contains information for the MFC ClassWizard - -[General Info] -Version=1 -LastClass=CPerformDlg -LastTemplate=CDialog -NewFileInclude1=#include "stdafx.h" -NewFileInclude2=#include "testcbot.h" -LastPage=0 - -ClassCount=8 -Class1=CBotConsoleDlg -Class2=CChildFrame -Class3=CMainFrame -Class4=CTestCBotApp -Class5=CAboutDlg -Class6=CTestCBotDoc -Class7=CTestCBotView - -ResourceCount=12 -Resource1=IDD_CONSOLE -Resource2=IDR_TESTCBTYPE (French (France)) -Resource3=IDD_ABOUTBOX (French (France)) -Resource4=IDR_MAINFRAME (French (France)) -Resource5=IDR_MAINFRAME -Resource6=IDR_TESTCBTYPE -Resource7=IDD_ABOUTBOX -Resource8=IDD_CONSOLE (French (Switzerland)) -Class8=CPerformDlg -Resource9=IDD_DIALOG1 -Resource10=IDD_DIALOG2 -Resource11=IDD_DIALOG1 (French (Switzerland)) -Resource12=IDD_DIALOG2 (French (France)) - -[CLS:CBotConsoleDlg] -Type=0 -BaseClass=CDialog -HeaderFile=CBotConsoleDlg.h -ImplementationFile=CBotConsoleDlg.cpp -LastObject=IDC_EDIT1 - -[CLS:CChildFrame] -Type=0 -BaseClass=CMDIChildWnd -HeaderFile=ChildFrm.h -ImplementationFile=ChildFrm.cpp - -[CLS:CMainFrame] -Type=0 -BaseClass=CMDIFrameWnd -HeaderFile=MainFrm.h -ImplementationFile=MainFrm.cpp -Filter=T -VirtualFilter=fWC -LastObject=CMainFrame - -[CLS:CTestCBotApp] -Type=0 -BaseClass=CWinApp -HeaderFile=TestCBot.h -ImplementationFile=TestCBot.cpp -Filter=N -VirtualFilter=AC -LastObject=ID_TEST - -[CLS:CAboutDlg] -Type=0 -BaseClass=CDialog -HeaderFile=TestCBot.cpp -ImplementationFile=TestCBot.cpp -LastObject=CAboutDlg - -[CLS:CTestCBotDoc] -Type=0 -BaseClass=CDocument -HeaderFile=TestCBotDoc.h -ImplementationFile=TestCBotDoc.cpp -LastObject=CTestCBotDoc -Filter=N -VirtualFilter=DC - -[CLS:CTestCBotView] -Type=0 -BaseClass=CView -HeaderFile=TestCBotView.h -ImplementationFile=TestCBotView.cpp -LastObject=CTestCBotView -Filter=C -VirtualFilter=VWC - -[DLG:IDD_CONSOLE] -Type=1 -Class=CBotConsoleDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT2,edit,1350631552 -Control3=IDOK,button,1342242817 -Control4=IDC_EDIT1,edit,1352734724 - -[DLG:IDD_ABOUTBOX] -Type=1 -Class=CAboutDlg -ControlCount=7 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 -Control5=IDC_STATIC,static,1342308352 -Control6=IDC_STATIC,static,1342308352 -Control7=IDC_STATIC,static,1342308352 - -[TB:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_EDIT_CUT -Command5=ID_EDIT_COPY -Command6=ID_EDIT_PASTE -Command7=ID_FILE_PRINT -Command8=ID_RUN -Command9=ID_APP_ABOUT -CommandCount=9 - -[MNU:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_MRU_FILE1 -Command4=ID_APP_EXIT -Command5=ID_VIEW_TOOLBAR -Command6=ID_VIEW_STATUS_BAR -Command7=ID_APP_ABOUT -CommandCount=7 - -[MNU:IDR_TESTCBTYPE (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_CLOSE -Command4=ID_FILE_SAVE -Command5=ID_FILE_SAVE_AS -Command6=ID_FILE_MRU_FILE1 -Command7=ID_APP_EXIT -Command8=ID_EDIT_UNDO -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_VIEW_TOOLBAR -Command13=ID_VIEW_STATUS_BAR -Command14=ID_WINDOW_NEW -Command15=ID_WINDOW_CASCADE -Command16=ID_WINDOW_TILE_HORZ -Command17=ID_WINDOW_ARRANGE -Command18=ID_APP_ABOUT -CommandCount=18 - -[ACL:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_EDIT_COPY -Command2=ID_FILE_NEW -Command3=ID_FILE_OPEN -Command4=ID_FILE_SAVE -Command5=ID_EDIT_PASTE -Command6=ID_EDIT_UNDO -Command7=ID_EDIT_CUT -Command8=ID_RUN -Command9=ID_NEXT_PANE -Command10=ID_PREV_PANE -Command11=ID_RUN -Command12=ID_TEST -Command13=ID_EDIT_COPY -Command14=ID_EDIT_PASTE -Command15=ID_EDIT_CUT -Command16=ID_EDIT_UNDO -CommandCount=16 - -[DLG:IDD_ABOUTBOX (French (France))] -Type=1 -Class=CAboutDlg -ControlCount=7 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 -Control5=IDC_STATIC,static,1342308352 -Control6=IDC_STATIC,static,1342308352 -Control7=IDC_STATIC,static,1342308352 - -[ACL:IDR_MAINFRAME] -Type=1 -Command1=ID_EDIT_COPY -Command2=ID_FILE_NEW -Command3=ID_FILE_OPEN -Command4=ID_FILE_SAVE -Command5=ID_EDIT_PASTE -Command6=ID_EDIT_UNDO -Command7=ID_EDIT_CUT -Command8=ID_RUN -Command9=ID_NEXT_PANE -Command10=ID_PREV_PANE -Command11=ID_RUN -Command12=ID_TEST -Command13=ID_EDIT_COPY -Command14=ID_EDIT_PASTE -Command15=ID_EDIT_CUT -Command16=ID_EDIT_UNDO -CommandCount=16 - -[TB:IDR_MAINFRAME] -Type=1 -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_EDIT_CUT -Command5=ID_EDIT_COPY -Command6=ID_EDIT_PASTE -Command7=ID_FILE_PRINT -Command8=ID_RUN -Command9=ID_APP_ABOUT -CommandCount=9 - -[MNU:IDR_MAINFRAME] -Type=1 -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_MRU_FILE1 -Command4=ID_APP_EXIT -Command5=ID_VIEW_TOOLBAR -Command6=ID_VIEW_STATUS_BAR -Command7=ID_APP_ABOUT -CommandCount=7 - -[MNU:IDR_TESTCBTYPE] -Type=1 -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_CLOSE -Command4=ID_FILE_SAVE -Command5=ID_FILE_SAVE_AS -Command6=ID_FILE_MRU_FILE1 -Command7=ID_APP_EXIT -Command8=ID_EDIT_UNDO -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_VIEW_TOOLBAR -Command13=ID_VIEW_STATUS_BAR -Command14=ID_WINDOW_NEW -Command15=ID_WINDOW_CASCADE -Command16=ID_WINDOW_TILE_HORZ -Command17=ID_WINDOW_ARRANGE -Command18=ID_APP_ABOUT -CommandCount=18 - -[DLG:IDD_CONSOLE (French (Switzerland))] -Type=1 -Class=CBotConsoleDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT2,edit,1350631552 -Control3=IDOK,button,1342242817 -Control4=IDC_EDIT1,edit,1352734724 - -[DLG:IDD_DIALOG1] -Type=1 -Class=CPerformDlg -ControlCount=9 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT1,edit,1350633600 -Control3=IDC_STATIC,static,1342308352 -Control4=IDC_EDIT2,edit,1350631552 -Control5=IDC_SPIN1,msctls_updown32,1342177312 -Control6=IDC_COMBO1,combobox,1344339971 -Control7=IDC_STATIC,static,1342308352 -Control8=IDC_STATIC,static,1342308352 -Control9=IDC_EDIT3,edit,1350633600 - -[CLS:CPerformDlg] -Type=0 -HeaderFile=PerformDlg.h -ImplementationFile=PerformDlg.cpp -BaseClass=CDialog -Filter=D -VirtualFilter=dWC -LastObject=IDC_EDIT3 - -[DLG:IDD_DIALOG2] -Type=1 -ControlCount=2 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 - -[DLG:IDD_DIALOG1 (French (Switzerland))] -Type=1 -ControlCount=9 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT1,edit,1350633600 -Control3=IDC_STATIC,static,1342308352 -Control4=IDC_EDIT2,edit,1350631552 -Control5=IDC_SPIN1,msctls_updown32,1342177312 -Control6=IDC_COMBO1,combobox,1344339971 -Control7=IDC_STATIC,static,1342308352 -Control8=IDC_STATIC,static,1342308352 -Control9=IDC_EDIT3,edit,1350633600 - -[DLG:IDD_DIALOG2 (French (France))] -Type=1 -ControlCount=2 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 - diff --git a/src/CBot/TestCBot/TestCBot.cpp b/src/CBot/TestCBot/TestCBot.cpp deleted file mode 100644 index a76040a..0000000 --- a/src/CBot/TestCBot/TestCBot.cpp +++ /dev/null @@ -1,267 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// TestCBot.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "TestCBot.h" - -#include "MainFrm.h" -#include "ChildFrm.h" -#include "TestCBotDoc.h" -#include "TestCBotView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotApp - -BEGIN_MESSAGE_MAP(CTestCBotApp, CWinApp) - //{{AFX_MSG_MAP(CTestCBotApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - //}}AFX_MSG_MAP - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotApp construction - -CTestCBotApp::CTestCBotApp() -{ - m_pConsole = NULL; - m_LastActive = NULL; - m_pClassPoint= NULL; -} - - -///////////////////////////////////////////////////////////////////////////// -// The one and only CTestCBotApp object - -CTestCBotApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotApp initialization - -#include "Routines.cpp" - - -static char BASED_CODE szSection[] = "Recent File List"; -static char BASED_CODE szFilename[] = "File1"; - - -#include "../ClassFILE.cpp" - -// routine pour mettre à jour l'instance de la classe Bot courante -void rMajObject( CBotVar* pThis, void* pUser ) -{ - if (!pThis->IsElemOfClass("object")) - return ; - CBotVar* pPos = pThis->GivItem("position"); - CBotVar* pX = pPos->GivItem("x"); - CBotVar* pY = pPos->GivItem("y"); - CBotVar* pZ = pPos->GivItem("z"); -// CBotVar* pPt = pThis->GivItem("transport"); - - CBotString p = pX->GivValString(); - -// pX->SetValFloat( pUser == (void*)1 ? (float)12.5 : (float)44.4 ); - pZ->SetValFloat( (float)0 ); - pY->SetValFloat( (float)-3.33 ); - pX->SetValFloat( pX->GivValFloat() + 10 ) ; - -// pX = pThis->GivItem( "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; -} - - -BOOL CTestCBotApp::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(); - - AfxEnableControlContainer(); - - // Standard initialization - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - // Change the registry key under which our settings are stored. - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - - LoadStdProfileSettings(); // Load standard INI file options (including MRU) - - // Register document templates - - CMultiDocTemplate* pDocTemplate; - pDocTemplate = new CMultiDocTemplate( - IDR_TESTCBTYPE, - RUNTIME_CLASS(CTestCBotDoc), - RUNTIME_CLASS(CChildFrame), // custom MDI child frame - RUNTIME_CLASS(CTestCBotView)); - AddDocTemplate(pDocTemplate); - - // create main MDI Frame window - CMainFrame* pMainFrame = new CMainFrame; - if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) - return FALSE; - m_pMainWnd = pMainFrame; - - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - - if (m_lpCmdLine[0] == 0) - { - CString Filename = GetProfileString(szSection, szFilename); - if (Filename.IsEmpty()) Filename = "TstCbot.txt"; - else OpenDocumentFile(Filename); - } - else - // Dispatch commands specified on the command line - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - pMainFrame->ShowWindow(m_nCmdShow); - pMainFrame->UpdateWindow(); - - - return TRUE; -} - - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - //{{AFX_MSG(CAboutDlg) - // No message handlers - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) - //{{AFX_MSG_MAP(CAboutDlg) - // No message handlers - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -// App command to run the dialog -void CTestCBotApp::OnAppAbout() -{ - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotApp commands - -int CTestCBotApp::ExitInstance() -{ - delete m_pFuncFile; - - CBotProgram::Free(); - return CWinApp::ExitInstance(); -} diff --git a/src/CBot/TestCBot/TestCBot.dsp b/src/CBot/TestCBot/TestCBot.dsp deleted file mode 100644 index 8ed9b11..0000000 --- a/src/CBot/TestCBot/TestCBot.dsp +++ /dev/null @@ -1,201 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TestCBot" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=TestCBot - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "TestCBot.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "TestCBot.mak" CFG="TestCBot - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "TestCBot - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "TestCBot - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TestCBot - Win32 Release" - -# PROP BASE Use_MFC 5 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x100c /d "NDEBUG" -# ADD RSC /l 0x100c /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "TestCBot - Win32 Debug" - -# PROP BASE Use_MFC 5 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 5 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x100c /d "_DEBUG" -# ADD RSC /l 0x100c /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /stack:0x7010 /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "TestCBot - Win32 Release" -# Name "TestCBot - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\CBotConsoleDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChildFrm.cpp -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.cpp -# End Source File -# Begin Source File - -SOURCE=.\PerformDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\TestCBot.cpp -# End Source File -# Begin Source File - -SOURCE=.\TestCBot.rc - -!IF "$(CFG)" == "TestCBot - Win32 Release" - -!ELSEIF "$(CFG)" == "TestCBot - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\TestCBotDoc.cpp -# End Source File -# Begin Source File - -SOURCE=.\TestCBotView.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\CBotConsoleDlg.h -# End Source File -# Begin Source File - -SOURCE=.\ChildFrm.h -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.h -# End Source File -# Begin Source File - -SOURCE=.\PerformDlg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\TestCBot.h -# End Source File -# Begin Source File - -SOURCE=.\TestCBotDoc.h -# End Source File -# Begin Source File - -SOURCE=.\TestCBotView.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\TestCBot.ico -# End Source File -# Begin Source File - -SOURCE=.\res\TestCBot.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\TestCBotDoc.ico -# End Source File -# Begin Source File - -SOURCE=.\res\Toolbar.bmp -# End Source File -# End Group -# Begin Source File - -SOURCE=..\Debug\CBot.lib -# End Source File -# End Target -# End Project diff --git a/src/CBot/TestCBot/TestCBot.h b/src/CBot/TestCBot/TestCBot.h deleted file mode 100644 index b3b15db..0000000 --- a/src/CBot/TestCBot/TestCBot.h +++ /dev/null @@ -1,78 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// TestCBot.h : main header file for the TESTCBOT application -// - -#if !defined(AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols -//#include "../CbotDll.h" // librairie CBot -#include "../Cbot.h" // complet pour Browse - -class CTestCBotView; - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotApp: -// See TestCBot.cpp for the implementation of this class -// - -class CTestCBotApp : public CWinApp -{ -public: - CTestCBotApp(); - - CEdit* m_pConsole; - CTestCBotView* m_LastActive; - CBotClass* m_pClassPoint; - CBotClass* m_pClassPointIntr; - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTestCBotApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CTestCBotApp) - afx_msg void OnAppAbout(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_) - - -#define WM_STARTPROG WM_APP + 0 -#define WM_ENDPROG WM_APP + 1 -#define WM_ACTWINDOW WM_APP + 2 diff --git a/src/CBot/TestCBot/TestCBot.rc b/src/CBot/TestCBot/TestCBot.rc deleted file mode 100644 index 137458c..0000000 --- a/src/CBot/TestCBot/TestCBot.rc +++ /dev/null @@ -1,564 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// French (France) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\TestCBot.ico" -IDR_TESTCBTYPE ICON DISCARDABLE "res\\TestCBotDoc.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Toolbar -// - -IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15 -BEGIN - BUTTON ID_FILE_NEW - BUTTON ID_FILE_OPEN - BUTTON ID_FILE_SAVE - SEPARATOR - BUTTON ID_EDIT_CUT - BUTTON ID_EDIT_COPY - BUTTON ID_EDIT_PASTE - SEPARATOR - BUTTON ID_FILE_PRINT - BUTTON ID_RUN - SEPARATOR - BUTTON ID_APP_ABOUT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&Fichier" - BEGIN - MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW - MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN - MENUITEM SEPARATOR - MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED - MENUITEM SEPARATOR - MENUITEM "&Quitter", ID_APP_EXIT - END - POPUP "&Affichage" - BEGIN - MENUITEM "&Barre d'outils", ID_VIEW_TOOLBAR - MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR - END - POPUP "&?" - BEGIN - MENUITEM "&A propos de TestCBot...", ID_APP_ABOUT - END -END - -IDR_TESTCBTYPE MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&Fichier" - BEGIN - MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW - MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN - MENUITEM "&Fermer", ID_FILE_CLOSE - MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE - MENUITEM "En®istrer sous...", ID_FILE_SAVE_AS - MENUITEM SEPARATOR - MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED - MENUITEM SEPARATOR - MENUITEM "&Quitter", ID_APP_EXIT - END - POPUP "&Edition" - BEGIN - MENUITEM "&Annuler\tCtrl+Z", ID_EDIT_UNDO - MENUITEM SEPARATOR - MENUITEM "&Couper\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY - MENUITEM "C&oller\tCtrl+V", ID_EDIT_PASTE - END - POPUP "&Affichage" - BEGIN - MENUITEM "&Barre d'outils", ID_VIEW_TOOLBAR - MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR - END - POPUP "Fe&nêtre" - BEGIN - MENUITEM "&Nouvelle fenêtre", ID_WINDOW_NEW - MENUITEM "&Cascade", ID_WINDOW_CASCADE - MENUITEM "&Mosaïque", ID_WINDOW_TILE_HORZ - MENUITEM "&Réorganiser les icônes", ID_WINDOW_ARRANGE - END - POPUP "&?" - BEGIN - MENUITEM "&A propos de TestCBot...", ID_APP_ABOUT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE -BEGIN - "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT - "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT - VK_F5, ID_RUN, VIRTKEY, NOINVERT - VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT - VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT - VK_F7, ID_RUN, VIRTKEY, NOINVERT - VK_F9, ID_TEST, VIRTKEY, NOINVERT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT - "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 265, 206 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "A propos de TestCBot" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20 - LTEXT "TestCBot version 1.0",IDC_STATIC,40,10,119,8, - SS_NOPREFIX - LTEXT "Copyright D. Dumoulin (C) 2000",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,226,7,32,14,WS_GROUP - LTEXT "Programme de test pour la librairie CBot\n\nLes fonctions doivent être déclarées comme ""extern"" pour apparaître dans la liste lors de l'exécution.\n\n", - IDC_STATIC,39,43,191,41 - LTEXT "Mais en fait, on peut accèder à toutes les fonctions marquées ""public"" quelles soient dans la fenêtre active ou non.", - IDC_STATIC,39,89,187,36 - LTEXT "Les fonctions print( ... ) et println( ...) permettent d'afficher des résultats dans la console.\n\nLa fonction show( ... ) affiche les paramètres dans un dialogue, et suspend donc l'exécution.", - IDC_STATIC,39,130,187,54 -END - -IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 186, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040C04B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "Application MFC TestCBot\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "TestCBot\0" - VALUE "LegalCopyright", "Copyright (C) 1900\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "TestCBot.EXE\0" - VALUE "ProductName", "Application TestCBot\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Traduction", 0x40c, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 258 - TOPMARGIN, 7 - BOTTOMMARGIN, 199 - END - - IDD_DIALOG2, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDR_MAINFRAME "TestCBot" - IDR_TESTCBTYPE "\nTestCBot\nTestCBot\nCBot (*.txt)\n.txt\nTestCBot.Document\nTestCB Document" -END - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - AFX_IDS_APP_TITLE "TestCBot" - AFX_IDS_IDLEMESSAGE "Prêt" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "MAJ" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "DEF" - ID_INDICATOR_OVR "ECR" - ID_INDICATOR_REC "ENR" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_NEW "Crée un nouveau document\nNouveau" - ID_FILE_OPEN "Ouvre un document existant\nOuvrir" - ID_FILE_CLOSE "Ferme le document actif\nFermer" - ID_FILE_SAVE "Enregistre le document actif\nEnregistrer" - ID_FILE_SAVE_AS "Enregistre le document actif sous un nouveau nom\nEnregistrer sous" - ID_FILE_PRINT "Imprime le document\nImprime" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_APP_ABOUT "Affiche des informations sur le programme\nA propos de" - ID_APP_EXIT "Ferme l'application ; propose d'enregistrer les documents\nQuitter" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_MRU_FILE1 "Ouvre ce document" - ID_FILE_MRU_FILE2 "Ouvre ce document" - ID_FILE_MRU_FILE3 "Ouvre ce document" - ID_FILE_MRU_FILE4 "Ouvre ce document" - ID_FILE_MRU_FILE5 "Ouvre ce document" - ID_FILE_MRU_FILE6 "Ouvre ce document" - ID_FILE_MRU_FILE7 "Ouvre ce document" - ID_FILE_MRU_FILE8 "Ouvre ce document" - ID_FILE_MRU_FILE9 "Ouvre ce document" - ID_FILE_MRU_FILE10 "Ouvre ce document" - ID_FILE_MRU_FILE11 "Ouvre ce document" - ID_FILE_MRU_FILE12 "Ouvre ce document" - ID_FILE_MRU_FILE13 "Ouvre ce document" - ID_FILE_MRU_FILE14 "Ouvre ce document" - ID_FILE_MRU_FILE15 "Ouvre ce document" - ID_FILE_MRU_FILE16 "Ouvre ce document" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_NEXT_PANE "Passe au volet de fenêtre suivant\nVolet suivant" - ID_PREV_PANE "Revient au volet précédent\nVolet précédent" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_WINDOW_NEW "Ouvre une nouvelle fenêtre pour le document actif\nNouvelle fenêtre" - ID_WINDOW_ARRANGE "Réorganise les icônes en bas de la fenêtre\nRéorganise les icônes" - ID_WINDOW_CASCADE "Réorganise les fenêtres en cascade\nCascade" - ID_WINDOW_TILE_HORZ "Réorganise les fenêtres en une mosaïque\nMosaïque" - ID_WINDOW_TILE_VERT "Réorganise les fenêtres en une mosaïque\nMosaïque" - ID_WINDOW_SPLIT "Fractionne la fenêtre active en deux volets\nFractionner" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_EDIT_CLEAR "Efface la sélection\nEffacer" - ID_EDIT_CLEAR_ALL "Efface tout\nEffacer tout" - ID_EDIT_COPY "Copie la sélection et la place dans le Presse-papiers\nCopier" - ID_EDIT_CUT "Supprime la sélection et la place dans le Presse-papiers\nCopier" - ID_EDIT_FIND "Recherche le texte spécifié\nRechercher" - ID_EDIT_PASTE "Insère le contenu du Presse-papiers\nColler" - ID_EDIT_REPEAT "Répète la dernière action\nRépéter" - ID_EDIT_REPLACE "Remplace le texte spécifique par un texte différent\nRemplacer" - ID_EDIT_SELECT_ALL "Sélectionne le document entier\nSélectionner tout" - ID_EDIT_UNDO "Annule la dernière action\nAnnuler" - ID_EDIT_REDO "Rétablit l'action précédemment annulée\nRétablir" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_TOOLBAR "Affiche ou masque la barre d'outils\nBarre d'outils" - ID_VIEW_STATUS_BAR "Affiche ou masque la barre d'état\nBarre d'état" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCSIZE "Change la taille de la fenêtre" - AFX_IDS_SCMOVE "Change la position de la fenêtre" - AFX_IDS_SCMINIMIZE "Réduit la fenêtre en icône" - AFX_IDS_SCMAXIMIZE "Agrandit la fenêtre au format de l'écran" - AFX_IDS_SCNEXTWINDOW "Passe à la fenêtre de document suivante" - AFX_IDS_SCPREVWINDOW "Passe à la fenêtre de document précédente" - AFX_IDS_SCCLOSE "Ferme la fenêtre active et propose l'enregistrement des documents" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCRESTORE "Restaure la fenêtre à sa taille d'origine" - AFX_IDS_SCTASKLIST "Active la liste des tâches" - AFX_IDS_MDICHILD "Active cette fenêtre" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_RUN "Execute le programme CBot\nExecute (F5)" -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_TYPENAMES "les différents types" - 1001 "Byte" - 1002 "Short" - 1003 "Char" - 1004 "Int" - 1005 "Long" - 1006 "Real" - 1007 "Double" -END - -STRINGTABLE DISCARDABLE -BEGIN - 1008 "Boolean" - 1009 "String" - 1010 "Array" - 1011 "Arraybody" - 1012 "Pointer" - 1013 "Nullpointer" - 1014 "nop" - 1015 "Class" - 1016 "Intrinsic" -END - -#endif // French (France) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// French (Switzerland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRS) -#ifdef _WIN32 -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONSOLE DIALOG DISCARDABLE 0, 0, 401, 210 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "CBot Console" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Commande :",IDC_STATIC,7,177,40,8 - EDITTEXT IDC_EDIT2,7,189,329,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "Exécute",IDOK,344,189,50,14 - EDITTEXT IDC_EDIT1,7,7,387,167,ES_MULTILINE | ES_READONLY | - ES_WANTRETURN | WS_VSCROLL -END - -IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 177, 100 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Test performances" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Boucles par seconde",IDC_STATIC,7,9,68,8 - EDITTEXT IDC_EDIT1,111,7,51,14,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Nombre de scripts",IDC_STATIC,7,55,58,8 - EDITTEXT IDC_EDIT2,111,52,40,14,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,152,52, - 10,14 - COMBOBOX IDC_COMBO1,111,74,52,111,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Timer",IDC_STATIC,7,77,18,8 - LTEXT "Performance %",IDC_STATIC,7,28,48,8 - EDITTEXT IDC_EDIT3,111,25,51,14,ES_AUTOHSCROLL | ES_READONLY -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_CONSOLE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 394 - TOPMARGIN, 7 - BOTTOMMARGIN, 203 - END - - IDD_DIALOG1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 170 - TOPMARGIN, 7 - BOTTOMMARGIN, 93 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 12, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\TestCBot.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""l.fra\\afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_DIALOG1 DLGINIT -BEGIN - IDC_COMBO1, 0x403, 2, 0 -0x0031, - IDC_COMBO1, 0x403, 3, 0 -0x3031, "\000" - IDC_COMBO1, 0x403, 4, 0 -0x3031, 0x0030, - IDC_COMBO1, 0x403, 5, 0 -0x3031, 0x3030, "\000" - 0 -END - -#endif // French (Switzerland) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -LANGUAGE 12, 1 -#pragma code_page(1252) -#endif -#include "res\TestCBot.rc2" // non-Microsoft Visual C++ edited resources -#include "l.fra\afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/CBot/TestCBot/TestCBot1.txt b/src/CBot/TestCBot/TestCBot1.txt deleted file mode 100644 index d27b4f8..0000000 --- a/src/CBot/TestCBot/TestCBot1.txt +++ /dev/null @@ -1,27 +0,0 @@ - -class CPoint2 -{ - float x, y; - void CPoint2(float x, float y) - { - this.x = x; - this.y = y; - } -} - -public extern void T ( ) -{ - CPoint2 X( 12, 33 ), Y ( -4, 4/3 ); - print ( X, Y ) ; -} - -public extern void Hello ( ) - -{ - println ( "Hello" ); -} - -public extern void test ( int n ) -{ - for ( int i = n; i>0 ; i--) print (i); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/TestCBot3.txt b/src/CBot/TestCBot/TestCBot3.txt deleted file mode 100644 index b915f96..0000000 --- a/src/CBot/TestCBot/TestCBot3.txt +++ /dev/null @@ -1,24 +0,0 @@ -public extern void Test () -{ - for ( int x = 100000; x>0 ; x-- ) { } -} - -float MaRoutine( CPoint A, CPoint B ) -{ - A.x -= B.x ; // distance en x - A.y -= B.y ; // distance en y - A.x *= A.x; // carré de la distance - A.y += A.y; // carré de la distance - println ( A, B ) ; - return ( A.x + A.y ) ; -} - -public extern void TestAB ( ) -{ - CPoint A(3, 5) ; - CPoint B(4, -2); - println ( A, B ) ; - MaRoutine( A, B ) ; - println ( A, B ) ; -} - diff --git a/src/CBot/TestCBot/TestCBotDoc.cpp b/src/CBot/TestCBot/TestCBotDoc.cpp deleted file mode 100644 index 8880c57..0000000 --- a/src/CBot/TestCBot/TestCBotDoc.cpp +++ /dev/null @@ -1,697 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// TestCBotDoc.cpp : implementation of the CTestCBotDoc class -// - -#include "stdafx.h" -#include "TestCBot.h" - -#include "TestCBotDoc.h" -#include "TestCBotView.h" -#include "CBotConsoleDlg.h" -#include "PerformDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotDoc - -IMPLEMENT_DYNCREATE(CTestCBotDoc, CDocument) - -BEGIN_MESSAGE_MAP(CTestCBotDoc, CDocument) - //{{AFX_MSG_MAP(CTestCBotDoc) - ON_COMMAND(ID_RUN, OnRun) - ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1) - ON_COMMAND(ID_TEST, OnTest) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotDoc construction/destruction - -static BOOL test = FALSE; - - -CTestCBotDoc::CTestCBotDoc() -{ - m_pEdit = NULL; - m_pProg = NULL; - m_bModified = FALSE; -} - -CTestCBotDoc::~CTestCBotDoc() -{ - delete m_pEdit; - delete m_pProg; -} - -BOOL CTestCBotDoc::OnNewDocument() -{ - if (!CDocument::OnNewDocument()) - return FALSE; - - return TRUE; -} - - - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotDoc serialization - -void CTestCBotDoc::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - m_pEdit->GetWindowText(m_DocText); - int w = m_DocText.GetLength(); - ar.Write((LPCTSTR)m_DocText, w); - } - else - { - int r; - char buf[10001]; - - r = ar.Read(buf, 10000); - buf[r] = 0; - m_DocText = buf; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - if (!m_pProg->Compile(m_DocText, m_Liste, NULL)) - { - delete m_pProg; - m_pProg = NULL; - } - } -} - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotDoc diagnostics - -#ifdef _DEBUG -void CTestCBotDoc::AssertValid() const -{ - CDocument::AssertValid(); -} - -void CTestCBotDoc::Dump(CDumpContext& dc) const -{ - CDocument::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotDoc commands - -void CTestCBotDoc::OnRun() -{ - OnFileSave(); - - m_pEdit->GetWindowText(m_DocText); - - CString TextError; - int code, start, end; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); - - if (!m_pProg->Compile(m_DocText, m_Liste, NULL)) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError = CBotProgram::GivErrorText( code ); - AfxMessageBox( TextError ); - - m_pEdit->SetFocus(); - return; - } - - if( m_Liste.GivSize() == 0 ) - { - AfxMessageBox("Aucune fonction marquée \"extern\" !"); - return; - } - - for ( int i = 0; i < m_Liste.GivSize(); i++ ) - { - int start, stop; - m_pProg->GetPosition(m_Liste[i], start, stop, GetPosNom, GetPosParam); - m_Liste[i] = m_DocText.Mid( start, stop-start ); - } - - CBotConsoleDlg dlg; - dlg.m_pListe = &m_Liste; - dlg.m_pEditx = m_pEdit; - - dlg.DoModal(); // dialogue pour faire la console - - if ( dlg.m_code>0 ) - { - CString TextError; - - TextError = m_pProg->GivErrorText( dlg.m_code ); - - m_pEdit->SetSel( dlg.m_start, dlg.m_end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - AfxMessageBox(TextError); - } - - m_pEdit->SetFocus(); - - return; -} - - -void CTestCBotDoc::OnChangeEdit1() -{ - SetModifiedFlag(); - m_bModified = TRUE; -} - -BOOL CTestCBotDoc::Compile() -{ - m_pEdit->GetWindowText(m_DocText); - - CString TextError; - int code, start, end; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - char buffer[100]; - strcpy(buffer, "le pointeur à passer pour voir"); - - if (m_bModified && !m_pProg->Compile(m_DocText, m_Liste, (void*)buffer)) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError = CBotProgram::GivErrorText( code ); - AfxMessageBox( TextError ); - - m_pEdit->SetFocus(); - m_bModified = FALSE; - return FALSE; - } - - if ( m_pProg->GetPosition( "TheTest", start, end) ) - { - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - } - - m_bModified = FALSE; - return TRUE; -} - - - -static int compt = 0; -// routine retournant le "pointeur" à un autre object -BOOL rRetObject( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - pResult->SetPointer( NULL ); - compt+=45671; - if (compt&0x11) return TRUE; - - CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); - pAutre->SetUserPtr( (void*)2 ); - pResult->SetPointer( pAutre ); - - if (!pResult->IsElemOfClass("object")) - return TRUE; - - delete pAutre; - return TRUE; -} - -CBotTypResult cRetObject( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( CBotTypPointer, "object"); -} - -BOOL roRadar( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - pResult->SetPointer( NULL ); - compt+=45671; - if (compt&0x11) return TRUE; - - CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); - pAutre->SetUserPtr( (void*)2 ); - pResult->SetPointer( pAutre ); - - if (!pResult->IsElemOfClass("object")) - return TRUE; - - delete pAutre; - return TRUE; -} - -CBotTypResult coRadar( CBotVar* pThis, CBotVar* &pVar ) -{ - void* pUser = pThis->GivUserPtr(); - return CBotTypResult( CBotTypPointer, "object"); -} - -BOOL rMove( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - if ( test < 12 ) - { - test++; - return FALSE; - } - return TRUE; -} - -CBotTypResult cMove( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( 0 ); -} - -BOOL rTurn( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - return TRUE; -} - -CBotTypResult cTurn( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( 0 ); -} - -BOOL rRadar( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - pResult->SetPointer( NULL ); - - if ( pVar ) pVar->debug(); - - compt+=45671; - if (compt&0x11) - { - return FALSE; // TRUE; - } - - CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); - pAutre->SetUserPtr( (void*)2 ); - pResult->SetPointer( pAutre ); - - if (!pResult->IsElemOfClass("object")) - return TRUE; - - delete pAutre; - return TRUE; -} - -CBotTypResult cRadar( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( CBotTypPointer, "object"); -} - -// routine retournant le "pointeur" à un autre object -BOOL rTEST( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - test = 1 ; - if ( pVar == NULL ) return TRUE; - - test = pVar->GivValInt(); - if ( test == 5 ) - { - pVar = pVar->GivNext(); - pVar->SetUserPtr( OBJECTDELETED ); - } - return TRUE; -} - -CBotTypResult cTEST( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( 0 ); -} - -// routine retournant le "pointeur" à un autre object -BOOL rF( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) -{ - if ( pResult == NULL ) return TRUE; - pResult->SetValInt(3); - return TRUE; -} - -CBotTypResult cF( CBotVar* &pVar, void* pUser ) -{ - return CBotTypResult( CBotTypFloat ); -} - -///////////////////////////////////////////////////////////////// - -// Compilation d'une procédure avec un "point". - -CBotTypResult cPoint(CBotVar* &var, void* user) -{ - if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); - - if ( var->GivType() <= CBotTypDouble ) - { - var = var->GivNext(); - if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); - if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); - var = var->GivNext(); - if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); - if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); - var = var->GivNext(); - return CBotTypResult( 0 ); - } - - if ( var->GivType() == CBotTypClass ) - { - if ( !var->IsElemOfClass("point") ) return CBotTypResult( CBotErrBadParam ); - var = var->GivNext(); - return CBotTypResult( 0 ); - } - - return CBotTypResult( CBotErrBadParam ); -} - -// Donne un paramètre de type "point". -#define UNIT 1 - - -CBotTypResult cSpace(CBotVar* &var, void* user) -{ - CBotTypResult ret; - - if ( var == 0 ) return CBotTypResult( CBotTypIntrinsic, "point" ); - ret = cPoint(var, user); - if ( !ret.Eq(0) ) return ret; - - if ( var == 0 ) return CBotTypIntrinsic; - if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); - var = var->GivNext(); - - if ( var == 0 ) return CBotTypIntrinsic; - if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); - var = var->GivNext(); - - if ( var == 0 ) return CBotTypIntrinsic; - if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); - var = var->GivNext(); - - if ( var != 0 ) return CBotErrOverParam; - return CBotTypResult( CBotTypIntrinsic, "point" ); -} - -// Instruction "space(center, rMin, rMax, dist)". - -BOOL rSpace(CBotVar* var, CBotVar* result, int& exception, void* user) -{ - CBotVar* pSub; - float rMin, rMax, dist; - - rMin = 5.0f*UNIT; - rMax = 50.0f*UNIT; - dist = 4.0f*UNIT; - - if ( var == 0 ) - { -// center = pThis->RetPosition(0); - } - else - { - if ( var != 0 ) - { - rMin = var->GivValFloat()*UNIT; - var = var->GivNext(); - - if ( var != 0 ) - { - rMax = var->GivValFloat()*UNIT; - var = var->GivNext(); - - if ( var != 0 ) - { - dist = var->GivValFloat()*UNIT; - var = var->GivNext(); - } - } - } - } - - if ( result != 0 ) - { - pSub = result->GivItemList(); - if ( pSub != 0 ) - { - pSub->SetValFloat(1); - pSub = pSub->GivNext(); // "y" - pSub->SetValFloat(2); - pSub = pSub->GivNext(); // "z" -// pSub->SetValFloat(3); - } - } - return TRUE; -} -////////////////////////////////////////////////////////////// - - -void CTestCBotDoc::OnTest() -{ - CBotProgram::DefineNum("WingedGrabber", 1); - CBotProgram::DefineNum("TrackedGrabber", 2); - CBotProgram::DefineNum("WheeledGrabber", 3); - CBotProgram::DefineNum("LeggedGrabber", 4); - CBotProgram::DefineNum("WingedShooter", 5); - CBotProgram::DefineNum("TrackedShooter", 6); - CBotProgram::DefineNum("WheeledShooter", 7); - CBotProgram::DefineNum("LeggedShooter", 8); - CBotProgram::DefineNum("WingedOrgaShooter", 9); - CBotProgram::DefineNum("TrackedOrgaShooter", 10); - CBotProgram::DefineNum("WheeledOrgaShooter", 11); - CBotProgram::DefineNum("LeggedOrgaShooter", 12); - CBotProgram::DefineNum("WingedSniffer", 13); - CBotProgram::DefineNum("TrackedSniffer", 14); - CBotProgram::DefineNum("WheeledSniffer", 14); - CBotProgram::DefineNum("LeggedSniffer", 15); - CBotProgram::DefineNum("Thumper", 16); - CBotProgram::DefineNum("PhazerShooter", 17); - CBotProgram::DefineNum("Recycler", 18); - CBotProgram::DefineNum("Shielder", 19); - CBotProgram::DefineNum("Subber", 20); - CBotProgram::DefineNum("Me", 21); - - CBotProgram::DefineNum("TypeMarkPath", 111); - - OnFileSave(); - -// CPerformDlg dlg; -// dlg.m_Script = m_DocText; -// dlg.DoModal(); - - // défini la routine RetObject - CBotProgram::AddFunction( "Radar", rRetObject, cRetObject ); - - // ajoute une routine pour cette classe - CBotProgram::AddFunction("Space", rSpace, cSpace); - - // défini la routine Test - CBotProgram::AddFunction( "TEST", rTEST, cTEST ); - CBotProgram::AddFunction( "F", rF, cF ); - - CBotProgram::AddFunction( "goto", rMove, cMove ); - CBotProgram::AddFunction( "fire", rTurn, cTurn ); - CBotProgram::AddFunction( "radar", rRadar, cRadar ); - - // crée une instance de la classe "Bot" pour ce robot - CBotVar* pThisRobot = CBotVar::Create( "", CBotTypResult(CBotTypClass, "object") ); - pThisRobot->SetUserPtr( (void*)1 ); - pThisRobot->SetIdent( 1234 ); - - delete m_pProg; - // crée un objet programme associé à cette instance - m_pProg = new CBotProgram(pThisRobot); - - // compile le programme - CString TextError; - int code, start, end; - - m_pEdit->GetWindowText(m_DocText); - if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - delete pThisRobot; - - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError = CBotProgram::GivErrorText( code ); - AfxMessageBox( TextError ); - - m_pEdit->SetFocus(); - return; - } - - // exécute pour voir - m_pProg->Start(m_Liste[0]); - - int mode = -1; - - if ( mode >= 0 ) { - - // sauve et restore à chaque pas possible - while (!m_pProg->Run(NULL, 1)) - { - const char* FunctionName; - int start1, end1; - m_pProg->GetRunPos(FunctionName, start1, end1); - if ( end1 <= 0 ) - m_pProg->GetRunPos(FunctionName, start1, end1); - m_pEdit->SetSel(start1, end1); - -if ( mode == 0 ) continue; - - FILE* pf; - pf = fOpen( "TEST.CBO", "wb" ); - CBotClass::SaveStaticState(pf); - m_pProg->SaveState(pf); - fClose(pf); - -if ( mode == 2 ) if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - delete pThisRobot; - - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError = CBotProgram::GivErrorText( code ); - AfxMessageBox( TextError ); - - m_pEdit->SetFocus(); - return; - } - - pf = fOpen( "TEST.CBO", "rb" ); - CBotClass::RestoreStaticState(pf); - m_pProg->RestoreState(pf); - fClose(pf); - - int start2, end2; - m_pProg->GetRunPos(FunctionName, start2, end2); - if ( end2 <= 0 ) - m_pProg->GetRunPos(FunctionName, start2, end2); - - if ( start1 != start2 || end1 != end2 ) - m_pProg->GetRunPos(FunctionName, start2, end2); - m_pEdit->SetSel(start2, end2); - } - - if (m_pProg->GetError(code, start, end)) - { - m_pEdit->SetSel(start, end); - TextError = CBotProgram::GivErrorText(code); - AfxMessageBox(TextError); - } - return;} - - while (!m_pProg->Run(NULL, 0)) - { - const char* FunctionName; - int start, end; - m_pProg->GetRunPos(FunctionName, start, end); - m_pEdit->SetSel(start, end); - - if ( FunctionName == NULL ) continue; - CString info (FunctionName); - CString sep (":\n"); - - int level = 0; - const char* Name; - while ( TRUE ) - { - CBotVar* pVar = m_pProg->GivStackVars(Name, level--); - if ( Name != FunctionName ) break; - if ( pVar == NULL ) continue; -// pVar->Maj(NULL, FALSE); - while ( pVar != NULL ) - { - info += sep; - info += pVar->GivName() + CBotString(" = ") + pVar->GivValString(); - sep = ", "; - pVar = pVar->GivNext(); - } - sep = "\n"; - } - if ( IDOK != AfxMessageBox(info, MB_OKCANCEL) ) break; - - if ( test == 1 ) - { - test = 0; - FILE* pf; - pf = fOpen( "TEST.CBO", "wb" ); - m_pProg->SaveState(pf); - fClose(pf); - } - - if ( test == 2 ) - { - test = 0; - FILE* pf; - pf = fOpen( "TEST.CBO", "rb" ); - m_pProg->RestoreState(pf); - fClose(pf); - } - - if ( test == 12 ) - { - test = 0; - FILE* pf; - pf = fOpen( "TEST.CBO", "wb" ); - m_pProg->SaveState(pf); - fClose(pf); - - pf = fOpen( "TEST.CBO", "rb" ); - m_pProg->RestoreState(pf); - fClose(pf); - - test = 13; - } - } - - if (m_pProg->GetError(code, start, end)) - { - m_pEdit->SetSel(start, end); - TextError = CBotProgram::GivErrorText(code); - AfxMessageBox(TextError); - } - - delete pThisRobot; -} - diff --git a/src/CBot/TestCBot/TestCBotDoc.h b/src/CBot/TestCBot/TestCBotDoc.h deleted file mode 100644 index 548607f..0000000 --- a/src/CBot/TestCBot/TestCBotDoc.h +++ /dev/null @@ -1,78 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// TestCBotDoc.h : interface of the CTestCBotDoc class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - -class CTestCBotDoc : public CDocument -{ -protected: // create from serialization only - CTestCBotDoc(); - DECLARE_DYNCREATE(CTestCBotDoc) - -// Attributes -public: - CEdit* m_pEdit; // pour mémoriser le texte, et l'afficher - CBotProgram* m_pProg; // le programme compilé - CString m_DocText; - CBotStringArray m_Liste; - BOOL m_bModified; - -// Operations -public: - BOOL Compile(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTestCBotDoc) - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CTestCBotDoc(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CTestCBotDoc) - afx_msg void OnRun(); - afx_msg void OnChangeEdit1(); - afx_msg void OnTest(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/TestCBotView.cpp b/src/CBot/TestCBot/TestCBotView.cpp deleted file mode 100644 index bca3c56..0000000 --- a/src/CBot/TestCBot/TestCBotView.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/. - -// TestCBotView.cpp : implementation of the CTestCBotView class -// - -#include "stdafx.h" -#include "TestCBot.h" - -#include "TestCBotDoc.h" -#include "TestCBotView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotView - -IMPLEMENT_DYNCREATE(CTestCBotView, CView) - -BEGIN_MESSAGE_MAP(CTestCBotView, CView) - //{{AFX_MSG_MAP(CTestCBotView) - ON_WM_SIZE() - ON_MESSAGE(WM_ACTWINDOW, ActWindow) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotView construction/destruction - -CTestCBotView::CTestCBotView() -{ -} - -CTestCBotView::~CTestCBotView() -{ -} - -BOOL CTestCBotView::PreCreateWindow(CREATESTRUCT& cs) -{ - return CView::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotView drawing - -void CTestCBotView::OnDraw(CDC* pDC) -{ - CTestCBotDoc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); -} - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotView diagnostics - -#ifdef _DEBUG -void CTestCBotView::AssertValid() const -{ - CView::AssertValid(); -} - -void CTestCBotView::Dump(CDumpContext& dc) const -{ - CView::Dump(dc); -} - -CTestCBotDoc* CTestCBotView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestCBotDoc))); - return (CTestCBotDoc*)m_pDocument; -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CTestCBotView message handlers - -void CTestCBotView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) -{ - CTestCBotDoc* pDoc = GetDocument(); -// CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); - - if ( pDoc->m_pEdit == NULL) - { - pDoc->m_pEdit = new CEdit(); - CRect rect; - GetClientRect( rect ); - - pDoc->m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL, - rect, this, IDC_EDIT1 ); - pDoc->m_pEdit->SetTabStops(12); - pDoc->m_pEdit->SetWindowText(pDoc->m_DocText); - } - - if ( !bActivate && !pDoc->Compile() ) - { -// comment faire pour réactiver l'ancien document - } - - CView::OnActivateView(bActivate, pActivateView, pDeactiveView); - - if ( bActivate ) pDoc->m_pEdit->SetFocus(); -} - - -void CTestCBotView::OnSize(UINT nType, int cx, int cy) -{ - CView::OnSize(nType, cx, cy); - - CTestCBotDoc* pDoc = GetDocument(); - if ( pDoc->m_pEdit != NULL ) - { - CRect rect; - GetClientRect( rect ); - pDoc->m_pEdit->MoveWindow( rect ); - pDoc->m_pEdit->SetFocus(); - } -} - - - -LONG CTestCBotView::ActWindow(UINT wparam, LONG lparam) -{ -// GetParentFrame()->SetActiveView( this, TRUE ); -// CMDIChildWnd::OnMDIActivate(1, this, this) - return 0; -} diff --git a/src/CBot/TestCBot/TestCBotView.h b/src/CBot/TestCBot/TestCBotView.h deleted file mode 100644 index 065ee08..0000000 --- a/src/CBot/TestCBot/TestCBotView.h +++ /dev/null @@ -1,78 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.// TestCBotView.h : interface of the CTestCBotView class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_) -#define AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CTestCBotView : public CView -{ -protected: // create from serialization only - CTestCBotView(); - DECLARE_DYNCREATE(CTestCBotView) - -// Attributes -public: - CTestCBotDoc* GetDocument(); - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTestCBotView) - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - protected: - virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CTestCBotView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CTestCBotView) - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg LONG ActWindow(UINT wparam, LONG lparam) ; - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -#ifndef _DEBUG // debug version in TestCBotView.cpp -inline CTestCBotDoc* CTestCBotView::GetDocument() - { return (CTestCBotDoc*)m_pDocument; } -#endif - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/TestCBot/TestNull.txt b/src/CBot/TestCBot/TestNull.txt deleted file mode 100644 index f447245..0000000 --- a/src/CBot/TestCBot/TestNull.txt +++ /dev/null @@ -1,15 +0,0 @@ -extern public void TestNull () -{ - CPoint pointeur = null; - - try { - pointeur.x = 4; } - catch ( 6007 ) {} - - pointeur = new CPoint(1,2); - - print ( pointeur.x, pointeur.y, - pointeur ); - - pointeur.x = 5; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/TestRestoreState.txt b/src/CBot/TestCBot/TestRestoreState.txt deleted file mode 100644 index 1e49e37..0000000 --- a/src/CBot/TestCBot/TestRestoreState.txt +++ /dev/null @@ -1,67 +0,0 @@ -// routine de Daniel qui plante après RestoreState - -extern void object::Attack( ) -{ - int list[], i; - object p; - float dist, prox; - point nav1, nav2, dest; - boolean advance = true; - - i = 0; - list[i++] = WingedGrabber; - list[i++] = TrackedGrabber; - list[i++] = WheeledGrabber; - list[i++] = LeggedGrabber; - list[i++] = WingedShooter; - list[i++] = TrackedShooter; - list[i++] = WheeledShooter; - list[i++] = LeggedShooter; - list[i++] = WingedOrgaShooter; - list[i++] = TrackedOrgaShooter; - list[i++] = WheeledOrgaShooter; - list[i++] = LeggedOrgaShooter; - list[i++] = WingedSniffer; - list[i++] = TrackedSniffer; - list[i++] = WheeledSniffer; - list[i++] = LeggedSniffer; - list[i++] = Thumper; - list[i++] = PhazerShooter; - list[i++] = Recycler; - list[i++] = Shielder; - list[i++] = Subber; - list[i++] = Me; - - nav1.x = 1;//cmdline(0); - nav1.y = 1;//cmdline(1); - nav2.x = 2;//cmdline(2); - nav2.y = 2;//cmdline(3); - - while ( true ) - { - while ( true ) - { - // ennemi à proximité ? - p = radar(list, 0, 360, 0, 40); - if ( p == null ) break; - // lui tire dessus - fire(p.position); - } - - // se promène vers le point A - goto(nav1); - - while ( true ) - { - // ennemi à proximité ? - p = radar(list, 0, 360, 0, 40); - if ( p == null ) break; - // lui tire dessus - fire(p.position); - } - - // se promène vers le point B - goto(nav2); - } -} - diff --git a/src/CBot/TestCBot/TestStatic.txt b/src/CBot/TestCBot/TestStatic.txt deleted file mode 100644 index f501aa5..0000000 --- a/src/CBot/TestCBot/TestStatic.txt +++ /dev/null @@ -1,31 +0,0 @@ -class ESSAI -{ - int x = 0; - static int nb = 3; - static int [ ] array ; - - void Put( int val) - { -show(nb); - array[ nb ] = val; -// this.nb++; - this.nb = this.nb + 1; -show(nb, array); - } - int Get( ) - { - nb--; -show("out", nb, array); - return array[ nb ] ; - } -} - -extern public void T() -{ - ESSAI t1 ( ) ; - ESSAI t2 ( ) ; - t1.nb++; - t1.Put( 11 ); t1.Put( 12 ); t2.Put( 13 ); - - show ( t1.Get(), t2.Get(), t2.Get() ) ; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/TestStr.txt b/src/CBot/TestCBot/TestStr.txt deleted file mode 100644 index 683ec1b..0000000 --- a/src/CBot/TestCBot/TestStr.txt +++ /dev/null @@ -1,17 +0,0 @@ -extern public void TSTR() -{ - string s = "C'est un essai"; - - print ( s, strlen(s), strleft(s, 3), strright(s,3), strmid(s, 2), strmid(s,2,3), strfind(s, "un"), strfind(s, "sdgfld") ); - - show ( strupper(s), strlower(s) ); - - s = "123.45" ; - print ( strval(s) ); - - - string sub = strright("abcdef", 2); // sub vaut "ef###", # étant un caractère bizarre quelconque - show (sub); - int pos = strfind("abcdef", "xy"); // pos vaut -1. Pourquoi pas nan ? - show(pos); -} diff --git a/src/CBot/TestCBot/Z.txt b/src/CBot/TestCBot/Z.txt deleted file mode 100644 index 714119b..0000000 --- a/src/CBot/TestCBot/Z.txt +++ /dev/null @@ -1,14 +0,0 @@ -public extern void tp() -{ - int a [4], b[]; - a [ 0 ] = 8 ; - - b = T ( a ) ; - show ( a, b ); -} - -int[] T ( int[] Z ) -{ - for ( int i = 0; i < 4 ; i++ ) Z[ i ] = i * i ; - return Z; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/array.txt b/src/CBot/TestCBot/array.txt deleted file mode 100644 index 081b60e..0000000 --- a/src/CBot/TestCBot/array.txt +++ /dev/null @@ -1,24 +0,0 @@ - -public extern void TestTableau () -{ - int tableau [ 12 ] ; - - point array[ 12 ] [ 14 ] ; - - point zéro ( 1, 2 ) ; - point a = zéro ; - - for ( int i = 0 ; i < 10 ; i++ ) array[ i ] [ i ]= zéro ; - - array[ 5 ] [3 ] . x =1.5 ; - - array[ 2 ] [ 2 ] . y = array[ 5 ] [ 5 ] . x ; - - array[ 4 ] = array [ 2 ] ; - - for ( int i = 0 ; i < 10 ; i++ ) for ( int j = 0 ; j < 4 ; j++ ) println ( i, j, array [ i ] [ j ] ) ; - - show( zéro, a, array ); - -} - diff --git "a/src/CBot/TestCBot/a\2361.txt" "b/src/CBot/TestCBot/a\2361.txt" deleted file mode 100644 index 165bc95..0000000 --- "a/src/CBot/TestCBot/a\2361.txt" +++ /dev/null @@ -1,96 +0,0 @@ -object radarGuepe(point orig, float dist) -{ - int i; - object pr, r; - float mindist; - - i = 0; - mindist = 1000; - while (i<30) - { - pr = radar(i); - if (pr != null) - { - - if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) - { - mindist = distance(orig, pr.position); - r = pr; - } - } - i = i+1; - } - if (mindist < dist) return(r); else return(null); -} - - -class Guepe -{ - - point pos; - - - void cherche(point orig, float dist) - { - object p; - point o; - - p = radarGuepe(orig, dist); - while (p == null) - { - wait(0.1); - p = radarGuepe(orig, dist); - } - - pos.x = p.position.x; - pos.y = p.position.y; - pos.z = p.position.z; - - //o = p.position; - //wait(0.1); - - //vitessex = (p.position.x - o.x)/0.1; - //vitessey = (p.position.y - o.y)/0.1; - //vitessez = (p.position.z - o.z)/0.1; - - } - - - void tire(point orig, float orient) - { - //float t = 3; //temps d'anticipation - float angle; - point cible; - - cible.x = pos.x;// + t*vitessex; - cible.y = pos.y;// + t*vitessey; - cible.z = pos.z;// + t*vitessez; - - if (cible.x == 0) angle = 90; else - angle = atan(cible.y / cible.x); - if (cible.x < 0) angle = angle + 180; - angle = angle - orient; - if (angle > 180) angle = angle - 360; - if (angle < -180) angle = angle + 360; - turn(angle); - - angle = atan((cible.z-orig.z) / distance2d(orig, cible)); - aim(angle); - - fire(0.1); - - } -} - -extern void object::Fourmi6() -{ - //fps(1000); - Guepe guepe = new Guepe(); - - while (true) - { - guepe.cherche(position, 50); - - guepe.tire(position, orientation); - } -} diff --git "a/src/CBot/TestCBot/a\2471.txt" "b/src/CBot/TestCBot/a\2471.txt" deleted file mode 100644 index 0c57950..0000000 --- "a/src/CBot/TestCBot/a\2471.txt" +++ /dev/null @@ -1,96 +0,0 @@ -object radarGuepe(point orig, float dist) -{ - int i; - object pr, r; - float mindist; - - i = 0; - mindist = 1000; - while (i<30) - { - pr = radar(i); - if (pr != null) - { - - if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) - { - mindist = distance(orig, pr.position); - r = pr; - } - } - i = i+1; - } - if (mindist < dist) return(r); else return(null); -} - - -class Guepe -{ - - point pos; - - - void cherche(point orig, float dist) - { - object p; - point o; - - p = radarGuepe(orig, dist); - while (p == null) - { - wait(0.1); - p = radarGuepe(orig, dist); - } - - pos.x = p.position.x; - pos.y = p.position.y; - pos.z = p.position.z; - - //o = p.position; - //wait(0.1); - - //vitessex = (p.position.x - o.x)/0.1; - //vitessey = (p.position.y - o.y)/0.1; - //vitessez = (p.position.z - o.z)/0.1; - - } - - - void tire(point orig, float orient) - { - //float t = 3; //temps d'anticipation - float angle; - point cible; - - cible.x = pos.x;// + t*vitessex; - cible.y = pos.y;// + t*vitessey; - cible.z = pos.z;// + t*vitessez; - - if (cible.x == 0) angle = 90; else - angle = atan(cible.y / cible.x); - if (cible.x < 0) angle = angle + 180; - angle = angle - orient; - if (angle > 180) angle = angle - 360; - if (angle < -180) angle = angle + 360; - turn(angle); - - angle = atan((cible.z-orig.z) / distance2d(orig, cible)); - aim(angle); - - fire(0.1); - - } -} - -extern void object::Fourmi6() -{ - //fps(1000); - Guepe guepe = new Guepe(); - - while (true) - { - guepe.cherche(position, 50); - - guepe.tire(position, orientation); - } -} diff --git a/src/CBot/TestCBot/bug.txt b/src/CBot/TestCBot/bug.txt deleted file mode 100644 index 4ec6eb3..0000000 --- a/src/CBot/TestCBot/bug.txt +++ /dev/null @@ -1,12 +0,0 @@ -public extern void object::Bug() -{ - point a; - a = position; - TEST(); - float d=dist(a, position); -} - -float dist(point a, point b) -{ - return a.x-b.x; -} diff --git a/src/CBot/TestCBot/bugmw.txt b/src/CBot/TestCBot/bugmw.txt deleted file mode 100644 index 284ee43..0000000 --- a/src/CBot/TestCBot/bugmw.txt +++ /dev/null @@ -1,9 +0,0 @@ -extern public void main() -{ - show(fact(30)) ; -} - -public int fact(int n) -{ - return (fact(n-1)*n) ; -} diff --git a/src/CBot/TestCBot/ccc.txt b/src/CBot/TestCBot/ccc.txt deleted file mode 100644 index dbcd1d5..0000000 --- a/src/CBot/TestCBot/ccc.txt +++ /dev/null @@ -1,8 +0,0 @@ -public extern void ccc() -{ - int a; - a = 0 ; - - if ( a == 0 ); - -} \ No newline at end of file diff --git a/src/CBot/TestCBot/enum.txt b/src/CBot/TestCBot/enum.txt deleted file mode 100644 index a592a7f..0000000 --- a/src/CBot/TestCBot/enum.txt +++ /dev/null @@ -1,9 +0,0 @@ - -enum JourDeLaSemaine { - lundi = 1, - mardi, - mercredi, - jeudi, - vendredi, - samedi, - dimanche = 0 } \ No newline at end of file diff --git a/src/CBot/TestCBot/fibo.txt b/src/CBot/TestCBot/fibo.txt deleted file mode 100644 index 88f5357..0000000 --- a/src/CBot/TestCBot/fibo.txt +++ /dev/null @@ -1,25 +0,0 @@ - -extern public int Fibo( int n, boolean b ) -{ - if ( n < 2 ) return n; - int a = Fibo(n-1, b) + Fibo(n-2, false); - if ( b ) print (n + "=" + a); - return a; -} - -extern public void t() -{ - Fibo( 23, true); -} - -extern public void tt() -{ - t(); -} - -// cette routine n'est évidemment pas du tout obtimisée -// c'est même un très mauvais exemple de programmation récursive - -// pour un test de durée, Fibo(23, true) prend -// en mode Debug 67 secondes -// en mode Release 8 secondes diff --git a/src/CBot/TestCBot/file.txt b/src/CBot/TestCBot/file.txt deleted file mode 100644 index 2a22dd9..0000000 --- a/src/CBot/TestCBot/file.txt +++ /dev/null @@ -1,70 +0,0 @@ -class CLASS22 -{ - static int nb = 2; - void T22 ( ) { nb = nb / 0 ; } -} - -public extern void object :: TEST() -{ - switch ( 1 ) - { - case 1: - { - file h(); - h.open("Mon Fichier.txt", "r"); -show ( h.filename, h.handle ); -h.filename = "xx"; -h.handle = 1 ; - h.readln(); - h.close(); - } - case 2: - { - file h("Mon Fichier.txt"); - h.open("r"); - h.readln(); - h.close(); - } - case 3: - { - file h("Mon Fichier.txt", "r"); - h.readln(); - h.close(); - } - case 4: - { - file h(); - h.filename = "Mon Fichier.txt"; - h.open("r"); - h.readln(); - h.close(); - } - case 5: - { - file h = fileopen( "Mon 2Fichier.txt", "r" ); - h.readln(); - h.close(); - } - } -{ - file h( ) ; - h.filename = "Test.h"; - h.open ( "r" ); - - - file pf ( "Mon Fichier.txt" ) ; - pf . open ( "w" ) ; - pf . writeln ( "Voici encore du texte" ) ; - pf . writeln ( "et une seconde ligne" ) ; - pf . close( ); - - pf . open ( "r" ) ; - - while ( not pf . eof( ) ) - { - string s = pf . readln ( ); - show ( s ); - } - pf.close( ); -} -} diff --git a/src/CBot/TestCBot/h.txt b/src/CBot/TestCBot/h.txt deleted file mode 100644 index c395319..0000000 --- a/src/CBot/TestCBot/h.txt +++ /dev/null @@ -1,5 +0,0 @@ -void tf() -{ - file h; - h.handle += 1 ; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/include.txt b/src/CBot/TestCBot/include.txt deleted file mode 100644 index e8f8cc9..0000000 --- a/src/CBot/TestCBot/include.txt +++ /dev/null @@ -1,27 +0,0 @@ -class Z -{ - static int x = 0; - private int y; - - void T( ) - { - // autorisé ici - y = x ; - this.y = this.x ; - x = y ; - this.x = this.y ; - } -} - -extern public void test() -{ - Z a(); - 3 * a.x; // autorisé -//vu 3 * a.y; // interdit -//vu a.y = 3; // interdit ici - a.x = 1; // autorisé - - show ( a ); - a.T(); - show ( a ); -} diff --git a/src/CBot/TestCBot/intrinsic.txt b/src/CBot/TestCBot/intrinsic.txt deleted file mode 100644 index f215791..0000000 --- a/src/CBot/TestCBot/intrinsic.txt +++ /dev/null @@ -1,16 +0,0 @@ -public extern void TestIntrinsic() -{ - point a ( 1, 2 ); - print (a); - - a.x = 3; - a.y = 4; - - point b = a; - - println ( b.x, b.y, b ) ; - if ( b == a ) b.y = 0; - println (a,b); - if ( b != a ) b.y = a.y; - println(a,b); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/methode1.txt b/src/CBot/TestCBot/methode1.txt deleted file mode 100644 index 080bba2..0000000 --- a/src/CBot/TestCBot/methode1.txt +++ /dev/null @@ -1,57 +0,0 @@ -class t { - point p; -} - -void object :: toto() -{ - show ( Position ) ; -} - -extern public void object :: XX() -{ - int test []; - test [ 9999 ] = 3; - - toto () ; -/* - Radar(); - - object test ; - test = this. Radar(); - - do { - test = this.Radar(); - } while ( test == null ); - -/* - t test [ 4 ]; - for ( int i = 0 ; i < 4 ; i++ ) test [ i ] = new t(); - test [ 3 ] .p.x = 2; - show ( test ); -/* - int a = nan; - show ( a ) ; - - a = TypeMarkPath; - show ( a, a++, --a ) ; - - if ( a != nan ) a += 1 ; - - a = TypeMarkPath; - float q = a ; - show ( a, q ) ; - -return; - - a += ++a; - show ( a ) ; - - boolean i = false; - - if ( i == true ) {} - - object p; - if ( p == null) { p = p ; } -*/ -} - diff --git a/src/CBot/TestCBot/methode2.txt b/src/CBot/TestCBot/methode2.txt deleted file mode 100644 index 76ce7f4..0000000 --- a/src/CBot/TestCBot/methode2.txt +++ /dev/null @@ -1,50 +0,0 @@ - -extern void Toto() -{ - TEST(12); - - for ( int i = 0 ; i<1000; i++) - { - int j = 1; - if (i==55) TEST(12); - } - - TEST(2); - - -// Nouveau(); - int toto[4]; - point Z[3]; - - Z[1].x = 11; Z[1].y = 12; - - toto[2] = 12; - toto[1] = nan; - -// point test, autre(2,3) ; -// object titi = Radar(); - - TEST ( 1 ) ; - - toto[0] = 11; - - TEST ( 2 ) ; - - toto[6] = 0; -} - -extern void object::Nouveau() -{ - point a; - a = np(Position); -} - -point np(point b) -{ - point c; - c.x = b.y; - c.y = b.x; - return c ; -} - - diff --git a/src/CBot/TestCBot/mp1.txt b/src/CBot/TestCBot/mp1.txt deleted file mode 100644 index 599cfc4..0000000 --- a/src/CBot/TestCBot/mp1.txt +++ /dev/null @@ -1,25 +0,0 @@ -class Guepet -{ - - float a; - float b; - - void init() - { - a = 12.34; - b = 56.78; - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe =new Guepet(); - - guepe.init(); - - - show("test "+guepe.a+" "+guepe.b); - -} diff --git a/src/CBot/TestCBot/mp2.txt b/src/CBot/TestCBot/mp2.txt deleted file mode 100644 index 1c2972c..0000000 --- a/src/CBot/TestCBot/mp2.txt +++ /dev/null @@ -1,28 +0,0 @@ -class Guepet -{ - - float a; - float b; - - void init() - { - a = 12.34; - b = 56.78; - - object x = radar(123); - show("radar "+x.position.x); - show("C'est fait"); - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe=new Guepet(); - - guepe.init(); - - show("test "+guepe.a+" "+guepe.b); - -} diff --git a/src/CBot/TestCBot/mw.txt b/src/CBot/TestCBot/mw.txt deleted file mode 100644 index c237670..0000000 --- a/src/CBot/TestCBot/mw.txt +++ /dev/null @@ -1,16 +0,0 @@ -extern public void main() -{ -// goto( 3, 4 ); - - while( true ) - { - try { goto (12) ; } - catch( FF( ) ) - { show( "ko"); } - } -} - -boolean FF() -{ - return false; -} diff --git a/src/CBot/TestCBot/null.txt b/src/CBot/TestCBot/null.txt deleted file mode 100644 index ae76b74..0000000 --- a/src/CBot/TestCBot/null.txt +++ /dev/null @@ -1,5 +0,0 @@ -extern public void xxx () -{ - CPoint test = null ; - if ( test == null ) show ( "NULL" ); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/opnew.txt b/src/CBot/TestCBot/opnew.txt deleted file mode 100644 index 7d6838c..0000000 --- a/src/CBot/TestCBot/opnew.txt +++ /dev/null @@ -1,20 +0,0 @@ -extern public void xx () -{ - CPoint pointeur, test = null ; - pointeur = new CPoint ( 3, 4 ); - - if ( test == null ) show ( "NULL" ); - - CPoint pp = pointeur; - -show( pointeur , pp ); - - pp.x = 33.3; - if ( pointeur.x != pp.x ) 0/0; - - pp = new CPoint(); -// pointeur = pp; - -show( pointeur , pp ); - -} \ No newline at end of file diff --git a/src/CBot/TestCBot/plante.txt b/src/CBot/TestCBot/plante.txt deleted file mode 100644 index 363461b..0000000 --- a/src/CBot/TestCBot/plante.txt +++ /dev/null @@ -1,25 +0,0 @@ -class Guepet -{ - - point pos; - float t = 0.1; - - void init() - { - pos.x = 12.123; - pos.y = 34.345; - - F(t); - } - - -} - -extern void object::Fourmi6() -{ - Guepet guepe=new Guepet(); - - guepe.init(); - - show ( guepe ); -} diff --git a/src/CBot/TestCBot/pointer.txt b/src/CBot/TestCBot/pointer.txt deleted file mode 100644 index 2d4d907..0000000 --- a/src/CBot/TestCBot/pointer.txt +++ /dev/null @@ -1,41 +0,0 @@ -extern public void x () -{ - show ( 3 ** 4 ); - float z = 1e-3; - show ( z ); - - CPoint b ( 4,5 ); - show ( b ); - - CPoint a ( ) ; - a.x = 21; a.y = 12; - show ( a ) ; - - CPoint test = new CPoint ( 1,1 ); - test = new CPoint ( 2, 2 ); - show ( test ); -} - -// crée un objet et retourne son pointeur -CPoint newcpoint() -{ - CPoint p = new CPoint ( 3, 3 ); - return p; -} - -extern public void y () -{ - CPoint test = newcpoint(); - println ( test ); - dontmodif( test ); - println ( test ); -} - -// ne doit pas modifier l'objet en paramètre -void dontmodif ( CPoint pp ) -{ - pp.x = 5; - pp.y = 2; - println ( pp, pp.x, pp.y ); -} - diff --git a/src/CBot/TestCBot/postinc.txt b/src/CBot/TestCBot/postinc.txt deleted file mode 100644 index cdf6ab5..0000000 --- a/src/CBot/TestCBot/postinc.txt +++ /dev/null @@ -1,7 +0,0 @@ -extern public void X() -{ - point A [ ] ; - A[5] = new point (2,3); - int val = A[5].x++ + --A[5].y; - show ( A, val ); -} diff --git a/src/CBot/TestCBot/radar.txt b/src/CBot/TestCBot/radar.txt deleted file mode 100644 index 09d84a2..0000000 --- a/src/CBot/TestCBot/radar.txt +++ /dev/null @@ -1,39 +0,0 @@ -extern void object::Bug( ) -{ - try{ int a = 44 ; a = 12 / 0 ; } - catch(6000) { int b = 4 ; } - finally { int z = 1 ; } - -// tp ( A, B ); - -/* int a = 4, b = 2, c = nan; - float x, y = 3/2, z = nan; - boolean i, j = false, k = true; - - string s, ss = "xyz"; - - while ( false ) - { - object left, right; - - left = Radar(TypeMarkPath, -45, 120, 100); - right = Radar(TypeMarkPath, 45, 120, 100); - - if ( left == null && right == null ) - { - } - } - int t = fact ( 4 ) ;*/ -} - -void tp( point a , point b ) -{ - a.x += b.x; -} - - -int fact( int n ) -{ - if ( n < 2 ) return n; - return n * fact ( n - 1 ) ; -} \ No newline at end of file diff --git a/src/CBot/TestCBot/res/TestCBot.ico b/src/CBot/TestCBot/res/TestCBot.ico deleted file mode 100644 index 06a649d..0000000 Binary files a/src/CBot/TestCBot/res/TestCBot.ico and /dev/null differ diff --git a/src/CBot/TestCBot/res/TestCBot.rc2 b/src/CBot/TestCBot/res/TestCBot.rc2 deleted file mode 100644 index b55f0d9..0000000 --- a/src/CBot/TestCBot/res/TestCBot.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// TESTCBOT.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/TestCBot/res/TestCBotDoc.ico b/src/CBot/TestCBot/res/TestCBotDoc.ico deleted file mode 100644 index 3545614..0000000 Binary files a/src/CBot/TestCBot/res/TestCBotDoc.ico and /dev/null differ diff --git a/src/CBot/TestCBot/res/Toolbar.bmp b/src/CBot/TestCBot/res/Toolbar.bmp deleted file mode 100644 index 04a71af..0000000 Binary files a/src/CBot/TestCBot/res/Toolbar.bmp and /dev/null differ diff --git a/src/CBot/TestCBot/resource.h b/src/CBot/TestCBot/resource.h deleted file mode 100644 index d661201..0000000 --- a/src/CBot/TestCBot/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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://www.gnu.org/licenses/.//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by TestCBot.rc -// -#define IDD_ABOUTBOX 100 -#define IDR_MAINFRAME 128 -#define IDR_TESTCBTYPE 129 -#define IDD_DIALOG1 130 -#define IDD_CONSOLE 131 -#define IDD_DIALOG2 133 -#define IDC_EDIT1 1000 -#define TX_TYPENAMES 1000 -#define IDC_SPIN1 1001 -#define IDC_EDIT2 1002 -#define IDC_COMBO1 1003 -#define IDC_EDIT3 1004 -#define ID_RUN 32771 -#define ID_TEST 32772 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 135 -#define _APS_NEXT_COMMAND_VALUE 32773 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/CBot/TestCBot/solution.txt b/src/CBot/TestCBot/solution.txt deleted file mode 100644 index f78cf12..0000000 --- a/src/CBot/TestCBot/solution.txt +++ /dev/null @@ -1,13 +0,0 @@ -extern void object::Solution( ) -{ -show ( "Solution " + Position ); - Carré(15); - Carré(25); -} - -void object::Carré(float côté) -{ -show ( "Carré " + Position ); - Move(côté); - Turn(-90); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/test.txt b/src/CBot/TestCBot/test.txt deleted file mode 100644 index a912415..0000000 --- a/src/CBot/TestCBot/test.txt +++ /dev/null @@ -1,8 +0,0 @@ -extern public void x() -{ - float a= 1, b = 2; - a = b * ( 2 + 2 ); -// print (a); - a += 4; -// print (a); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/test23.txt b/src/CBot/TestCBot/test23.txt deleted file mode 100644 index d6e1ddd..0000000 --- a/src/CBot/TestCBot/test23.txt +++ /dev/null @@ -1,10 +0,0 @@ -extern public void object::TEST23() -{ - CLASS22 T; - T.T22( ) ; - - show( position ); - show( this.position ); - -// T22(); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/testmw.txt b/src/CBot/TestCBot/testmw.txt deleted file mode 100644 index 6570f6d..0000000 --- a/src/CBot/TestCBot/testmw.txt +++ /dev/null @@ -1,14 +0,0 @@ -extern public int testmw( int a) -{ - boolean b = true ; - - if (b) - return 1 ; - else - return a ; 0 * testmw(a-1) ; -} - -public int Fibo2 ( int n ) -{ - print ( " bof " ); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/this.txt b/src/CBot/TestCBot/this.txt deleted file mode 100644 index b8a9e04..0000000 --- a/src/CBot/TestCBot/this.txt +++ /dev/null @@ -1,13 +0,0 @@ -extern void object :: TEST22 ( ) -{ - show( position ); - show( this.position ); - - T(); -} - -public void object :: T22() -{ - show( position ); - show( this.position ); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/tt.txt b/src/CBot/TestCBot/tt.txt deleted file mode 100644 index cd13c9d..0000000 --- a/src/CBot/TestCBot/tt.txt +++ /dev/null @@ -1,12 +0,0 @@ -extern public void T() { T1(); } - -public void T1() -{ - show( "T1" ); - T2(); -} - -public void T2() -{ - show( "T2" ); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/tt2.txt b/src/CBot/TestCBot/tt2.txt deleted file mode 100644 index ad9dc1d..0000000 --- a/src/CBot/TestCBot/tt2.txt +++ /dev/null @@ -1,5 +0,0 @@ -extern public void TT() -{ - T1(); - T2(); -} \ No newline at end of file diff --git a/src/CBot/TestCBot/vide.txt b/src/CBot/TestCBot/vide.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/CBot/TestCBot/xTestCBot.clw b/src/CBot/TestCBot/xTestCBot.clw deleted file mode 100644 index 5b84c16..0000000 --- a/src/CBot/TestCBot/xTestCBot.clw +++ /dev/null @@ -1,245 +0,0 @@ -; CLW file contains information for the MFC ClassWizard - -[General Info] -Version=1 -LastClass=CBotConsoleDlg -LastTemplate=CDialog -NewFileInclude1=#include "stdafx.h" -NewFileInclude2=#include "TestCBot.h" -LastPage=0 - -ClassCount=7 -Class1=CTestCBotApp -Class2=CTestCBotDoc -Class3=CTestCBotView -Class4=CMainFrame - -ResourceCount=7 -Resource1=IDD_ABOUTBOX -Resource2=IDR_MAINFRAME -Resource3=IDR_TESTCBTYPE -Class5=CAboutDlg -Class6=CChildFrame -Resource4=IDD_ABOUTBOX (French (France)) -Resource5=IDR_TESTCBTYPE (French (France)) -Resource6=IDD_CONSOLE -Class7=CBotConsoleDlg -Resource7=IDR_MAINFRAME (French (France)) - -[CLS:CTestCBotApp] -Type=0 -HeaderFile=TestCBot.h -ImplementationFile=TestCBot.cpp -Filter=N - -[CLS:CTestCBotDoc] -Type=0 -HeaderFile=TestCBotDoc.h -ImplementationFile=TestCBotDoc.cpp -Filter=N -BaseClass=CDocument -VirtualFilter=DC -LastObject=IDC_EDIT2 - -[CLS:CTestCBotView] -Type=0 -HeaderFile=TestCBotView.h -ImplementationFile=TestCBotView.cpp -Filter=C -BaseClass=CView -VirtualFilter=VWC -LastObject=CTestCBotView - -[CLS:CMainFrame] -Type=0 -HeaderFile=MainFrm.h -ImplementationFile=MainFrm.cpp -Filter=T -BaseClass=CMDIFrameWnd -VirtualFilter=fWC -LastObject=CMainFrame - - -[CLS:CChildFrame] -Type=0 -HeaderFile=ChildFrm.h -ImplementationFile=ChildFrm.cpp -Filter=M - -[CLS:CAboutDlg] -Type=0 -HeaderFile=TestCBot.cpp -ImplementationFile=TestCBot.cpp -Filter=D - -[DLG:IDD_ABOUTBOX] -Type=1 -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308352 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 -Class=CAboutDlg - -[MNU:IDR_MAINFRAME] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command4=ID_APP_EXIT -Command5=ID_VIEW_TOOLBAR -Command6=ID_VIEW_STATUS_BAR -Command7=ID_APP_ABOUT -CommandCount=7 -Command3=ID_FILE_MRU_FILE1 - -[TB:IDR_MAINFRAME] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_EDIT_CUT -Command5=ID_EDIT_COPY -Command6=ID_EDIT_PASTE -Command7=ID_FILE_PRINT -CommandCount=8 -Command8=ID_APP_ABOUT - -[MNU:IDR_TESTCBTYPE] -Type=1 -Class=CTestCBotView -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_CLOSE -Command4=ID_FILE_SAVE -Command5=ID_FILE_SAVE_AS -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_VIEW_TOOLBAR -Command13=ID_VIEW_STATUS_BAR -Command14=ID_WINDOW_NEW -CommandCount=18 -Command6=ID_FILE_MRU_FILE1 -Command7=ID_APP_EXIT -Command8=ID_EDIT_UNDO -Command15=ID_WINDOW_CASCADE -Command16=ID_WINDOW_TILE_HORZ -Command17=ID_WINDOW_ARRANGE -Command18=ID_APP_ABOUT - -[ACL:IDR_MAINFRAME] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command5=ID_EDIT_CUT -Command6=ID_EDIT_COPY -Command7=ID_EDIT_PASTE -Command8=ID_EDIT_UNDO -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_NEXT_PANE -CommandCount=13 -Command4=ID_EDIT_UNDO -Command13=ID_PREV_PANE - - -[TB:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_EDIT_CUT -Command5=ID_EDIT_COPY -Command6=ID_EDIT_PASTE -Command7=ID_FILE_PRINT -Command8=ID_RUN -Command9=ID_APP_ABOUT -CommandCount=9 - -[MNU:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_MRU_FILE1 -Command4=ID_APP_EXIT -Command5=ID_VIEW_TOOLBAR -Command6=ID_VIEW_STATUS_BAR -Command7=ID_APP_ABOUT -CommandCount=7 - -[MNU:IDR_TESTCBTYPE (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_CLOSE -Command4=ID_FILE_SAVE -Command5=ID_FILE_SAVE_AS -Command6=ID_FILE_MRU_FILE1 -Command7=ID_APP_EXIT -Command8=ID_EDIT_UNDO -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_VIEW_TOOLBAR -Command13=ID_VIEW_STATUS_BAR -Command14=ID_WINDOW_NEW -Command15=ID_WINDOW_CASCADE -Command16=ID_WINDOW_TILE_HORZ -Command17=ID_WINDOW_ARRANGE -Command18=ID_APP_ABOUT -CommandCount=18 - -[ACL:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_EDIT_COPY -Command2=ID_FILE_NEW -Command3=ID_FILE_OPEN -Command4=ID_FILE_SAVE -Command5=ID_EDIT_PASTE -Command6=ID_EDIT_UNDO -Command7=ID_EDIT_CUT -Command8=ID_RUN -Command9=ID_NEXT_PANE -Command10=ID_PREV_PANE -Command11=ID_RUN -Command12=ID_EDIT_COPY -Command13=ID_EDIT_PASTE -Command14=ID_EDIT_CUT -Command15=ID_EDIT_UNDO -CommandCount=15 - -[DLG:IDD_ABOUTBOX (French (France))] -Type=1 -Class=CAboutDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - -[DLG:IDD_CONSOLE] -Type=1 -Class=CBotConsoleDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT2,edit,1350631552 -Control3=IDOK,button,1342242817 -Control4=IDC_EDIT1,edit,1352734724 - -[CLS:CBotConsoleDlg] -Type=0 -HeaderFile=CBotConsoleDlg.h -ImplementationFile=CBotConsoleDlg.cpp -BaseClass=CDialog -Filter=D -VirtualFilter=dWC - diff --git a/src/CBot/TestCBot/zz.txt b/src/CBot/TestCBot/zz.txt deleted file mode 100644 index da764ac..0000000 --- a/src/CBot/TestCBot/zz.txt +++ /dev/null @@ -1,6 +0,0 @@ -extern public void zz() -{ - MaClass TOTO (); - - show (TOTO); -} \ No newline at end of file diff --git a/src/CBot/_Copy.bat b/src/CBot/_Copy.bat deleted file mode 100644 index 510dc5a..0000000 --- a/src/CBot/_Copy.bat +++ /dev/null @@ -1,2 +0,0 @@ -copy debug\cbot.dll "F:\Program Files\Ceebot\cbot.dll" -cls \ No newline at end of file diff --git a/src/CBot/colobot.ini b/src/CBot/colobot.ini deleted file mode 100644 index 32163db..0000000 --- a/src/CBot/colobot.ini +++ /dev/null @@ -1,49 +0,0 @@ -[Directory] -scene=scene -savegame=savegame -public=program -user=user -[Setup] -TotoMode=1 -Tooltips=1 -InterfaceGlint=1 -NiceMouse=0 -Movies=1 -NiceReset=1 -HimselfDamage=1 -CameraScroll=1 -CameraInvertX=0 -InterfaceEffect=1 -GroundShadow=1 -GroundSpot=1 -ObjectDirty=1 -FogMode=1 -LensMode=1 -SkyMode=1 -PlanetMode=1 -LightMode=1 -UseJoystick=0 -ParticuleDensity=1.00 -ClippingDistance=1.00 -ObjectDetail=2.00 -GadgetQuantity=1.00 -TextureQuality=1 -AudioVolume=20 -MidiVolume=15 -Sound3D=0 -EditIndentMode=1 -EditIndentValue=4 -KeyMap=37+0 39+0 38+0 40+0 16+0 17+0 32+258 96+262 13+257 107+261 109+260 9+259 36+263 27+0 112+0 113+0 110+0 115+0 116+0 117+0 -[Engine] -AlphaMode=1 -StateColor=-1 -BlackSrcBlend=0 -BlackDestBlend=0 -WhiteSrcBlend=0 -WhiteDestBlend=0 -DiffuseSrcBlend=0 -DiffuseDestBlend=0 -AlphaSrcBlend=0 -AlphaDestBlend=0 -[Gamer] -LastName=Player diff --git a/src/CBot/old TstCBot/BotConsoleDlg.cpp b/src/CBot/old TstCBot/BotConsoleDlg.cpp deleted file mode 100644 index 077f080..0000000 --- a/src/CBot/old TstCBot/BotConsoleDlg.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// BotConsoleDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "TstCBot.h" -#include "BotConsoleDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg dialog - - -CBotConsoleDlg::CBotConsoleDlg(CWnd* pParent /*=NULL*/) - : CDialog(CBotConsoleDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CBotConsoleDlg) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT - m_pProg = NULL; - m_threadinfo.m_bRun = FALSE; -} - - -void CBotConsoleDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CBotConsoleDlg) - DDX_Control(pDX, IDOK, m_cOK); - DDX_Control(pDX, IDC_EDIT2, m_Edit2); - DDX_Control(pDX, IDC_EDIT1, m_Edit1); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CBotConsoleDlg, CDialog) - //{{AFX_MSG_MAP(CBotConsoleDlg) - ON_MESSAGE(WM_ENDPROG, EndProg) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg message handlers - -UINT ThreadProc(ThreadInfo *info) -{ - CTime t0 = CTime::GetCurrentTime(); - int Cpt = 0; - - info->m_pProg->Start("LaCommande"); - while ( !info->m_bStop && !info->m_pProg->Run() ) - { - Cpt++; - if ( Cpt%20 == 0 ) info->m_pEdit1->ReplaceSel("."); - } - - if ( info->m_bStop ) - { - info->m_pEdit1->ReplaceSel("\r\nInterrompu\r\n"); - } - else if (info->m_pProg->GivError() == 0) - { - CTime t = CTime::GetCurrentTime(); - CTimeSpan ts = t - t0; - - char buffer[200]; - sprintf( buffer, "\r\nExécution terminée en %d secondes.\r\nInterrompue %d fois.\r\n", - ts.GetTotalSeconds(), Cpt); - - info->m_pEdit1->ReplaceSel(buffer); - } - - info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; - return 0 ; -} - -LONG CBotConsoleDlg::EndProg(UINT wparam, LONG lparam) -{ - m_threadinfo.m_bRun = FALSE; - - if (m_pProg->GetError(m_code, m_start, m_end)) - { - AfxMessageBox(m_code); - CDialog::OnCancel(); - return 1; - } - delete m_pProg; - m_pProg = NULL; - - m_Edit2.EnableWindow(TRUE); - m_cOK.EnableWindow(TRUE); - - m_Edit2.SetWindowText(""); - m_Edit2.SetFocus(); - return 0 ; -} - -void CBotConsoleDlg::OnOK() -{ - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - pApp->m_pConsole = &m_Edit1; - - CString Commande; - m_Edit2.GetWindowText(Commande); - - CString s = "void LaCommande() { " + Commande + " ;}"; - m_pProg = new CBotProgram(); - CBotStringArray liste; - m_pProg->Compile(s, liste); - int err, start, end; - if ( m_pProg->GetError(err, start, end) ) - { - AfxMessageBox(err); - m_Edit2.SetSel(start-20, end-20); - return; - } - - m_Edit1.ReplaceSel(Commande + " ->\r\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_pProg = m_pProg; - m_threadinfo.m_bStop = FALSE; - m_threadinfo.m_bRun = TRUE; - - AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; -} - -void CBotConsoleDlg::OnCancel() -{ - if (!m_threadinfo.m_bRun) CDialog::OnCancel(); - m_threadinfo.m_bStop = TRUE ; -} - - -BOOL CBotConsoleDlg::OnInitDialog() -{ - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - - CDialog::OnInitDialog(); - - m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n"); - for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ ) - { - CBotString x = CString(pApp->m_Liste[i]) + "\r\n"; - m_Edit1.ReplaceSel(x); - } - m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n"); - - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/src/CBot/old TstCBot/BotConsoleDlg.h b/src/CBot/old TstCBot/BotConsoleDlg.h deleted file mode 100644 index 9b54ff2..0000000 --- a/src/CBot/old TstCBot/BotConsoleDlg.h +++ /dev/null @@ -1,65 +0,0 @@ -#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) -#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// BotConsoleDlg.h : header file -// - -struct ThreadInfo -{ - CEdit* m_pEdit1 ; - CBotProgram* m_pProg; - CWnd* m_pWndMessage; - BOOL m_bStop; - BOOL m_bRun; -}; - - -///////////////////////////////////////////////////////////////////////////// -// CBotConsoleDlg dialog - -class CBotConsoleDlg : public CDialog -{ -// Construction -public: - CBotConsoleDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CBotConsoleDlg) - enum { IDD = IDD_CONSOLE }; - CButton m_cOK; - CEdit m_Edit2; - CEdit m_Edit1; - //}}AFX_DATA - - CBotProgram* m_pProg; - ThreadInfo m_threadinfo; - - int m_code, m_start, m_end; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBotConsoleDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CBotConsoleDlg) - virtual void OnOK(); - virtual void OnCancel(); - virtual BOOL OnInitDialog(); - afx_msg LONG EndProg(UINT wparam, LONG lparam) ; - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/old TstCBot/BotErrorDlg.cpp b/src/CBot/old TstCBot/BotErrorDlg.cpp deleted file mode 100644 index 87d56f0..0000000 --- a/src/CBot/old TstCBot/BotErrorDlg.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// BotErrorDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "TstCBot.h" -#include "BotErrorDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CBotErrorDlg dialog - - -CBotErrorDlg::CBotErrorDlg(CWnd* pParent /*=NULL*/) - : CDialog(CBotErrorDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CBotErrorDlg) - m_TextProgram = _T(""); - //}}AFX_DATA_INIT -} - - -void CBotErrorDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CBotErrorDlg) - DDX_Control(pDX, IDC_EDIT1, m_eProgram); - DDX_Control(pDX, IDC_STATIC1, m_sMessage); - DDX_Text(pDX, IDC_EDIT1, m_TextProgram); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(CBotErrorDlg, CDialog) - //{{AFX_MSG_MAP(CBotErrorDlg) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CBotErrorDlg message handlers - -BOOL CBotErrorDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - m_sMessage.SetWindowText(m_TextError); - m_eProgram.SetFocus(); - m_eProgram.SetSel(m_start, m_end); - - return FALSE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} diff --git a/src/CBot/old TstCBot/BotErrorDlg.h b/src/CBot/old TstCBot/BotErrorDlg.h deleted file mode 100644 index 522afad..0000000 --- a/src/CBot/old TstCBot/BotErrorDlg.h +++ /dev/null @@ -1,51 +0,0 @@ -#if !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_) -#define AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 -// BotErrorDlg.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CBotErrorDlg dialog - -class CBotErrorDlg : public CDialog -{ -// Construction -public: - CBotErrorDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CBotErrorDlg) - enum { IDD = IDD_DIALOG1 }; - CEdit m_eProgram; - CStatic m_sMessage; - CString m_TextProgram; - //}}AFX_DATA - - - CString m_TextError; - int m_start, m_end; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBotErrorDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(CBotErrorDlg) - virtual BOOL OnInitDialog(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/old TstCBot/CBotTest.txt b/src/CBot/old TstCBot/CBotTest.txt deleted file mode 100644 index ce20e26..0000000 --- a/src/CBot/old TstCBot/CBotTest.txt +++ /dev/null @@ -1,36 +0,0 @@ - -extern void TheTest() -{ - for (int x = 130; x>0; x--) print (x); -} - -extern void Test() -{ - int var = 10000 ; - while (var > 0) var = var -1; -} -// exécuté en 30 secondes - -extern void Autre() -{ - int var = 10000 ; - while (var > 0) if ( var > 0 ) var = var -1; -} -// exécuté en 45 secondes - -int Y ( int n ) -{ - if ( n < 2 ) return n; - int a = Y(n-1) + Y(n-2); - return a; -} - -extern int X ( int n ) -{ - if ( n < 2 ) { print(n); return n; } - int a = X(n-1) + Y(n-2); - print (a); - return a; -} - - diff --git a/src/CBot/old TstCBot/CMyThread.cpp b/src/CBot/old TstCBot/CMyThread.cpp deleted file mode 100644 index ca92c77..0000000 --- a/src/CBot/old TstCBot/CMyThread.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// CMyThread.cpp : pour créer un processus pour la console -// - -#include "stdafx.h" -#include "TstCBot.h" -#include "CMyThread.h" -#include "BotConsoleDlg.h" - - -//IMPLEMENT_DYNAMIC (CMyThread, CWinThread) -IMPLEMENT_DYNCREATE (CMyThread, CWinThread) - -///////////////////////////////////////////////////////////////////////////// -// CMyThread - -BEGIN_MESSAGE_MAP(CMyThread, CWinThread) - //{{AFX_MSG_MAP(CMyThread) - //}}AFX_MSG_MAP - // Standard file based document commands -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMyThread construction - -CMyThread::CMyThread() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - - -///////////////////////////////////////////////////////////////////////////// -// CMyThread initialization -/* -BOOL CMyThread::InitInstance() -{ - AfxEnableControlContainer(); - - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - - // ouvre une fenêtre pour afficher les sorties - CRect rect; - AfxGetMainWnd()->GetClientRect( rect ); - rect += CPoint(30,30); - - CWnd* pWnd = new CWnd(); - pWnd->CreateEx( 0, - AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), - "CBot console", WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE, - rect, - AfxGetMainWnd()->GetParent(), NULL, NULL); - m_pMainWnd = pWnd; - - pApp->m_pEdit2 = new CEdit(); - - m_pMainWnd->GetClientRect( rect ); - rect.bottom -= 40; - pApp->m_pEdit2->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN| - ES_AUTOVSCROLL|ES_READONLY, - rect, m_pMainWnd, IDC_EDIT2 ); - - pApp->m_pEdit2->ReplaceSel("Les fonctions suivantes sont disponibles:\n\r"); - for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ ) - { - pApp->m_pEdit2->ReplaceSel(pApp->m_Liste[i] + "\r\n"); - } - pApp->m_pEdit2->ReplaceSel("Entrez une commande ci-dessous.\r\r"); - - -// pApp->m_pEdit2->SetFocus(); - - pApp->m_pEdit3 = new CEdit(); - m_pMainWnd->GetClientRect( rect ); - rect.top = rect.bottom-40; - pApp->m_pEdit3->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP, - rect, m_pMainWnd, IDC_EDIT1 ); - pApp->m_pEdit3->SetFocus(); - - return TRUE; -}*/ - -BOOL CMyThread::InitInstance() -{ - CBotConsoleDlg dlg; - m_pMainWnd = &dlg; // cela ferme l'application avec la DBOX ! - - int nResponse = dlg.DoModal(); - - return TRUE; -} - - -int CMyThread::ExitInstance() -{ - return 0; -} - - -///////////////////////////////////////////////////////////////////////////// -// CMyThread message handlers - - -void CMyThread::OnReturn() -{ - // TODO: Add your command handler code here - __asm int 3; -} diff --git a/src/CBot/old TstCBot/CMyThread.h b/src/CBot/old TstCBot/CMyThread.h deleted file mode 100644 index 1134077..0000000 --- a/src/CBot/old TstCBot/CMyThread.h +++ /dev/null @@ -1,44 +0,0 @@ -// CMyThread.h : pour créer un processus pour la console -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - - -#include "stdafx.h" -#include "TstCBot.h" - -class CMyThread : public CWinThread -{ -// DECLARE_DYNAMIC(CMyThread) - DECLARE_DYNCREATE(CMyThread) - -public: - - -// Constructor - CMyThread(); - virtual BOOL InitInstance(); - virtual int ExitInstance(); // return app exit code - -// Implementation - - //{{AFX_MSG(CTstCBotApp) - afx_msg void OnAppAbout(); - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - -// Generated message map functions -protected: - //{{AFX_MSG(CMainFrame) - afx_msg void OnReturn(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/old TstCBot/MainFrm.cpp b/src/CBot/old TstCBot/MainFrm.cpp deleted file mode 100644 index 6c0962c..0000000 --- a/src/CBot/old TstCBot/MainFrm.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "TstCBot.h" - -#include "MainFrm.h" -#include "BotErrorDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) - ON_WM_CREATE() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() -{ - // TODO: add member initialization code here - -} - -CMainFrame::~CMainFrame() -{ -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return CFrameWnd::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - CFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - CFrameWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers - - diff --git a/src/CBot/old TstCBot/MainFrm.h b/src/CBot/old TstCBot/MainFrm.h deleted file mode 100644 index 56b9c41..0000000 --- a/src/CBot/old TstCBot/MainFrm.h +++ /dev/null @@ -1,55 +0,0 @@ -// MainFrm.h : interface of the CMainFrame class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -class CMainFrame : public CFrameWnd -{ -protected: // create from serialization only - CMainFrame(); - DECLARE_DYNCREATE(CMainFrame) - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMainFrame) - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CMainFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - -// Generated message map functions -protected: - //{{AFX_MSG(CMainFrame) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnCp1(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/old TstCBot/ReadMe.txt b/src/CBot/old TstCBot/ReadMe.txt deleted file mode 100644 index 67dc05b..0000000 --- a/src/CBot/old TstCBot/ReadMe.txt +++ /dev/null @@ -1,93 +0,0 @@ -======================================================================== - MICROSOFT FOUNDATION CLASS LIBRARY : TstCBot -======================================================================== - - -AppWizard has created this TstCBot application for you. This application -not only demonstrates the basics of using the Microsoft Foundation classes -but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your TstCBot application. - -TstCBot.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CTstCBotApp application class. - -TstCBot.cpp - This is the main application source file that contains the application - class CTstCBotApp. - -TstCBot.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Developer Studio. - -res\TstCBot.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file TstCBot.rc. - -res\TstCBot.rc2 - This file contains resources that are not edited by Microsoft - Developer Studio. You should place all resources not - editable by the resource editor in this file. - -TstCBot.clw - This file contains information used by ClassWizard to edit existing - classes or add new classes. ClassWizard also uses this file to store - information needed to create and edit message maps and dialog data - maps and to create prototype member functions. - -///////////////////////////////////////////////////////////////////////////// - -For the main frame window: - -MainFrm.h, MainFrm.cpp - These files contain the frame class CMainFrame, which is derived from - CFrameWnd and controls all SDI frame features. - - -///////////////////////////////////////////////////////////////////////////// - -AppWizard creates one document type and one view: - -TstCBotDoc.h, TstCBotDoc.cpp - the document - These files contain your CTstCBotDoc class. Edit these files to - add your special document data and to implement file saving and loading - (via CTstCBotDoc::Serialize). - -TstCBotView.h, TstCBotView.cpp - the view of the document - These files contain your CTstCBotView class. - CTstCBotView objects are used to view CTstCBotDoc objects. - - - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named TstCBot.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Developer Studio reads and updates this file. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, and your application is -in a language other than the operating system's current language, you -will need to copy the corresponding localized resources MFC40XXX.DLL -from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, -and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. -For example, MFC40DEU.DLL contains resources translated to German.) If you -don't do this, some of the UI elements of your application will remain in the -language of the operating system. - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/old TstCBot/Resource.h b/src/CBot/old TstCBot/Resource.h deleted file mode 100644 index 6863fd8..0000000 --- a/src/CBot/old TstCBot/Resource.h +++ /dev/null @@ -1,68 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by TstCBot.rc -// -#define IDD_ABOUTBOX 100 -#define IDR_MAINFRAME 128 -#define IDR_TSTCBOTYPE 129 -#define IDD_DIALOG1 130 -#define IDD_CONSOLE 131 -#define IDC_EDIT1 1000 -#define TX_TYPENAMES 1000 -#define IDC_STATIC1 1001 -#define IDC_EDIT2 1002 -#define TX_OPENPAR 5000 -#define TX_CLOSEPAR 5001 -#define TX_NOTBOOL 5002 -#define TX_UNDEFVAR 5003 -#define TX_BADLEFT 5004 -#define TX_ENDOF 5005 -#define TX_OUTCASE 5006 -#define TX_NOTERM 5007 -#define TX_CLOSEBLK 5008 -#define TX_ELSEWITHOUTIF 5009 -#define TX_OPENBLK 5010 -#define TX_BADTYPE 5011 -#define TX_REDEFVAR 5012 -#define TX_BAD2TYPE 5013 -#define TX_UNDEFCALL 5014 -#define TX_MISDOTS 5015 -#define TX_WHILE 5016 -#define TX_BREAK 5017 -#define TX_LABEL 5018 -#define TX_NOLABEL 5019 -#define TX_NOCASE 5020 -#define TX_BADNUM 5021 -#define TX_VOID 5022 -#define TX_NOTYP 5023 -#define TX_NOVAR 5024 -#define TX_NOFONC 5025 -#define TX_OVERPARAM 5026 -#define TX_REDEF 5027 -#define TX_LOWPARAM 5028 -#define TX_BADPARAM 5029 -#define TX_NUMPARAM 5030 -#define TX_NOITEM 5031 -#define TX_DOT 5032 -#define TX_NOCONST 5033 -#define TX_REDEFCLASS 5034 -#define TX_DIVZERO 6000 -#define TX_NOTINIT 6001 -#define TX_BADTHROW 6002 -#define TX_NORETVAL 6003 -#define TX_NORUN 6004 -#define TX_NOCALL 6005 -#define ID_CP1 32771 -#define ID_EXE 32772 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 132 -#define _APS_NEXT_COMMAND_VALUE 32775 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/CBot/old TstCBot/StdAfx.cpp b/src/CBot/old TstCBot/StdAfx.cpp deleted file mode 100644 index ae0ec93..0000000 --- a/src/CBot/old TstCBot/StdAfx.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// TstCBot.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - diff --git a/src/CBot/old TstCBot/StdAfx.h b/src/CBot/old TstCBot/StdAfx.h deleted file mode 100644 index 7d46ace..0000000 --- a/src/CBot/old TstCBot/StdAfx.h +++ /dev/null @@ -1,26 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC OLE automation classes -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/old TstCBot/TstCBot.clw b/src/CBot/old TstCBot/TstCBot.clw deleted file mode 100644 index 4c54168..0000000 --- a/src/CBot/old TstCBot/TstCBot.clw +++ /dev/null @@ -1,189 +0,0 @@ -; CLW file contains information for the MFC ClassWizard - -[General Info] -Version=1 -LastClass=CTstCBotView -LastTemplate=CDialog -NewFileInclude1=#include "stdafx.h" -NewFileInclude2=#include "TstCBot.h" -LastPage=0 - -ClassCount=7 -Class1=CTstCBotApp -Class2=CTstCBotDoc -Class3=CTstCBotView -Class4=CMainFrame - -ResourceCount=6 -Resource1=IDD_ABOUTBOX -Resource2=IDR_MAINFRAME -Class5=CAboutDlg -Resource3=IDD_ABOUTBOX (French (France)) -Resource4=IDD_CONSOLE -Class6=CBotErrorDlg -Resource5=IDD_DIALOG1 (French (Switzerland)) -Class7=CBotConsoleDlg -Resource6=IDR_MAINFRAME (French (France)) - -[CLS:CTstCBotApp] -Type=0 -HeaderFile=TstCBot.h -ImplementationFile=TstCBot.cpp -Filter=N - -[CLS:CTstCBotDoc] -Type=0 -HeaderFile=TstCBotDoc.h -ImplementationFile=TstCBotDoc.cpp -Filter=N -BaseClass=CDocument -VirtualFilter=DC -LastObject=CTstCBotDoc - -[CLS:CTstCBotView] -Type=0 -HeaderFile=TstCBotView.h -ImplementationFile=TstCBotView.cpp -Filter=C -BaseClass=CView -VirtualFilter=VWC -LastObject=CTstCBotView - -[CLS:CMainFrame] -Type=0 -HeaderFile=MainFrm.h -ImplementationFile=MainFrm.cpp -Filter=T -BaseClass=CFrameWnd -VirtualFilter=fWC -LastObject=CMainFrame - - - -[CLS:CAboutDlg] -Type=0 -HeaderFile=TstCBot.cpp -ImplementationFile=TstCBot.cpp -Filter=D - -[DLG:IDD_ABOUTBOX] -Type=1 -Class=CAboutDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - -[MNU:IDR_MAINFRAME] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_FILE_SAVE_AS -Command5=ID_FILE_MRU_FILE1 -Command6=ID_APP_EXIT -Command7=ID_EDIT_UNDO -Command8=ID_EDIT_CUT -Command9=ID_EDIT_COPY -Command10=ID_EDIT_PASTE -Command11=ID_VIEW_STATUS_BAR -Command12=ID_CP1 -Command13=ID_EXE -Command14=ID_APP_ABOUT -CommandCount=14 - -[ACL:IDR_MAINFRAME] -Type=1 -Class=CMainFrame -Command1=ID_CP1 -Command2=ID_FILE_NEW -Command3=ID_FILE_OPEN -Command4=ID_FILE_SAVE -Command5=ID_EXE -Command6=ID_EDIT_UNDO -Command7=ID_EDIT_CUT -Command8=ID_EXE -Command9=ID_CP1 -Command10=ID_EXE -CommandCount=10 - -[MNU:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_FILE_SAVE_AS -Command5=ID_FILE_MRU_FILE1 -Command6=ID_APP_EXIT -Command7=ID_EDIT_UNDO -Command8=ID_EDIT_CUT -Command9=ID_EDIT_COPY -Command10=ID_EDIT_PASTE -Command11=ID_VIEW_STATUS_BAR -Command12=ID_CP1 -Command13=ID_EXE -Command14=ID_APP_ABOUT -CommandCount=14 - -[ACL:IDR_MAINFRAME (French (France))] -Type=1 -Class=? -Command1=ID_CP1 -Command2=ID_FILE_NEW -Command3=ID_FILE_OPEN -Command4=ID_FILE_SAVE -Command5=ID_EXE -Command6=ID_EDIT_UNDO -Command7=ID_EDIT_CUT -Command8=ID_EXE -Command9=ID_CP1 -Command10=ID_EXE -CommandCount=10 - -[DLG:IDD_ABOUTBOX (French (France))] -Type=1 -Class=CAboutDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - -[CLS:CBotErrorDlg] -Type=0 -HeaderFile=BotErrorDlg.h -ImplementationFile=BotErrorDlg.cpp -BaseClass=CDialog -Filter=D -VirtualFilter=dWC -LastObject=CBotErrorDlg - -[DLG:IDD_DIALOG1 (French (Switzerland))] -Type=1 -ControlCount=4 -Control1=IDOK,button,1342242817 -Control2=IDC_EDIT1,edit,1352728708 -Control3=IDC_STATIC,static,1342308352 -Control4=IDC_STATIC1,static,1342308352 - -[DLG:IDD_CONSOLE] -Type=1 -Class=CBotConsoleDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342308352 -Control2=IDC_EDIT2,edit,1350631552 -Control3=IDOK,button,1342242817 -Control4=IDC_EDIT1,edit,1352734724 - -[CLS:CBotConsoleDlg] -Type=0 -HeaderFile=BotConsoleDlg.h -ImplementationFile=BotConsoleDlg.cpp -BaseClass=CDialog -Filter=D -VirtualFilter=dWC -LastObject=IDOK - diff --git a/src/CBot/old TstCBot/TstCBot.cpp b/src/CBot/old TstCBot/TstCBot.cpp deleted file mode 100644 index 8ac4557..0000000 --- a/src/CBot/old TstCBot/TstCBot.cpp +++ /dev/null @@ -1,412 +0,0 @@ -// TstCBot.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "TstCBot.h" - -#include "MainFrm.h" -#include "TstCBotDoc.h" -#include "TstCBotView.h" -#include "CMyThread.h" - - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -//////////////////////////////////////////////////////////////////// -// routine show() -// utilisable depuis le programme écrit en CBot - -// exécution -BOOL rShow( CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - CString s; - - if ( pVar == NULL ) - { - Exception = 22; return FALSE; - } - - while ( pVar != NULL ) - { - CString ss; - ss.LoadString( TX_TYPENAMES + pVar->RetType() ); - s += ss + " "; - - ss = pVar->RetName(); - if (ss.IsEmpty()) ss = ""; - s += ss + " = "; - - s += pVar->RetValString(); - s += "\n"; - pVar = pVar->RetNext(); - } - - AfxMessageBox(s, MB_OK|MB_ICONINFORMATION); - -// if ( pResult && pResult->RetType() == CBotTypInt) pResult->SetValInt(123); - - return TRUE; // pas d'interruption -} - -int cShow( CBotVar* &pVar, CBotString& RetClass) -{ - if ( pVar == NULL ) return 22; - return CBotTypInt; // tous paramètres acceptés, un entier en retour -} - -int cErr( CBotVar* &pVar, CBotString& RetClass) -{ - pVar = pVar->RetNext(); // avance le pointeur sur l'erreur - return 6666; -} - -//////////////////////////////////////////////////////////////////// -// routine print() -// utilisable depuis le programme écrit en CBot - -// exécution -BOOL rPrintLn( CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - CString s; - - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - CEdit* pEdit = pApp->m_pConsole; - - if (pEdit == NULL) return TRUE; - pEdit->GetWindowText(s); - - while ( pVar != NULL ) - { - if ( !s.IsEmpty() ) s += "\r\n"; - s += pVar->RetValString(); - pVar = pVar->RetNext(); - } - - pEdit->SetWindowText(s); - pEdit->SetSel(s.GetLength(), s.GetLength()); - pEdit->SetFocus(); - return TRUE; // pas d'interruption -} - -BOOL rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - CString s; - - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - CEdit* pEdit = pApp->m_pConsole; - - if (pEdit == NULL) return TRUE; - pEdit->GetWindowText(s); - - while ( pVar != NULL ) - { - if ( !s.IsEmpty() ) s += " "; - s += pVar->RetValString(); - pVar = pVar->RetNext(); - } - - pEdit->SetWindowText(s); - pEdit->SetSel(s.GetLength(), s.GetLength()); - pEdit->SetFocus(); - return TRUE; // pas d'interruption -} - -int cPrint( CBotVar* &pVar, CBotString& RetClass) -{ - return 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 ) -{ - CString s; - - if ( pVar == NULL )return TRUE; // constructeur sans paramètres est ok - - if ( pVar->RetType() > CBotTypDouble ) - { - Exception = 6023; return FALSE; - } - - CBotVar* pX = pThis->RetItem("x"); - if ( pX == NULL ) - { - Exception = 6024; return FALSE; - } - - pX->SetValFloat( pVar->RetValFloat() ); - pVar = pVar->RetNext(); - - if ( pVar == NULL ) - { - Exception = 6022; return FALSE; - } - - if ( pVar->RetType() > CBotTypDouble ) - { - Exception = 6023; return FALSE; - } - - CBotVar* pY = pThis->RetItem("y"); - if ( pY == NULL ) - { - Exception = 6024; return FALSE; - } - - pY->SetValFloat( pVar->RetValFloat() ); - pVar = pVar->RetNext(); - - if ( pVar != NULL ) - { - Exception = 6025; return FALSE; - } - - return TRUE; // pas d'interruption -} - -int cCPoint( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass) -{ - // l'objet doit être de la classe CPoint - if ( !pThis->IsElemOfClass("CPoint") ) return 6021; - - // ok si aucun paramètres ! - if ( pVar == NULL ) return 0; - - // paramètre de type numérique svp - if ( pVar->RetType() > CBotTypDouble ) return 6023; - pVar = pVar->RetNext(); - - // il doit y avoir un second paramètre - if ( pVar == NULL ) return 6022; - // également de type numérique - if ( pVar->RetType() > CBotTypDouble )return 6023; - pVar = pVar->RetNext(); - - // et pas plus de 2 paramètres svp - if ( pVar != NULL ) return 6025; - - return 0; // cette fonction retourne void -} - -// méthode déterminant l'opposé -BOOL rOppose( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) -{ - CString s; - - if ( pVar != NULL ) // pas de paramètre - { - Exception = 6025; return FALSE; - } - - CBotVar* pvar = pThis->RetItemList(); // demande la chaîne des items - - // tous les paramètres sont des nombres - while (pvar != NULL) - { - pvar->SetValFloat( -pvar->RetValFloat() ); - pvar = pvar->RetNext(); - } - - pResult->Copy(pThis); - return TRUE; // pas d'interruption -} - -int cOppose( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass) -{ - // l'objet doit être de la classe CPoint - if ( !pThis->IsElemOfClass("CPoint") ) return 6021; - - RetClass = "CPoint"; // l'objet rendu est de cette class - - // ok si aucun paramètres ! - if ( pVar == NULL ) return CBotTypClass; // le paramètre retourné est une instance de la classe - - return TX_OVERPARAM; // ça va pas -} - - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotApp - -BEGIN_MESSAGE_MAP(CTstCBotApp, CWinApp) - //{{AFX_MSG_MAP(CTstCBotApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotApp construction - -CTstCBotApp::CTstCBotApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CTstCBotApp object - -CTstCBotApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotApp initialization - -BOOL CTstCBotApp::InitInstance() -{ - AfxEnableControlContainer(); - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - // Change the registry key under which our settings are stored. - // You should modify this string to be something appropriate - // such as the name of your company or organization. - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - - LoadStdProfileSettings(); // Load standard INI file options (including MRU) - - // Register the application's document templates. Document templates - // serve as the connection between documents, frame windows and views. - - CSingleDocTemplate* pDocTemplate; - pDocTemplate = new CSingleDocTemplate( - IDR_MAINFRAME, - RUNTIME_CLASS(CTstCBotDoc), - RUNTIME_CLASS(CMainFrame), // main SDI frame window - RUNTIME_CLASS(CTstCBotView)); - AddDocTemplate(pDocTemplate); - - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - - // Dispatch commands specified on the command line - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - - // The one and only window has been initialized, so show and update it. - m_pMainWnd->ShowWindow(SW_SHOW); - m_pMainWnd->UpdateWindow(); - - - -/////////////////////////////////// -// défini la fonction "show()" -// -------------------------------- - - CBotProgram::AddFunction("show", rShow, cShow); - CBotProgram::AddFunction("err", rShow, cErr); - CBotProgram::AddFunction("print", rPrint, cPrint); - CBotProgram::AddFunction("println", rPrintLn, cPrint); - - -/////////////////////////////////// -// définie la classe globale CPoint -// -------------------------------- - - CBotClass* m_pClassPoint; - - 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); - // ajoute la méthode Opposé - m_pClassPoint->AddFunction("Opposé", rOppose, cOppose); - - -////////////////////////////////////////////////////////////////// -// compile un bout de programme pour voir s'il est bien accessible -// depuis un autre "module" - - CBotProgram* p = new CBotProgram; - CBotStringArray Liste; - p->Compile(" public void MonProgram( ) { show (\"mon programme\") ;}", Liste ); - - // l'objet n'est pas détruit et plus référencé - // je sais c'est pas bien - - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - //{{AFX_MSG(CAboutDlg) - // No message handlers - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) - //{{AFX_MSG_MAP(CAboutDlg) - // No message handlers - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -// App command to run the dialog -void CTstCBotApp::OnAppAbout() -{ - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotApp commands diff --git a/src/CBot/old TstCBot/TstCBot.dsp b/src/CBot/old TstCBot/TstCBot.dsp deleted file mode 100644 index 35e5c0b..0000000 --- a/src/CBot/old TstCBot/TstCBot.dsp +++ /dev/null @@ -1,180 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TstCBot" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=TstCBot - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "TstCBot.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "TstCBot.mak" CFG="TstCBot - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "TstCBot - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "TstCBot - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TstCBot - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "TstCBot - Win32 Release" -# Name "TstCBot - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\BotConsoleDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\TstCBot.cpp -# End Source File -# Begin Source File - -SOURCE=.\TstCBot.rc - -!IF "$(CFG)" == "TstCBot - Win32 Release" - -!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\TstCBotDoc.cpp -# End Source File -# Begin Source File - -SOURCE=.\TstCBotView.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\BotConsoleDlg.h -# End Source File -# Begin Source File - -SOURCE=.\MainFrm.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\TstCBot.h -# End Source File -# Begin Source File - -SOURCE=.\TstCBotDoc.h -# End Source File -# Begin Source File - -SOURCE=.\TstCBotView.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\TstCBot.ico -# End Source File -# Begin Source File - -SOURCE=.\res\TstCBot.rc2 -# End Source File -# Begin Source File - -SOURCE=.\res\TstCBotDoc.ico -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/src/CBot/old TstCBot/TstCBot.h b/src/CBot/old TstCBot/TstCBot.h deleted file mode 100644 index 616db43..0000000 --- a/src/CBot/old TstCBot/TstCBot.h +++ /dev/null @@ -1,62 +0,0 @@ -// TstCBot.h : main header file for the TSTCBOT application -// - -#if !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols -#include "..\CBotDll.h" - - -class CMyThread; - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotApp: -// See TstCBot.cpp for the implementation of this class -// - -class CTstCBotApp : public CWinApp -{ -public: - CTstCBotApp(); - - CMyThread* m_pThread; - CWnd* m_pView; - CEdit* m_pConsole; - CBotStringArray m_Liste; - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTstCBotApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CTstCBotApp) - afx_msg void OnAppAbout(); - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) - -#define WM_STARTPROG WM_APP + 0 -#define WM_ENDPROG WM_APP + 1 diff --git a/src/CBot/old TstCBot/TstCBot.rc b/src/CBot/old TstCBot/TstCBot.rc deleted file mode 100644 index 9e91c76..0000000 --- a/src/CBot/old TstCBot/TstCBot.rc +++ /dev/null @@ -1,471 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// French (France) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 12, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\TstCBot.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""l.fra\\afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\TstCBot.ico" -IDR_TSTCBOTYPE ICON DISCARDABLE "res\\TstCBotDoc.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU PRELOAD DISCARDABLE -BEGIN - POPUP "&Fichier" - BEGIN - MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW - MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN - MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE - MENUITEM "En®istrer sous...", ID_FILE_SAVE_AS - MENUITEM SEPARATOR - MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED - MENUITEM SEPARATOR - MENUITEM "&Quitter", ID_APP_EXIT - END - POPUP "&Edition" - BEGIN - MENUITEM "&Annuler\tCtrl+Z", ID_EDIT_UNDO - MENUITEM SEPARATOR - MENUITEM "&Couper\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY - MENUITEM "C&oller\tCtrl+V", ID_EDIT_PASTE - END - POPUP "&Affichage" - BEGIN - MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR - END - POPUP "&Tests" - BEGIN - MENUITEM "&Compile\tAlt+C", ID_CP1 - MENUITEM "&Execute\tAlt+V", ID_EXE - END - POPUP "&?" - BEGIN - MENUITEM "&A propos de TstCBot...", ID_APP_ABOUT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE -BEGIN - "C", ID_CP1, VIRTKEY, ALT, NOINVERT - "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT - "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT - "V", ID_EXE, VIRTKEY, ALT, NOINVERT - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT - VK_F5, ID_EXE, VIRTKEY, NOINVERT - VK_F7, ID_CP1, VIRTKEY, NOINVERT - "X", ID_EXE, VIRTKEY, ALT, NOINVERT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "A propos de TstCBot" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 - LTEXT "TstCBot version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX - LTEXT "Copyright (C) 1900",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040C04B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "Application MFC TstCBot\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "TstCBot\0" - VALUE "LegalCopyright", "Copyright (C) 1900\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "TstCBot.EXE\0" - VALUE "ProductName", "Application TstCBot\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Traduction", 0x40c, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 210 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDR_MAINFRAME "TstCBot\n\nTstCBo\n\n\nTstCBot.Document\nTstCBo Document" -END - -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - AFX_IDS_APP_TITLE "TstCBot" - AFX_IDS_IDLEMESSAGE "Prêt" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "MAJ" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "DEF" - ID_INDICATOR_OVR "ECR" - ID_INDICATOR_REC "ENR" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_NEW "Crée un nouveau document\nNouveau" - ID_FILE_OPEN "Ouvre un document existant\nOuvrir" - ID_FILE_CLOSE "Ferme le document actif\nFermer" - ID_FILE_SAVE "Enregistre le document actif\nEnregistrer" - ID_FILE_SAVE_AS "Enregistre le document actif sous un nouveau nom\nEnregistrer sous" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_APP_ABOUT "Affiche des informations sur le programme, le numéro de version et le copyright\nA propos de" - ID_APP_EXIT "Ferme l'application ; propose d'enregistrer les documents\nQuitter" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FILE_MRU_FILE1 "Ouvre ce document" - ID_FILE_MRU_FILE2 "Ouvre ce document" - ID_FILE_MRU_FILE3 "Ouvre ce document" - ID_FILE_MRU_FILE4 "Ouvre ce document" - ID_FILE_MRU_FILE5 "Ouvre ce document" - ID_FILE_MRU_FILE6 "Ouvre ce document" - ID_FILE_MRU_FILE7 "Ouvre ce document" - ID_FILE_MRU_FILE8 "Ouvre ce document" - ID_FILE_MRU_FILE9 "Ouvre ce document" - ID_FILE_MRU_FILE10 "Ouvre ce document" - ID_FILE_MRU_FILE11 "Ouvre ce document" - ID_FILE_MRU_FILE12 "Ouvre ce document" - ID_FILE_MRU_FILE13 "Ouvre ce document" - ID_FILE_MRU_FILE14 "Ouvre ce document" - ID_FILE_MRU_FILE15 "Ouvre ce document" - ID_FILE_MRU_FILE16 "Ouvre ce document" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_NEXT_PANE "Passe au volet de fenêtre suivant\nVolet suivant" - ID_PREV_PANE "Revient au volet précédent\nVolet précédent" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_WINDOW_SPLIT "Fractionne la fenêtre active en deux volets\nFractionner" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_EDIT_CLEAR "Efface la sélection\nEffacer" - ID_EDIT_CLEAR_ALL "Efface tout\nEffacer tout" - ID_EDIT_COPY "Copie la sélection et la place dans le Presse-papiers\nCopier" - ID_EDIT_CUT "Supprime la sélection et la place dans le Presse-papiers\nCopier" - ID_EDIT_FIND "Recherche le texte spécifié\nRechercher" - ID_EDIT_PASTE "Insère le contenu du Presse-papiers\nColler" - ID_EDIT_REPEAT "Répète la dernière action\nRépéter" - ID_EDIT_REPLACE "Remplace le texte spécifique par un texte différent\nRemplacer" - ID_EDIT_SELECT_ALL "Sélectionne le document entier\nSélectionner tout" - ID_EDIT_UNDO "Annule la dernière action\nAnnuler" - ID_EDIT_REDO "Rétablit l'action précédemment annulée\nRétablir" -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_VIEW_STATUS_BAR "Affiche ou masque la barre d'état\nBarre d'état" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCSIZE "Change la taille de la fenêtre" - AFX_IDS_SCMOVE "Change la position de la fenêtre" - AFX_IDS_SCMINIMIZE "Réduit la fenêtre en icône" - AFX_IDS_SCMAXIMIZE "Agrandit la fenêtre au format de l'écran" - AFX_IDS_SCNEXTWINDOW "Passe à la fenêtre de document suivante" - AFX_IDS_SCPREVWINDOW "Passe à la fenêtre de document précédente" - AFX_IDS_SCCLOSE "Ferme la fenêtre active et propose l'enregistrement des documents" -END - -STRINGTABLE DISCARDABLE -BEGIN - AFX_IDS_SCRESTORE "Restaure la fenêtre à sa taille d'origine" - AFX_IDS_SCTASKLIST "Active la liste des tâches" -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_TYPENAMES "les différents types" - 1001 "Byte" - 1002 "Short" - 1003 "Char" - 1004 "Int" - 1005 "Long" - 1006 "Real" - 1007 "Double" -END - -STRINGTABLE DISCARDABLE -BEGIN - 1008 "Boolean" - 1009 "Class" - 1010 "String" -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_OPENPAR "Il manque une parenthèse ouvrante." - TX_CLOSEPAR "Il manque une parenthèse fermante." - TX_NOTBOOL "L'expression doit être un boolean." - TX_UNDEFVAR "Variable non déclarée." - TX_BADLEFT "Assignation impossible." - TX_ENDOF "Instruction non terminée." - TX_OUTCASE "Instruction ""case"" hors d'un bloc ""switch""." - TX_NOTERM "Instructions après la fin." -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_CLOSEBLK "Il manque la fin du bloc." - TX_ELSEWITHOUTIF "Instruction ""else"" sans ""if"" correspondant." - TX_OPENBLK "Début d'un bloc attendu." - TX_BADTYPE "Mauvais type de résultat pour l'assignation." - TX_REDEFVAR "Redéfinition d'une variable." - TX_BAD2TYPE "Les deux opérandes ne sont pas de types compatibles." - TX_UNDEFCALL "Routine inconnue." - TX_MISDOTS "Séparateur "" : "" attendu." - TX_WHILE "Manque le mot ""while""." - TX_BREAK "Instruction ""break"" en dehors d'une boucle." - TX_LABEL "Un label ne peut se placer que devant un ""for"", un ""while"", un ""do"" ou un ""switch""." - TX_NOLABEL "Cette étiquette n'existe pas" - TX_NOCASE "Manque une instruction ""case""." - TX_BADNUM "Un nombre est attendu." - TX_VOID "Paramètre void." - TX_NOTYP "Déclaration de type attendu" -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_DIVZERO "Division par zéro." - TX_NOTINIT "Variable non initialisée." - TX_BADTHROW "Valeur négative refusée pour ""throw""." - TX_NORETVAL "La fonction n'a pas retourné de résultat" - TX_NORUN "Pas de fonction en exécution" - TX_NOCALL "Appel d'une fonction inexistante" -END - -STRINGTABLE DISCARDABLE -BEGIN - TX_NOVAR "Nom d'une variable attendu" - TX_NOFONC "Nom de la fonction attendu." - TX_OVERPARAM "Trop de paramètres" - TX_REDEF "Cette fonction existe déjà." - TX_LOWPARAM "Pas assez de paramètres" - TX_BADPARAM "Aucune fonction de ce nom n'accepte ce(s) type(s) de paramètre(s)" - TX_NUMPARAM "Aucune fonction de ce nom n'accepte ce nombre de paramètres" - TX_NOITEM "Cet élément n'exite pas dans cette classe." - TX_DOT "L'objet n'est pas une instance d'une classe." - TX_NOCONST "Il n'y a pas de constructeur approprié." - TX_REDEFCLASS "Cette classe existe déjà." -END - -#endif // French (France) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// French (Switzerland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRS) -#ifdef _WIN32 -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONSOLE DIALOG DISCARDABLE 0, 0, 401, 210 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "CBot Console" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Commande :",IDC_STATIC,7,177,40,8 - EDITTEXT IDC_EDIT2,7,189,329,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "Exécute",IDOK,344,189,50,14 - EDITTEXT IDC_EDIT1,7,7,387,167,ES_MULTILINE | ES_READONLY | - ES_WANTRETURN | WS_VSCROLL -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_CONSOLE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 394 - TOPMARGIN, 7 - BOTTOMMARGIN, 203 - END -END -#endif // APSTUDIO_INVOKED - -#endif // French (Switzerland) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -LANGUAGE 12, 1 -#pragma code_page(1252) -#endif -#include "res\TstCBot.rc2" // non-Microsoft Visual C++ edited resources -#include "l.fra\afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/CBot/old TstCBot/TstCBotDoc.cpp b/src/CBot/old TstCBot/TstCBotDoc.cpp deleted file mode 100644 index 7d7e2ef..0000000 --- a/src/CBot/old TstCBot/TstCBotDoc.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// TstCBotDoc.cpp : implementation of the CTstCBotDoc class -// - -#include "stdafx.h" -#include "TstCBot.h" - -#include "TstCBotDoc.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotDoc - -IMPLEMENT_DYNCREATE(CTstCBotDoc, CDocument) - -BEGIN_MESSAGE_MAP(CTstCBotDoc, CDocument) - //{{AFX_MSG_MAP(CTstCBotDoc) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotDoc construction/destruction - -CTstCBotDoc::CTstCBotDoc() -{ - // TODO: add one-time construction code here - -} - -CTstCBotDoc::~CTstCBotDoc() -{ -} - -BOOL CTstCBotDoc::OnNewDocument() -{ - if (!CDocument::OnNewDocument()) - return FALSE; - - // TODO: add reinitialization code here - // (SDI documents will reuse this document) - - return TRUE; -} - - - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotDoc serialization - -void CTstCBotDoc::Serialize(CArchive& ar) -{ - if (ar.IsStoring()) - { - // TODO: add storing code here - } - else - { - // TODO: add loading code here - } -} - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotDoc diagnostics - -#ifdef _DEBUG -void CTstCBotDoc::AssertValid() const -{ - CDocument::AssertValid(); -} - -void CTstCBotDoc::Dump(CDumpContext& dc) const -{ - CDocument::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotDoc commands - diff --git a/src/CBot/old TstCBot/TstCBotDoc.h b/src/CBot/old TstCBot/TstCBotDoc.h deleted file mode 100644 index ae1d0f7..0000000 --- a/src/CBot/old TstCBot/TstCBotDoc.h +++ /dev/null @@ -1,55 +0,0 @@ -// TstCBotDoc.h : interface of the CTstCBotDoc class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - -class CTstCBotDoc : public CDocument -{ -protected: // create from serialization only - CTstCBotDoc(); - DECLARE_DYNCREATE(CTstCBotDoc) - -// Attributes -public: - -// Operations -public: - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTstCBotDoc) - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CTstCBotDoc(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CTstCBotDoc) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/old TstCBot/TstCBotView.cpp b/src/CBot/old TstCBot/TstCBotView.cpp deleted file mode 100644 index 3ee9094..0000000 --- a/src/CBot/old TstCBot/TstCBotView.cpp +++ /dev/null @@ -1,291 +0,0 @@ -// TstCBotView.cpp : implementation of the CTstCBotView class -// - -#include "stdafx.h" -#include "TstCBot.h" - -#include "TstCBotDoc.h" -#include "TstCBotView.h" -#include "BotConsoleDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotView - -IMPLEMENT_DYNCREATE(CTstCBotView, CView) - -BEGIN_MESSAGE_MAP(CTstCBotView, CView) - //{{AFX_MSG_MAP(CTstCBotView) - ON_WM_SIZE() - ON_COMMAND(ID_CP1, OnCp1) - ON_COMMAND(ID_EXE, OnExe) - ON_COMMAND(ID_FILE_SAVE, OnFileSave) - ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotView construction/destruction - -CTstCBotView::CTstCBotView() -{ - // TODO: add construction code here - m_pEdit = NULL; - m_pProg = NULL; -} - -CTstCBotView::~CTstCBotView() -{ -} - -BOOL CTstCBotView::PreCreateWindow(CREATESTRUCT& cs) -{ - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return CView::PreCreateWindow(cs); -} - -void CTstCBotView::OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView ) -{ - if ( m_pEdit == NULL) - { - m_pEdit = new CEdit(); - CRect rect; - GetClientRect( rect ); - - m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL, - rect, this, IDC_EDIT1 ); - m_pEdit->SetTabStops(12); - LoadEdition("CBotTest.txt"); - m_pEdit->SetFocus(); - } -} - - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotView drawing - -void CTstCBotView::OnDraw(CDC* pDC) -{ - CTstCBotDoc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); - - // TODO: add draw code for native data here -} - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotView diagnostics - -#ifdef _DEBUG -void CTstCBotView::AssertValid() const -{ - CView::AssertValid(); -} - -void CTstCBotView::Dump(CDumpContext& dc) const -{ - CView::Dump(dc); -} - -CTstCBotDoc* CTstCBotView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTstCBotDoc))); - return (CTstCBotDoc*)m_pDocument; -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CTstCBotView message handlers - -void CTstCBotView::OnSize(UINT nType, int cx, int cy) -{ - CView::OnSize(nType, cx, cy); - - if ( m_pEdit != NULL ) - { - CRect rect; - GetClientRect( rect ); - m_pEdit->MoveWindow( rect ); - m_pEdit->SetFocus(); - } -} - -void CTstCBotView::SaveEdition(const char* filename) -{ - CString program; - - m_pEdit->GetWindowText(program); - - FILE* pf = fopen(filename, "wb"); - if (pf==NULL) return; - - fputs (program, pf); - fclose(pf); -} - -void CTstCBotView::LoadEdition(const char* filename) -{ - CString program("{ int x = 10000; while (x > 0) x = x-1; }"); - - FILE* pf = fopen(filename, "r"); - if (pf!=NULL) - { - char buffer[10000]; - program.Empty(); - - while (NULL != fgets (buffer, 100000, pf)) - { - program += buffer; - program = program.Left(program.GetLength()-1) + "\r\n"; - } - - fclose(pf); - } - - m_pEdit->SetWindowText(program); -} - - - -// compile le programme -#include - -void CTstCBotView::OnCp1() -{ - CString program; - - SaveEdition("CBotTest.txt"); - - m_pEdit->GetWindowText(program); - - CString TextError; - int code, start, end; - - if ( m_pProg == NULL ) m_pProg = new CBotProgram(); - - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - - if (m_pProg->Compile(program, pApp->m_Liste)) - { - CString done = "Compilation sans erreur.\nLes fonctions suivantes sont externes:\n"; - - for ( int i = 0; i < pApp->m_Liste.RetSize(); i++) - { - done += CString(pApp->m_Liste[i]) + "\n"; - } - - AfxMessageBox( done ); - } - else - { - m_pProg->GetError(code, start, end); - delete m_pProg; - m_pProg = NULL; - - m_pEdit->SetSel( start, end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError.LoadString( code ); - if (TextError.IsEmpty()) - { - char buf[100]; - sprintf(buf, "Erreur numéro %d.", code); - TextError = buf; - } - AfxMessageBox( TextError ); - } - - m_pEdit->SetFocus(); -} - - -////////////////////////////////////////////////////// - - -void CTstCBotView::OnExe() -{ - CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); - - if( m_pProg == NULL) - { - AfxMessageBox("Pas de programme compilé !"); - return; - } - - if( pApp->m_Liste.RetSize() == 0 ) - { - AfxMessageBox("Aucune fonction marquée \"extern\" !"); - return; - } - - - - CBotConsoleDlg dlg; - dlg.DoModal(); // dialogue pour faire la console - - if ( dlg.m_code>0 ) - { - CString TextError; - - m_pEdit->SetSel( dlg.m_start, dlg.m_end ); - m_pEdit->SetFocus(); // met en évidence la partie avec problème - - TextError.LoadString( dlg.m_code ); - if (TextError.IsEmpty()) - { - char buf[100]; - sprintf(buf, "Erreur numéro %d.", dlg.m_code); - TextError = buf; - } -// AfxMessageBox( TextError ); - } - - m_pEdit->SetFocus(); - - return; -} - - - -void CTstCBotView::OnFileSave() -{ - // TODO: Add your command handler code here - SaveEdition("CBotTest.txt"); -} - -void CTstCBotView::OnFileSaveAs() -{ - CFileDialog *pDlg; - CString s; - - pDlg = new CFileDialog(FALSE, "TXT", NULL, - OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY, - "cboxtest|*.txt", this); - if ( pDlg == NULL ) return; - - if ( pDlg->DoModal() == IDOK ) // choix du fichier ... - { - SaveEdition(pDlg->GetPathName()); - } - - delete pDlg; -} - -#if 0 -void test() -{ - int y,z; - - for (;;); - for (x = 0; y = 1; z = 3) int q = 6; - for (int x = 0; int y = 1; int z = 3) int q = 6; - // pour voir -} -#endif - diff --git a/src/CBot/old TstCBot/TstCBotView.h b/src/CBot/old TstCBot/TstCBotView.h deleted file mode 100644 index d5aede5..0000000 --- a/src/CBot/old TstCBot/TstCBotView.h +++ /dev/null @@ -1,81 +0,0 @@ -// TstCBotView.h : interface of the CTstCBotView class -// -///////////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) -#define AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - - -class CBotProgram; -class CBotClass; - - -class CTstCBotView : public CView -{ -protected: // create from serialization only - CTstCBotView(); - DECLARE_DYNCREATE(CTstCBotView) - - CEdit* m_pEdit; // texte en édition - CWnd* m_pWnd; - CBotProgram* m_pProg; // programme compilé - -// Attributes -public: - CTstCBotDoc* GetDocument(); - -// Operations -public: - void LoadEdition(const char* name); - void SaveEdition(const char* name); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CTstCBotView) - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual void OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView ); - protected: - //}}AFX_VIRTUAL - -// Implementation -public: - virtual ~CTstCBotView(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: - -// Generated message map functions -protected: - //{{AFX_MSG(CTstCBotView) - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnCp1(); - afx_msg void OnExe(); - afx_msg void OnFileSave(); - afx_msg void OnFileSaveAs(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -#ifndef _DEBUG // debug version in TstCBotView.cpp -inline CTstCBotDoc* CTstCBotView::GetDocument() - { return (CTstCBotDoc*)m_pDocument; } -#endif - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) - - - diff --git a/src/CBot/old TstCBot/res/TstCBot.ico b/src/CBot/old TstCBot/res/TstCBot.ico deleted file mode 100644 index 7eef0bc..0000000 Binary files a/src/CBot/old TstCBot/res/TstCBot.ico and /dev/null differ diff --git a/src/CBot/old TstCBot/res/TstCBot.rc2 b/src/CBot/old TstCBot/res/TstCBot.rc2 deleted file mode 100644 index 2186272..0000000 --- a/src/CBot/old TstCBot/res/TstCBot.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// TSTCBOT.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/old TstCBot/res/TstCBotDoc.ico b/src/CBot/old TstCBot/res/TstCBotDoc.ico deleted file mode 100644 index 2a1f1ae..0000000 Binary files a/src/CBot/old TstCBot/res/TstCBotDoc.ico and /dev/null differ diff --git a/src/CBot/old TstCBot/test complet 1.txt b/src/CBot/old TstCBot/test complet 1.txt deleted file mode 100644 index 0fd4fa5..0000000 --- a/src/CBot/old TstCBot/test complet 1.txt +++ /dev/null @@ -1,213 +0,0 @@ -// test de l'interpréteur CBot, (c) D. Dumoulin 2000 - -Int Somme ( Int x, Int y ) -{ - return x + y; -} - -Real Somme ( Real x, Real y ) -{ - return x + y; -} - -void A_Faire() -{ - CPoint position; // utilise une classe externe - position.x = 123.5; - position.y = -45.1; - - show ( position ); -} - -/* Les nouveautés sont les suivantes - __________________________________________________ - - On peut définir des fonctions, avec la syntaxe habituelle au C - void MaFonction( Int x, Real y ) { ... } - - Les caractéristiques sont pour l'instant les suivantes: - - - ce programme TstCBot exécute la dernière fonction définie - - - on peut définir deux fonctions du même nom, - si la liste de paramètres est différente. - Par exemple - Int Somme( Int x, Int y ) - Real Somme( Real x, Real y ); - Note: si la seconde n'existait pas, Somme ( 1.3, 4.8 ) - serait fait sur les nombres entier 1 + 4 - La priorité est donnée à la routine qui ne pert pas - de bits dans la conversion des paramètres. - - - il n'y a pas d'erreur de compilation si une routine - ne retourne pas de valeur alors qu'elle devrait, - par contre il y a une erreur "correcte" à l'exécution - - - il est possible d'utiliser une fonction qui est définie - plus bas dans le programme. - __________________________________________________ - - Tous les blocs d'instructions existent maintenant, à savoir - - label : - while (condition) { instructions; break label; continue label; } - - label : - do { instructions; break label; continue label; } while (condition) - - label: - for (initial; condition; incrément) { instructions; break; continue } - - switch ( valeur ) { case 1: instructions; case 2: break ; } - - try {instructions; throw exception; } catch (exception) {instructions;} - catch (testlogique) {instructions;} - finally {instructions;} - // le bloc finally est exécuter dans tous les cas - // qu'il y ait eu exception ou non, et aussi en cas de break, continue ou return - __________________________________________________ - - Les "exceptions" sont juste des numéros (31 bits) - 6000 = division par zéro - 6001 = variable non initialisée - 6002 = valeur négative pour un throw - 6003 = la fonction n'a pas retourné de valeur - - les autres numéros sont à disposition - (COLOBOT aura surement des numéros d'exception propre) - l'association d'un mot clef pour ces exceptions est à venir. - __________________________________________________ - - L'interpréteur a été un peu optimiser, une boucle de un millon de décrément - ne prend plus que -*/ - -void Test () -{ // début du bloc d'instructions - - Int z = 1000000; - while ( z>0 ) z--; - - return; - { - // test la préséance pour les assignations - Int a = 9; - a += (a = 3); - if ( a != 12 ) 1/0; // le résultat correct est 12 - - Int b = 9; - b = b + (b = 3); - if (b != 12) 1/0; // même chose - - // la fonction show est une fonction externe - // définie par TstCBot - // elle peut prendre un nombre quelconque de paramètres - show ( a, b ); - } - - { - // petit test sur les chaînes - String x = "ch." ; - String y ; - x += y = x + " de la brume."; - - // concaténation de chaînes, accepte des autres types - String s = 1 + 2 + " test " + 3 + 4 ; - - show( x, y, s ); - - // les tests sur les chaînes ne sont pas standard en Java - // mais c'est si pratique : - - if ( s != "3 test 34" ) 1/0; // le résultat correct est "3 test 34" - // car 1+2 est évalué en premier entre 2 nombres - // et ensuite on additionne des chaînes "3" "4" - } - - { - // teste toutes les opérations avec les entiers (32 bits) - Int a = 4; - Int b = 4; - - Int c = a++ * --b; // post incrément, pré décrément - if ( c != 12 ) 1/0; - - c = ++a * b--; // pré incrément, post décrément - if ( c!=18 ) 1/0; - - a = a+b-a*b/a%3; // 6 + 2 - ( 6 * 2 / 6 % 3 ) -> 6 - if ( a != 6 ) 1/0; - - a += 2; a-=1; a*=3; a/=4; a%=3; // (6+2 -1) *3 /4 modulo 3 = 21 / 4 modulo 3 = 2 - if ( a!= 2) 0/0; - - if (-5 << 3 != -40) 0/0; // shift à gauche - if ( -5 >> 1 != -3) 0/0; // shift arithmétique à droite 11111011 -> 11111101 = -3 - if ( -5 >>> 1 != 0x3ffffffd) 0/0; // shift non signé à droite - - a = -10; // fait la même chose en assignation - a <<= 1; // -20 - a >>= 2; // -5 - a >>>= 1; // pert le signe - if ( a != 0x3ffffffd) 0/0; // - - Int x = 5/3; // division d'entiers - if ( x != 1 ) 0/0; - Int xx = 5.0/3.0; // division de réels, assigné à un entier - if ( xx != 1 ) 0/0; - - Int y = 0xF0035678; - if ( ~y != 0x0FFCA987 ) 0/0; // NOT bit à bit - if ( (0x3456 ^ 0x54f0) != 0x60A6) // XOR bit à bit - 0/0; - if ( (0x23 | 0x83) != 0xA3 ) 0/0; // OR bit à bit - if ( (0x23 & 0x83) != 0x03 ) 0/0; // AND bit à bit - - Int z = 0x0123; - z |= 0x8010; if ( z != 0x8133) 0/0; - z &= 0xF018; if ( z != 0x8010) 0/0; - z ^= 0xFF17; if ( z != 0x7F07) 0/0; - } - - { - // test pour les booléens - Boolean a, b= true, c = false; - a = b | c & b; - if ( a != b ) 0/0; - if ( !a ) 0/0; - if ( b ^ a ) 0/0; // XOR - if ( true || 0/0<1 ) {}; - if ( false && 0/0<1) {}; - // a ? "vrai" : "faux"; - } - - { - // petit test sur les nombres réels - Real x = 1. / 3, y = 0; - - if ( 3 * x != 1 ) x = x / y; // provoque une division par zéro - else y = 1.123; - } - - - // test de durée - // attention, le programme de test ne stoppe qu'à la fin d'exécution - // bien que la boucle est interrompue plusieures fois - - // la boucle est plus rapide si elle est au début du programme ! - { - Int z = 10000; - while ( z > 0 ) z = z - 1; - } - -} - -void t() -{ - A_Faire(); - - show ( Somme ( 1, 2 ) ); - show ( Somme ( 1., 2 ) ); - show ( Somme ( 4.5, 2.7 ) ); -} - diff --git a/src/CBot/old TstCBot/x.txt b/src/CBot/old TstCBot/x.txt deleted file mode 100644 index 95856e0..0000000 --- a/src/CBot/old TstCBot/x.txt +++ /dev/null @@ -1,43 +0,0 @@ -// test de l'interpréteur CBot, (c) D. Dumoulin 2000 - -// pour l'instant, seule les primitives suivantes sont implémentées - -// { ... ; ... ; ... } un bloc d'instructions -// int x, y = 12, z; // déclaration de nombre entier -// float a, b= 2/3, c=b+1; // déclaration de nombres réels -// boolean tst = true; // déclaration d'un booléen -// String x = "hello"; // déclaration d'une chaînes - -// z = x = x * y / ( z + 1 - x ); // assignation en chaîne et les 4 opérations - -// while ( x >= 0 ) x = x - 1; // boucle while, et test > >= < <= == != -// if ( x < y ) x = x + 1; // test si -// else y = y + 1; // sinon - -/* et les opérations suivantes: - + plus unaire x = +y; - - moins unaire x = -y; - - || OU logique - && ET logique - ! NOT logique - | OU bit à bit - & ET bit à bit - ^ XOR bit à bit - ~ NON bit à bit - -// les commentaires sont acceptés -/* y compris les commentaires - sur plusieures lignes */ - - -{ -String str ; - -str = "abc" ; - -show (str) ; - -show( str = str + "+++" , ) ; - -} diff --git a/src/CBot/resource.h b/src/CBot/resource.h index 6bf48e1..da1ad23 100644 --- a/src/CBot/resource.h +++ b/src/CBot/resource.h @@ -12,7 +12,9 @@ // * 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://www.gnu.org/licenses/.//{{NO_DEPENDENCIES}} +// * along with this program. If not, see http://www.gnu.org/licenses/. + +#pragma once #ifndef _RESOURCE_H_ #define _RESOURCE_H_ @@ -173,4 +175,3 @@ enum EID #define TX_ERRWRITE 6015 #endif //_RESOURCE_H_ - diff --git a/src/CBot/tests/TestCBot/CBotConsoleDlg.cpp b/src/CBot/tests/TestCBot/CBotConsoleDlg.cpp new file mode 100644 index 0000000..55a271a --- /dev/null +++ b/src/CBot/tests/TestCBot/CBotConsoleDlg.cpp @@ -0,0 +1,221 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// CBotConsoleDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "TestCBot.h" +#include "CBotConsoleDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg dialog + + +CBotConsoleDlg::CBotConsoleDlg(CWnd* pParent /*=NULL*/) + : CDialog(CBotConsoleDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CBotConsoleDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + m_pProg = NULL; + m_threadinfo.m_bRun = FALSE; + m_code = 0; +} + + +void CBotConsoleDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CBotConsoleDlg) + DDX_Control(pDX, IDOK, m_cOK); + DDX_Control(pDX, IDC_EDIT2, m_Edit2); + DDX_Control(pDX, IDC_EDIT1, m_Edit1); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CBotConsoleDlg, CDialog) + //{{AFX_MSG_MAP(CBotConsoleDlg) + ON_MESSAGE(WM_ENDPROG, EndProg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg message handlers + +UINT ThreadProc(ThreadInfo *info) +{ + CTime t0 = CTime::GetCurrentTime(); + 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->GivStackVars(FN, level--); + if ( FN != FunctionName ) break; + if ( t != NULL ) + { + CString s ; + while ( t != NULL ) + { + if (s.IsEmpty()) s+= "Stack -> "; + else s+= " , "; + s += t->GivValString(); + t = t->GivNext(); + } + AfxMessageBox(s); + } + } while (TRUE); + } +#endif + Cpt++; + if ( Cpt%50 == 0 ) info->m_pEdit1->ReplaceSel("."); + } + + if ( info->m_bStop ) + { + info->m_pEdit1->ReplaceSel("\r\nInterrompu\r\n"); + } + else if (info->m_pProg->GivError() == 0) + { + CTime t = CTime::GetCurrentTime(); + CTimeSpan ts = t - t0; + + char buffer[200]; + sprintf( buffer, "\r\nExécution terminée en %d secondes.\r\nInterrompue %d fois.\r\n", + ts.GetTotalSeconds(), Cpt); + + info->m_pEdit1->ReplaceSel(buffer); + } + + info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; + return 0 ; +} + +LONG CBotConsoleDlg::EndProg(UINT wparam, LONG lparam) +{ + m_threadinfo.m_bRun = FALSE; + + if (m_pProg->GetError(m_code, m_start, m_end)) + { + CBotString TextError; + TextError = CBotProgram::GivErrorText(m_code); + AfxMessageBox(TextError); + CDialog::OnCancel(); + return 1; + } + delete m_pProg; + m_pProg = NULL; + + m_Edit2.EnableWindow(TRUE); + m_cOK.EnableWindow(TRUE); + + m_Edit2.SetWindowText(""); + m_Edit2.SetFocus(); + return 0 ; +} + +void CBotConsoleDlg::OnOK() +{ + CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); + pApp->m_pConsole = &m_Edit1; + m_code = 0; + + CString Commande; + m_Edit2.GetWindowText(Commande); + + CString s = "void LaCommande() { " + Commande + " ;}"; + m_pProg = new CBotProgram(); + CBotStringArray liste; + m_pProg->Compile(s, liste); + + int err, start, end; + if ( m_pProg->GetError(err, start, end) ) + { + CBotString TextError; + TextError = CBotProgram::GivErrorText(err); + AfxMessageBox(TextError); + m_Edit2.SetSel(start-20, end-20); + return; + } + + m_Edit1.ReplaceSel("\r\n" + Commande + " ->\r\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; + + AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; +} + +void CBotConsoleDlg::OnCancel() +{ + if (!m_threadinfo.m_bRun) CDialog::OnCancel(); + m_threadinfo.m_bStop = TRUE ; +} + + +BOOL CBotConsoleDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n"); + for ( int i = 0; i < m_pListe->GivSize(); i++ ) + { + CBotString x = (*m_pListe)[i] + CBotString("\r\n"); + m_Edit1.ReplaceSel(x); + } + m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n"); + + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/CBot/tests/TestCBot/CBotConsoleDlg.h b/src/CBot/tests/TestCBot/CBotConsoleDlg.h new file mode 100644 index 0000000..f289a4d --- /dev/null +++ b/src/CBot/tests/TestCBot/CBotConsoleDlg.h @@ -0,0 +1,85 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) +#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// CBotConsoleDlg.h : header file +// + +struct ThreadInfo +{ + CEdit* m_pEdit1 ; + CEdit* m_pEditx ; + CBotProgram* m_pProg; + CWnd* m_pWndMessage; + BOOL m_bStop; + BOOL m_bRun; +}; + + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg dialog + +class CBotConsoleDlg : public CDialog +{ +// Construction +public: + CBotConsoleDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CBotConsoleDlg) + enum { IDD = IDD_CONSOLE }; + CButton m_cOK; + CEdit m_Edit2; + CEdit m_Edit1; + //}}AFX_DATA + + CBotProgram* m_pProg; + ThreadInfo m_threadinfo; + + CBotStringArray* + m_pListe; + int m_code, m_start, m_end; + CEdit* m_pEditx; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBotConsoleDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CBotConsoleDlg) + virtual void OnOK(); + virtual void OnCancel(); + virtual BOOL OnInitDialog(); + afx_msg LONG EndProg(UINT wparam, LONG lparam) ; + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/ChildFrm.cpp b/src/CBot/tests/TestCBot/ChildFrm.cpp new file mode 100644 index 0000000..4c40f90 --- /dev/null +++ b/src/CBot/tests/TestCBot/ChildFrm.cpp @@ -0,0 +1,74 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// ChildFrm.cpp : implementation of the CChildFrame class +// + +#include "stdafx.h" +#include "TestCBot.h" + +#include "ChildFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame + +IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) + //{{AFX_MSG_MAP(CChildFrame) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame construction/destruction + +CChildFrame::CChildFrame() +{ +} + +CChildFrame::~CChildFrame() +{ +} + +BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + return CMDIChildWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame diagnostics + +#ifdef _DEBUG +void CChildFrame::AssertValid() const +{ + CMDIChildWnd::AssertValid(); +} + +void CChildFrame::Dump(CDumpContext& dc) const +{ + CMDIChildWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CChildFrame message handlers diff --git a/src/CBot/tests/TestCBot/ChildFrm.h b/src/CBot/tests/TestCBot/ChildFrm.h new file mode 100644 index 0000000..2ad57b6 --- /dev/null +++ b/src/CBot/tests/TestCBot/ChildFrm.h @@ -0,0 +1,66 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// ChildFrm.h : interface of the CChildFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(CChildFrame) +public: + CChildFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CChildFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CChildFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +// Generated message map functions +protected: + //{{AFX_MSG(CChildFrame) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CHILDFRM_H__4D1BB909_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/MainFrm.cpp b/src/CBot/tests/TestCBot/MainFrm.cpp new file mode 100644 index 0000000..6669350 --- /dev/null +++ b/src/CBot/tests/TestCBot/MainFrm.cpp @@ -0,0 +1,116 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "TestCBot.h" + +#include "MainFrm.h" +#include "TestCBotDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.Create(this) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | + CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + return CMDIFrameWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CMDIFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CMDIFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + + diff --git a/src/CBot/tests/TestCBot/MainFrm.h b/src/CBot/tests/TestCBot/MainFrm.h new file mode 100644 index 0000000..a1d34f4 --- /dev/null +++ b/src/CBot/tests/TestCBot/MainFrm.h @@ -0,0 +1,72 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CMainFrame : public CMDIFrameWnd +{ + DECLARE_DYNAMIC(CMainFrame) +public: + CMainFrame(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__4D1BB907_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/PerformDlg.cpp b/src/CBot/tests/TestCBot/PerformDlg.cpp new file mode 100644 index 0000000..8abbb4b --- /dev/null +++ b/src/CBot/tests/TestCBot/PerformDlg.cpp @@ -0,0 +1,177 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// PerformDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "testcbot.h" +#include "PerformDlg.h" + +//#include +#include +//#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPerformDlg dialog + + +CPerformDlg::CPerformDlg(CWnd* pParent /*=NULL*/) + : CDialog(CPerformDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CPerformDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void CPerformDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPerformDlg) + DDX_Control(pDX, IDC_EDIT3, m_Edit3); + DDX_Control(pDX, IDC_EDIT1, m_Edit1); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPerformDlg, CDialog) + //{{AFX_MSG_MAP(CPerformDlg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPerformDlg message handlers + +/* Pauses for a specified number of milliseconds. */ + +/*void sleep( double waitseconds ) +{ + clock_t wait = (clock_t)(waitseconds * CLOCKS_PER_SEC); + clock_t goal; + goal = wait + clock(); + while( goal > clock() ) + ; +}*/ + +void sleep( clock_t wait ) +{ + clock_t goal; + goal = wait + clock(); + while( goal > clock() ) + TRACE("%d \n", clock() ); +} + +void sleep2( clock_t wait ) +{ + struct _timeb timebuffer; + char *timeline; + + _ftime( &timebuffer ); + timeline = ctime( & ( timebuffer.time ) ); + long x = timebuffer.millitm; + while( x == timebuffer.millitm ) _ftime( &timebuffer ); +} + +#define NBLP 20 + +UINT ThreadProc2(ThreadInfo2 *info) +{ + int lp = NBLP; + int i; + clock_t start = clock(); + + while ( !info->m_bStop ) + { + for ( i = 0; i< info->m_nbscripts; i++ ) + { + info->m_pProg[i]->Run(); + } + +#ifdef _DEBUG + sleep2( 1 ); +#else + CString s ( "xx" ); + for ( long z = 0x5000; z>0; z-- ) s = s.Left(1); +#endif + if ( --lp == 0 ) + { + clock_t finish = clock(); + double n = (double)NBLP / (double)(finish-start) * CLOCKS_PER_SEC; + char b[30]; + sprintf( b, "%f", n); + info->m_pEdit->SetWindowText(b); + + n = n * 1100 / 200; // performances + sprintf( b, "%f", n); + info->m_pEdit3->SetWindowText(b); + start = finish; + lp = NBLP; + } + } + + return 0 ; +} + +BOOL CPerformDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + + CBotStringArray liste; + // crée les scripts pour les tests + for ( int i = 0; i < 100; i++ ) + { + m_pProg[i] = new CBotProgram(); + m_pProg[i]->Compile(m_Script, liste); + m_pProg[i]->Start(liste[0]); + } + + // lance un processus paralèle pour l'exécution +// m_threadinfo2.m_pWndMessage = this ; + + m_threadinfo2.m_pEdit = &m_Edit1; + m_threadinfo2.m_pEdit3 = &m_Edit3; + m_threadinfo2.m_pProg = m_pProg; + m_threadinfo2.m_bStop = FALSE; + m_threadinfo2.m_nbscripts = 30; + + + AfxBeginThread((AFX_THREADPROC)ThreadProc2, &m_threadinfo2) ; + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CPerformDlg::OnCancel() +{ + m_threadinfo2.m_bStop = TRUE; + sleep ( 2000 ); + + CDialog::OnCancel(); + + for ( int i = 0; i < 100; i++ ) + { + delete m_pProg[i]; + } +} diff --git a/src/CBot/tests/TestCBot/PerformDlg.h b/src/CBot/tests/TestCBot/PerformDlg.h new file mode 100644 index 0000000..29d567f --- /dev/null +++ b/src/CBot/tests/TestCBot/PerformDlg.h @@ -0,0 +1,78 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +#if !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_) +#define AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PerformDlg.h : header file +// + +struct ThreadInfo2 +{ + CEdit* m_pEdit ; + CEdit* m_pEdit3 ; + + CBotProgram** m_pProg; + BOOL m_bStop; + int m_nbscripts; +}; + + +///////////////////////////////////////////////////////////////////////////// +// CPerformDlg dialog + +class CPerformDlg : public CDialog +{ +// Construction +public: + CPerformDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPerformDlg) + enum { IDD = IDD_DIALOG1 }; + CEdit m_Edit3; + CEdit m_Edit1; + //}}AFX_DATA + + CBotProgram* m_pProg[100]; + ThreadInfo2 m_threadinfo2; + CString m_Script; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPerformDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPerformDlg) + virtual BOOL OnInitDialog(); + virtual void OnCancel(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/Routines.cpp b/src/CBot/tests/TestCBot/Routines.cpp new file mode 100644 index 0000000..b37f027 --- /dev/null +++ b/src/CBot/tests/TestCBot/Routines.cpp @@ -0,0 +1,153 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +//////////////////////////////////////////////////////////////////// +// routine show() +// utilisable depuis le programme écrit en CBot + +// exécution +BOOL rShow( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) +{ + CString s; + + while ( pVar != NULL ) + { + CString ss; + ss.LoadString( TX_TYPENAMES + pVar->GivType() ); + s += ss + " "; + + ss = pVar->GivName(); + if (ss.IsEmpty()) ss = ""; + s += ss + " = "; + + s += pVar->GivValString(); + s += "\n"; + pVar = pVar->GivNext(); + } + + 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 ) +{ + CString s; + + CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); + CEdit* pEdit = pApp->m_pConsole; + + if (pEdit == NULL) return TRUE; + pEdit->GetWindowText(s); + + while ( pVar != NULL ) + { + if ( !s.IsEmpty() ) s += " "; + s += pVar->GivValString(); + pVar = pVar->GivNext(); + } + s += "\r\n"; + + pEdit->SetWindowText(s); + pEdit->SetSel(s.GetLength(), s.GetLength()); + pEdit->SetFocus(); + return TRUE; // pas d'interruption +} + +BOOL rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser ) +{ + CString s; + + CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); + CEdit* pEdit = pApp->m_pConsole; + + if (pEdit == NULL) return TRUE; + pEdit->GetWindowText(s); + + while ( pVar != NULL ) + { + if ( !s.IsEmpty() ) s += " "; + s += pVar->GivValString(); + pVar = pVar->GivNext(); + } + + pEdit->SetWindowText(s); + pEdit->SetSel(s.GetLength(), s.GetLength()); + pEdit->SetFocus(); + 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 ) +{ + CString s; + + if ( pVar == NULL )return TRUE; // constructeur sans paramètres est ok + + CBotVar* pX = pThis->GivItem("x"); + pX->SetValFloat( pVar->GivValFloat() ); + pVar = pVar->GivNext(); + + CBotVar* pY = pThis->GivItem("y"); + pY->SetValFloat( pVar->GivValFloat() ); + pVar = pVar->GivNext(); + + return TRUE; // pas d'interruption +} + +CBotTypResult cCPoint( CBotVar* pThis, CBotVar* &pVar) +{ + // ok si aucun paramètres ! + if ( pVar == NULL ) return CBotTypResult(0); + + // paramètre de type numérique svp + if ( pVar->GivType() > CBotTypDouble ) return CBotTypResult(5011); + pVar = pVar->GivNext(); + + // il doit y avoir un second paramètre + if ( pVar == NULL ) return 5028; + // également de type numérique + if ( pVar->GivType() > CBotTypDouble )return CBotTypResult(5011); + pVar = pVar->GivNext(); + + // et pas plus de 2 paramètres svp + if ( pVar != NULL ) return CBotTypResult(5026); + + return CBotTypResult(0); // cette fonction retourne void +} + + diff --git a/src/CBot/tests/TestCBot/StdAfx.cpp b/src/CBot/tests/TestCBot/StdAfx.cpp new file mode 100644 index 0000000..7dd0f00 --- /dev/null +++ b/src/CBot/tests/TestCBot/StdAfx.cpp @@ -0,0 +1,20 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// stdafx.cpp : source file that includes just the standard includes +// TestCBot.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/src/CBot/tests/TestCBot/StdAfx.h b/src/CBot/tests/TestCBot/StdAfx.h new file mode 100644 index 0000000..c3659fb --- /dev/null +++ b/src/CBot/tests/TestCBot/StdAfx.h @@ -0,0 +1,40 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__4D1BB905_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/TestCBot.clw b/src/CBot/tests/TestCBot/TestCBot.clw new file mode 100644 index 0000000..13f20f4 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBot.clw @@ -0,0 +1,316 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CPerformDlg +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "testcbot.h" +LastPage=0 + +ClassCount=8 +Class1=CBotConsoleDlg +Class2=CChildFrame +Class3=CMainFrame +Class4=CTestCBotApp +Class5=CAboutDlg +Class6=CTestCBotDoc +Class7=CTestCBotView + +ResourceCount=12 +Resource1=IDD_CONSOLE +Resource2=IDR_TESTCBTYPE (French (France)) +Resource3=IDD_ABOUTBOX (French (France)) +Resource4=IDR_MAINFRAME (French (France)) +Resource5=IDR_MAINFRAME +Resource6=IDR_TESTCBTYPE +Resource7=IDD_ABOUTBOX +Resource8=IDD_CONSOLE (French (Switzerland)) +Class8=CPerformDlg +Resource9=IDD_DIALOG1 +Resource10=IDD_DIALOG2 +Resource11=IDD_DIALOG1 (French (Switzerland)) +Resource12=IDD_DIALOG2 (French (France)) + +[CLS:CBotConsoleDlg] +Type=0 +BaseClass=CDialog +HeaderFile=CBotConsoleDlg.h +ImplementationFile=CBotConsoleDlg.cpp +LastObject=IDC_EDIT1 + +[CLS:CChildFrame] +Type=0 +BaseClass=CMDIChildWnd +HeaderFile=ChildFrm.h +ImplementationFile=ChildFrm.cpp + +[CLS:CMainFrame] +Type=0 +BaseClass=CMDIFrameWnd +HeaderFile=MainFrm.h +ImplementationFile=MainFrm.cpp +Filter=T +VirtualFilter=fWC +LastObject=CMainFrame + +[CLS:CTestCBotApp] +Type=0 +BaseClass=CWinApp +HeaderFile=TestCBot.h +ImplementationFile=TestCBot.cpp +Filter=N +VirtualFilter=AC +LastObject=ID_TEST + +[CLS:CAboutDlg] +Type=0 +BaseClass=CDialog +HeaderFile=TestCBot.cpp +ImplementationFile=TestCBot.cpp +LastObject=CAboutDlg + +[CLS:CTestCBotDoc] +Type=0 +BaseClass=CDocument +HeaderFile=TestCBotDoc.h +ImplementationFile=TestCBotDoc.cpp +LastObject=CTestCBotDoc +Filter=N +VirtualFilter=DC + +[CLS:CTestCBotView] +Type=0 +BaseClass=CView +HeaderFile=TestCBotView.h +ImplementationFile=TestCBotView.cpp +LastObject=CTestCBotView +Filter=C +VirtualFilter=VWC + +[DLG:IDD_CONSOLE] +Type=1 +Class=CBotConsoleDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT2,edit,1350631552 +Control3=IDOK,button,1342242817 +Control4=IDC_EDIT1,edit,1352734724 + +[DLG:IDD_ABOUTBOX] +Type=1 +Class=CAboutDlg +ControlCount=7 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 +Control7=IDC_STATIC,static,1342308352 + +[TB:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_EDIT_CUT +Command5=ID_EDIT_COPY +Command6=ID_EDIT_PASTE +Command7=ID_FILE_PRINT +Command8=ID_RUN +Command9=ID_APP_ABOUT +CommandCount=9 + +[MNU:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_MRU_FILE1 +Command4=ID_APP_EXIT +Command5=ID_VIEW_TOOLBAR +Command6=ID_VIEW_STATUS_BAR +Command7=ID_APP_ABOUT +CommandCount=7 + +[MNU:IDR_TESTCBTYPE (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_CLOSE +Command4=ID_FILE_SAVE +Command5=ID_FILE_SAVE_AS +Command6=ID_FILE_MRU_FILE1 +Command7=ID_APP_EXIT +Command8=ID_EDIT_UNDO +Command9=ID_EDIT_CUT +Command10=ID_EDIT_COPY +Command11=ID_EDIT_PASTE +Command12=ID_VIEW_TOOLBAR +Command13=ID_VIEW_STATUS_BAR +Command14=ID_WINDOW_NEW +Command15=ID_WINDOW_CASCADE +Command16=ID_WINDOW_TILE_HORZ +Command17=ID_WINDOW_ARRANGE +Command18=ID_APP_ABOUT +CommandCount=18 + +[ACL:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_EDIT_COPY +Command2=ID_FILE_NEW +Command3=ID_FILE_OPEN +Command4=ID_FILE_SAVE +Command5=ID_EDIT_PASTE +Command6=ID_EDIT_UNDO +Command7=ID_EDIT_CUT +Command8=ID_RUN +Command9=ID_NEXT_PANE +Command10=ID_PREV_PANE +Command11=ID_RUN +Command12=ID_TEST +Command13=ID_EDIT_COPY +Command14=ID_EDIT_PASTE +Command15=ID_EDIT_CUT +Command16=ID_EDIT_UNDO +CommandCount=16 + +[DLG:IDD_ABOUTBOX (French (France))] +Type=1 +Class=CAboutDlg +ControlCount=7 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 +Control7=IDC_STATIC,static,1342308352 + +[ACL:IDR_MAINFRAME] +Type=1 +Command1=ID_EDIT_COPY +Command2=ID_FILE_NEW +Command3=ID_FILE_OPEN +Command4=ID_FILE_SAVE +Command5=ID_EDIT_PASTE +Command6=ID_EDIT_UNDO +Command7=ID_EDIT_CUT +Command8=ID_RUN +Command9=ID_NEXT_PANE +Command10=ID_PREV_PANE +Command11=ID_RUN +Command12=ID_TEST +Command13=ID_EDIT_COPY +Command14=ID_EDIT_PASTE +Command15=ID_EDIT_CUT +Command16=ID_EDIT_UNDO +CommandCount=16 + +[TB:IDR_MAINFRAME] +Type=1 +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_EDIT_CUT +Command5=ID_EDIT_COPY +Command6=ID_EDIT_PASTE +Command7=ID_FILE_PRINT +Command8=ID_RUN +Command9=ID_APP_ABOUT +CommandCount=9 + +[MNU:IDR_MAINFRAME] +Type=1 +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_MRU_FILE1 +Command4=ID_APP_EXIT +Command5=ID_VIEW_TOOLBAR +Command6=ID_VIEW_STATUS_BAR +Command7=ID_APP_ABOUT +CommandCount=7 + +[MNU:IDR_TESTCBTYPE] +Type=1 +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_CLOSE +Command4=ID_FILE_SAVE +Command5=ID_FILE_SAVE_AS +Command6=ID_FILE_MRU_FILE1 +Command7=ID_APP_EXIT +Command8=ID_EDIT_UNDO +Command9=ID_EDIT_CUT +Command10=ID_EDIT_COPY +Command11=ID_EDIT_PASTE +Command12=ID_VIEW_TOOLBAR +Command13=ID_VIEW_STATUS_BAR +Command14=ID_WINDOW_NEW +Command15=ID_WINDOW_CASCADE +Command16=ID_WINDOW_TILE_HORZ +Command17=ID_WINDOW_ARRANGE +Command18=ID_APP_ABOUT +CommandCount=18 + +[DLG:IDD_CONSOLE (French (Switzerland))] +Type=1 +Class=CBotConsoleDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT2,edit,1350631552 +Control3=IDOK,button,1342242817 +Control4=IDC_EDIT1,edit,1352734724 + +[DLG:IDD_DIALOG1] +Type=1 +Class=CPerformDlg +ControlCount=9 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT1,edit,1350633600 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_EDIT2,edit,1350631552 +Control5=IDC_SPIN1,msctls_updown32,1342177312 +Control6=IDC_COMBO1,combobox,1344339971 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_EDIT3,edit,1350633600 + +[CLS:CPerformDlg] +Type=0 +HeaderFile=PerformDlg.h +ImplementationFile=PerformDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=IDC_EDIT3 + +[DLG:IDD_DIALOG2] +Type=1 +ControlCount=2 +Control1=IDOK,button,1342242817 +Control2=IDCANCEL,button,1342242816 + +[DLG:IDD_DIALOG1 (French (Switzerland))] +Type=1 +ControlCount=9 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT1,edit,1350633600 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_EDIT2,edit,1350631552 +Control5=IDC_SPIN1,msctls_updown32,1342177312 +Control6=IDC_COMBO1,combobox,1344339971 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_EDIT3,edit,1350633600 + +[DLG:IDD_DIALOG2 (French (France))] +Type=1 +ControlCount=2 +Control1=IDOK,button,1342242817 +Control2=IDCANCEL,button,1342242816 + diff --git a/src/CBot/tests/TestCBot/TestCBot.cpp b/src/CBot/tests/TestCBot/TestCBot.cpp new file mode 100644 index 0000000..a76040a --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBot.cpp @@ -0,0 +1,267 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// TestCBot.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "TestCBot.h" + +#include "MainFrm.h" +#include "ChildFrm.h" +#include "TestCBotDoc.h" +#include "TestCBotView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotApp + +BEGIN_MESSAGE_MAP(CTestCBotApp, CWinApp) + //{{AFX_MSG_MAP(CTestCBotApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotApp construction + +CTestCBotApp::CTestCBotApp() +{ + m_pConsole = NULL; + m_LastActive = NULL; + m_pClassPoint= NULL; +} + + +///////////////////////////////////////////////////////////////////////////// +// The one and only CTestCBotApp object + +CTestCBotApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotApp initialization + +#include "Routines.cpp" + + +static char BASED_CODE szSection[] = "Recent File List"; +static char BASED_CODE szFilename[] = "File1"; + + +#include "../ClassFILE.cpp" + +// routine pour mettre à jour l'instance de la classe Bot courante +void rMajObject( CBotVar* pThis, void* pUser ) +{ + if (!pThis->IsElemOfClass("object")) + return ; + CBotVar* pPos = pThis->GivItem("position"); + CBotVar* pX = pPos->GivItem("x"); + CBotVar* pY = pPos->GivItem("y"); + CBotVar* pZ = pPos->GivItem("z"); +// CBotVar* pPt = pThis->GivItem("transport"); + + CBotString p = pX->GivValString(); + +// pX->SetValFloat( pUser == (void*)1 ? (float)12.5 : (float)44.4 ); + pZ->SetValFloat( (float)0 ); + pY->SetValFloat( (float)-3.33 ); + pX->SetValFloat( pX->GivValFloat() + 10 ) ; + +// pX = pThis->GivItem( "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; +} + + +BOOL CTestCBotApp::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(); + + AfxEnableControlContainer(); + + // Standard initialization + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register document templates + + CMultiDocTemplate* pDocTemplate; + pDocTemplate = new CMultiDocTemplate( + IDR_TESTCBTYPE, + RUNTIME_CLASS(CTestCBotDoc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(CTestCBotView)); + AddDocTemplate(pDocTemplate); + + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + if (m_lpCmdLine[0] == 0) + { + CString Filename = GetProfileString(szSection, szFilename); + if (Filename.IsEmpty()) Filename = "TstCbot.txt"; + else OpenDocumentFile(Filename); + } + else + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + + + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CTestCBotApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotApp commands + +int CTestCBotApp::ExitInstance() +{ + delete m_pFuncFile; + + CBotProgram::Free(); + return CWinApp::ExitInstance(); +} diff --git a/src/CBot/tests/TestCBot/TestCBot.dsp b/src/CBot/tests/TestCBot/TestCBot.dsp new file mode 100644 index 0000000..8ed9b11 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBot.dsp @@ -0,0 +1,201 @@ +# Microsoft Developer Studio Project File - Name="TestCBot" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=TestCBot - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TestCBot.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TestCBot.mak" CFG="TestCBot - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TestCBot - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "TestCBot - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TestCBot - Win32 Release" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x100c /d "NDEBUG" +# ADD RSC /l 0x100c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "TestCBot - Win32 Debug" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x100c /d "_DEBUG" +# ADD RSC /l 0x100c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /stack:0x7010 /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "TestCBot - Win32 Release" +# Name "TestCBot - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\CBotConsoleDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\ChildFrm.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.cpp +# End Source File +# Begin Source File + +SOURCE=.\PerformDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TestCBot.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestCBot.rc + +!IF "$(CFG)" == "TestCBot - Win32 Release" + +!ELSEIF "$(CFG)" == "TestCBot - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\TestCBotDoc.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestCBotView.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\CBotConsoleDlg.h +# End Source File +# Begin Source File + +SOURCE=.\ChildFrm.h +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.h +# End Source File +# Begin Source File + +SOURCE=.\PerformDlg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TestCBot.h +# End Source File +# Begin Source File + +SOURCE=.\TestCBotDoc.h +# End Source File +# Begin Source File + +SOURCE=.\TestCBotView.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\TestCBot.ico +# End Source File +# Begin Source File + +SOURCE=.\res\TestCBot.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\TestCBotDoc.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Toolbar.bmp +# End Source File +# End Group +# Begin Source File + +SOURCE=..\Debug\CBot.lib +# End Source File +# End Target +# End Project diff --git a/src/CBot/tests/TestCBot/TestCBot.h b/src/CBot/tests/TestCBot/TestCBot.h new file mode 100644 index 0000000..c2595b6 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBot.h @@ -0,0 +1,78 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// TestCBot.h : main header file for the TESTCBOT application +// + +#if !defined(AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols +//#include "../CbotDll.h" // librairie CBot +#include "../Cbot.h" // complet pour Browse + +class CTestCBotView; + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotApp: +// See TestCBot.cpp for the implementation of this class +// + +class CTestCBotApp : public CWinApp +{ +public: + CTestCBotApp(); + + CEdit* m_pConsole; + CTestCBotView* m_LastActive; + CBotClass* m_pClassPoint; + CBotClass* m_pClassPointIntr; + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestCBotApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CTestCBotApp) + afx_msg void OnAppAbout(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTCBOT_H__4D1BB903_8E74_11D4_A439_00D059085115__INCLUDED_) + + +#define WM_STARTPROG WM_APP + 0 +#define WM_ENDPROG WM_APP + 1 +#define WM_ACTWINDOW WM_APP + 2 diff --git a/src/CBot/tests/TestCBot/TestCBot.rc b/src/CBot/tests/TestCBot/TestCBot.rc new file mode 100644 index 0000000..137458c --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBot.rc @@ -0,0 +1,564 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\TestCBot.ico" +IDR_TESTCBTYPE ICON DISCARDABLE "res\\TestCBotDoc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15 +BEGIN + BUTTON ID_FILE_NEW + BUTTON ID_FILE_OPEN + BUTTON ID_FILE_SAVE + SEPARATOR + BUTTON ID_EDIT_CUT + BUTTON ID_EDIT_COPY + BUTTON ID_EDIT_PASTE + SEPARATOR + BUTTON ID_FILE_PRINT + BUTTON ID_RUN + SEPARATOR + BUTTON ID_APP_ABOUT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&Fichier" + BEGIN + MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW + MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Quitter", ID_APP_EXIT + END + POPUP "&Affichage" + BEGIN + MENUITEM "&Barre d'outils", ID_VIEW_TOOLBAR + MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR + END + POPUP "&?" + BEGIN + MENUITEM "&A propos de TestCBot...", ID_APP_ABOUT + END +END + +IDR_TESTCBTYPE MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&Fichier" + BEGIN + MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW + MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Fermer", ID_FILE_CLOSE + MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE + MENUITEM "En®istrer sous...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Quitter", ID_APP_EXIT + END + POPUP "&Edition" + BEGIN + MENUITEM "&Annuler\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "&Couper\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY + MENUITEM "C&oller\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Affichage" + BEGIN + MENUITEM "&Barre d'outils", ID_VIEW_TOOLBAR + MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR + END + POPUP "Fe&nêtre" + BEGIN + MENUITEM "&Nouvelle fenêtre", ID_WINDOW_NEW + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "&Mosaïque", ID_WINDOW_TILE_HORZ + MENUITEM "&Réorganiser les icônes", ID_WINDOW_ARRANGE + END + POPUP "&?" + BEGIN + MENUITEM "&A propos de TestCBot...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_F5, ID_RUN, VIRTKEY, NOINVERT + VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT + VK_F7, ID_RUN, VIRTKEY, NOINVERT + VK_F9, ID_TEST, VIRTKEY, NOINVERT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 265, 206 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "A propos de TestCBot" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20 + LTEXT "TestCBot version 1.0",IDC_STATIC,40,10,119,8, + SS_NOPREFIX + LTEXT "Copyright D. Dumoulin (C) 2000",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,226,7,32,14,WS_GROUP + LTEXT "Programme de test pour la librairie CBot\n\nLes fonctions doivent être déclarées comme ""extern"" pour apparaître dans la liste lors de l'exécution.\n\n", + IDC_STATIC,39,43,191,41 + LTEXT "Mais en fait, on peut accèder à toutes les fonctions marquées ""public"" quelles soient dans la fenêtre active ou non.", + IDC_STATIC,39,89,187,36 + LTEXT "Les fonctions print( ... ) et println( ...) permettent d'afficher des résultats dans la console.\n\nLa fonction show( ... ) affiche les paramètres dans un dialogue, et suspend donc l'exécution.", + IDC_STATIC,39,130,187,54 +END + +IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,129,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040C04B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Application MFC TestCBot\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TestCBot\0" + VALUE "LegalCopyright", "Copyright (C) 1900\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TestCBot.EXE\0" + VALUE "ProductName", "Application TestCBot\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Traduction", 0x40c, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 258 + TOPMARGIN, 7 + BOTTOMMARGIN, 199 + END + + IDD_DIALOG2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "TestCBot" + IDR_TESTCBTYPE "\nTestCBot\nTestCBot\nCBot (*.txt)\n.txt\nTestCBot.Document\nTestCB Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "TestCBot" + AFX_IDS_IDLEMESSAGE "Prêt" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "MAJ" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "DEF" + ID_INDICATOR_OVR "ECR" + ID_INDICATOR_REC "ENR" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Crée un nouveau document\nNouveau" + ID_FILE_OPEN "Ouvre un document existant\nOuvrir" + ID_FILE_CLOSE "Ferme le document actif\nFermer" + ID_FILE_SAVE "Enregistre le document actif\nEnregistrer" + ID_FILE_SAVE_AS "Enregistre le document actif sous un nouveau nom\nEnregistrer sous" + ID_FILE_PRINT "Imprime le document\nImprime" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "Affiche des informations sur le programme\nA propos de" + ID_APP_EXIT "Ferme l'application ; propose d'enregistrer les documents\nQuitter" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "Ouvre ce document" + ID_FILE_MRU_FILE2 "Ouvre ce document" + ID_FILE_MRU_FILE3 "Ouvre ce document" + ID_FILE_MRU_FILE4 "Ouvre ce document" + ID_FILE_MRU_FILE5 "Ouvre ce document" + ID_FILE_MRU_FILE6 "Ouvre ce document" + ID_FILE_MRU_FILE7 "Ouvre ce document" + ID_FILE_MRU_FILE8 "Ouvre ce document" + ID_FILE_MRU_FILE9 "Ouvre ce document" + ID_FILE_MRU_FILE10 "Ouvre ce document" + ID_FILE_MRU_FILE11 "Ouvre ce document" + ID_FILE_MRU_FILE12 "Ouvre ce document" + ID_FILE_MRU_FILE13 "Ouvre ce document" + ID_FILE_MRU_FILE14 "Ouvre ce document" + ID_FILE_MRU_FILE15 "Ouvre ce document" + ID_FILE_MRU_FILE16 "Ouvre ce document" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "Passe au volet de fenêtre suivant\nVolet suivant" + ID_PREV_PANE "Revient au volet précédent\nVolet précédent" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_NEW "Ouvre une nouvelle fenêtre pour le document actif\nNouvelle fenêtre" + ID_WINDOW_ARRANGE "Réorganise les icônes en bas de la fenêtre\nRéorganise les icônes" + ID_WINDOW_CASCADE "Réorganise les fenêtres en cascade\nCascade" + ID_WINDOW_TILE_HORZ "Réorganise les fenêtres en une mosaïque\nMosaïque" + ID_WINDOW_TILE_VERT "Réorganise les fenêtres en une mosaïque\nMosaïque" + ID_WINDOW_SPLIT "Fractionne la fenêtre active en deux volets\nFractionner" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "Efface la sélection\nEffacer" + ID_EDIT_CLEAR_ALL "Efface tout\nEffacer tout" + ID_EDIT_COPY "Copie la sélection et la place dans le Presse-papiers\nCopier" + ID_EDIT_CUT "Supprime la sélection et la place dans le Presse-papiers\nCopier" + ID_EDIT_FIND "Recherche le texte spécifié\nRechercher" + ID_EDIT_PASTE "Insère le contenu du Presse-papiers\nColler" + ID_EDIT_REPEAT "Répète la dernière action\nRépéter" + ID_EDIT_REPLACE "Remplace le texte spécifique par un texte différent\nRemplacer" + ID_EDIT_SELECT_ALL "Sélectionne le document entier\nSélectionner tout" + ID_EDIT_UNDO "Annule la dernière action\nAnnuler" + ID_EDIT_REDO "Rétablit l'action précédemment annulée\nRétablir" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "Affiche ou masque la barre d'outils\nBarre d'outils" + ID_VIEW_STATUS_BAR "Affiche ou masque la barre d'état\nBarre d'état" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "Change la taille de la fenêtre" + AFX_IDS_SCMOVE "Change la position de la fenêtre" + AFX_IDS_SCMINIMIZE "Réduit la fenêtre en icône" + AFX_IDS_SCMAXIMIZE "Agrandit la fenêtre au format de l'écran" + AFX_IDS_SCNEXTWINDOW "Passe à la fenêtre de document suivante" + AFX_IDS_SCPREVWINDOW "Passe à la fenêtre de document précédente" + AFX_IDS_SCCLOSE "Ferme la fenêtre active et propose l'enregistrement des documents" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "Restaure la fenêtre à sa taille d'origine" + AFX_IDS_SCTASKLIST "Active la liste des tâches" + AFX_IDS_MDICHILD "Active cette fenêtre" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_RUN "Execute le programme CBot\nExecute (F5)" +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_TYPENAMES "les différents types" + 1001 "Byte" + 1002 "Short" + 1003 "Char" + 1004 "Int" + 1005 "Long" + 1006 "Real" + 1007 "Double" +END + +STRINGTABLE DISCARDABLE +BEGIN + 1008 "Boolean" + 1009 "String" + 1010 "Array" + 1011 "Arraybody" + 1012 "Pointer" + 1013 "Nullpointer" + 1014 "nop" + 1015 "Class" + 1016 "Intrinsic" +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// French (Switzerland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRS) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONSOLE DIALOG DISCARDABLE 0, 0, 401, 210 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "CBot Console" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Commande :",IDC_STATIC,7,177,40,8 + EDITTEXT IDC_EDIT2,7,189,329,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "Exécute",IDOK,344,189,50,14 + EDITTEXT IDC_EDIT1,7,7,387,167,ES_MULTILINE | ES_READONLY | + ES_WANTRETURN | WS_VSCROLL +END + +IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 177, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Test performances" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Boucles par seconde",IDC_STATIC,7,9,68,8 + EDITTEXT IDC_EDIT1,111,7,51,14,ES_AUTOHSCROLL | ES_READONLY + LTEXT "Nombre de scripts",IDC_STATIC,7,55,58,8 + EDITTEXT IDC_EDIT2,111,52,40,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,152,52, + 10,14 + COMBOBOX IDC_COMBO1,111,74,52,111,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "Timer",IDC_STATIC,7,77,18,8 + LTEXT "Performance %",IDC_STATIC,7,28,48,8 + EDITTEXT IDC_EDIT3,111,25,51,14,ES_AUTOHSCROLL | ES_READONLY +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_CONSOLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 394 + TOPMARGIN, 7 + BOTTOMMARGIN, 203 + END + + IDD_DIALOG1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 170 + TOPMARGIN, 7 + BOTTOMMARGIN, 93 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 12, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\TestCBot.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""l.fra\\afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog Info +// + +IDD_DIALOG1 DLGINIT +BEGIN + IDC_COMBO1, 0x403, 2, 0 +0x0031, + IDC_COMBO1, 0x403, 3, 0 +0x3031, "\000" + IDC_COMBO1, 0x403, 4, 0 +0x3031, 0x0030, + IDC_COMBO1, 0x403, 5, 0 +0x3031, 0x3030, "\000" + 0 +END + +#endif // French (Switzerland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE 12, 1 +#pragma code_page(1252) +#endif +#include "res\TestCBot.rc2" // non-Microsoft Visual C++ edited resources +#include "l.fra\afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/CBot/tests/TestCBot/TestCBotDoc.cpp b/src/CBot/tests/TestCBot/TestCBotDoc.cpp new file mode 100644 index 0000000..8880c57 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBotDoc.cpp @@ -0,0 +1,697 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// TestCBotDoc.cpp : implementation of the CTestCBotDoc class +// + +#include "stdafx.h" +#include "TestCBot.h" + +#include "TestCBotDoc.h" +#include "TestCBotView.h" +#include "CBotConsoleDlg.h" +#include "PerformDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotDoc + +IMPLEMENT_DYNCREATE(CTestCBotDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTestCBotDoc, CDocument) + //{{AFX_MSG_MAP(CTestCBotDoc) + ON_COMMAND(ID_RUN, OnRun) + ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1) + ON_COMMAND(ID_TEST, OnTest) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotDoc construction/destruction + +static BOOL test = FALSE; + + +CTestCBotDoc::CTestCBotDoc() +{ + m_pEdit = NULL; + m_pProg = NULL; + m_bModified = FALSE; +} + +CTestCBotDoc::~CTestCBotDoc() +{ + delete m_pEdit; + delete m_pProg; +} + +BOOL CTestCBotDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotDoc serialization + +void CTestCBotDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + m_pEdit->GetWindowText(m_DocText); + int w = m_DocText.GetLength(); + ar.Write((LPCTSTR)m_DocText, w); + } + else + { + int r; + char buf[10001]; + + r = ar.Read(buf, 10000); + buf[r] = 0; + m_DocText = buf; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + if (!m_pProg->Compile(m_DocText, m_Liste, NULL)) + { + delete m_pProg; + m_pProg = NULL; + } + } +} + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotDoc diagnostics + +#ifdef _DEBUG +void CTestCBotDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTestCBotDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotDoc commands + +void CTestCBotDoc::OnRun() +{ + OnFileSave(); + + m_pEdit->GetWindowText(m_DocText); + + CString TextError; + int code, start, end; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); + + if (!m_pProg->Compile(m_DocText, m_Liste, NULL)) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError = CBotProgram::GivErrorText( code ); + AfxMessageBox( TextError ); + + m_pEdit->SetFocus(); + return; + } + + if( m_Liste.GivSize() == 0 ) + { + AfxMessageBox("Aucune fonction marquée \"extern\" !"); + return; + } + + for ( int i = 0; i < m_Liste.GivSize(); i++ ) + { + int start, stop; + m_pProg->GetPosition(m_Liste[i], start, stop, GetPosNom, GetPosParam); + m_Liste[i] = m_DocText.Mid( start, stop-start ); + } + + CBotConsoleDlg dlg; + dlg.m_pListe = &m_Liste; + dlg.m_pEditx = m_pEdit; + + dlg.DoModal(); // dialogue pour faire la console + + if ( dlg.m_code>0 ) + { + CString TextError; + + TextError = m_pProg->GivErrorText( dlg.m_code ); + + m_pEdit->SetSel( dlg.m_start, dlg.m_end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + AfxMessageBox(TextError); + } + + m_pEdit->SetFocus(); + + return; +} + + +void CTestCBotDoc::OnChangeEdit1() +{ + SetModifiedFlag(); + m_bModified = TRUE; +} + +BOOL CTestCBotDoc::Compile() +{ + m_pEdit->GetWindowText(m_DocText); + + CString TextError; + int code, start, end; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + char buffer[100]; + strcpy(buffer, "le pointeur à passer pour voir"); + + if (m_bModified && !m_pProg->Compile(m_DocText, m_Liste, (void*)buffer)) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError = CBotProgram::GivErrorText( code ); + AfxMessageBox( TextError ); + + m_pEdit->SetFocus(); + m_bModified = FALSE; + return FALSE; + } + + if ( m_pProg->GetPosition( "TheTest", start, end) ) + { + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + } + + m_bModified = FALSE; + return TRUE; +} + + + +static int compt = 0; +// routine retournant le "pointeur" à un autre object +BOOL rRetObject( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + pResult->SetPointer( NULL ); + compt+=45671; + if (compt&0x11) return TRUE; + + CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); + pAutre->SetUserPtr( (void*)2 ); + pResult->SetPointer( pAutre ); + + if (!pResult->IsElemOfClass("object")) + return TRUE; + + delete pAutre; + return TRUE; +} + +CBotTypResult cRetObject( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( CBotTypPointer, "object"); +} + +BOOL roRadar( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + pResult->SetPointer( NULL ); + compt+=45671; + if (compt&0x11) return TRUE; + + CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); + pAutre->SetUserPtr( (void*)2 ); + pResult->SetPointer( pAutre ); + + if (!pResult->IsElemOfClass("object")) + return TRUE; + + delete pAutre; + return TRUE; +} + +CBotTypResult coRadar( CBotVar* pThis, CBotVar* &pVar ) +{ + void* pUser = pThis->GivUserPtr(); + return CBotTypResult( CBotTypPointer, "object"); +} + +BOOL rMove( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + if ( test < 12 ) + { + test++; + return FALSE; + } + return TRUE; +} + +CBotTypResult cMove( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( 0 ); +} + +BOOL rTurn( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + return TRUE; +} + +CBotTypResult cTurn( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( 0 ); +} + +BOOL rRadar( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + pResult->SetPointer( NULL ); + + if ( pVar ) pVar->debug(); + + compt+=45671; + if (compt&0x11) + { + return FALSE; // TRUE; + } + + CBotVar* pAutre = CBotVar::Create("autre", CBotTypResult( CBotTypClass, "object" )); + pAutre->SetUserPtr( (void*)2 ); + pResult->SetPointer( pAutre ); + + if (!pResult->IsElemOfClass("object")) + return TRUE; + + delete pAutre; + return TRUE; +} + +CBotTypResult cRadar( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( CBotTypPointer, "object"); +} + +// routine retournant le "pointeur" à un autre object +BOOL rTEST( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + test = 1 ; + if ( pVar == NULL ) return TRUE; + + test = pVar->GivValInt(); + if ( test == 5 ) + { + pVar = pVar->GivNext(); + pVar->SetUserPtr( OBJECTDELETED ); + } + return TRUE; +} + +CBotTypResult cTEST( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( 0 ); +} + +// routine retournant le "pointeur" à un autre object +BOOL rF( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) +{ + if ( pResult == NULL ) return TRUE; + pResult->SetValInt(3); + return TRUE; +} + +CBotTypResult cF( CBotVar* &pVar, void* pUser ) +{ + return CBotTypResult( CBotTypFloat ); +} + +///////////////////////////////////////////////////////////////// + +// Compilation d'une procédure avec un "point". + +CBotTypResult cPoint(CBotVar* &var, void* user) +{ + if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); + + if ( var->GivType() <= CBotTypDouble ) + { + var = var->GivNext(); + if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); + if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); + var = var->GivNext(); + if ( var == 0 ) return CBotTypResult( CBotErrLowParam ); + if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); + var = var->GivNext(); + return CBotTypResult( 0 ); + } + + if ( var->GivType() == CBotTypClass ) + { + if ( !var->IsElemOfClass("point") ) return CBotTypResult( CBotErrBadParam ); + var = var->GivNext(); + return CBotTypResult( 0 ); + } + + return CBotTypResult( CBotErrBadParam ); +} + +// Donne un paramètre de type "point". +#define UNIT 1 + + +CBotTypResult cSpace(CBotVar* &var, void* user) +{ + CBotTypResult ret; + + if ( var == 0 ) return CBotTypResult( CBotTypIntrinsic, "point" ); + ret = cPoint(var, user); + if ( !ret.Eq(0) ) return ret; + + if ( var == 0 ) return CBotTypIntrinsic; + if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); + var = var->GivNext(); + + if ( var == 0 ) return CBotTypIntrinsic; + if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); + var = var->GivNext(); + + if ( var == 0 ) return CBotTypIntrinsic; + if ( var->GivType() > CBotTypDouble ) return CBotTypResult( CBotErrBadNum ); + var = var->GivNext(); + + if ( var != 0 ) return CBotErrOverParam; + return CBotTypResult( CBotTypIntrinsic, "point" ); +} + +// Instruction "space(center, rMin, rMax, dist)". + +BOOL rSpace(CBotVar* var, CBotVar* result, int& exception, void* user) +{ + CBotVar* pSub; + float rMin, rMax, dist; + + rMin = 5.0f*UNIT; + rMax = 50.0f*UNIT; + dist = 4.0f*UNIT; + + if ( var == 0 ) + { +// center = pThis->RetPosition(0); + } + else + { + if ( var != 0 ) + { + rMin = var->GivValFloat()*UNIT; + var = var->GivNext(); + + if ( var != 0 ) + { + rMax = var->GivValFloat()*UNIT; + var = var->GivNext(); + + if ( var != 0 ) + { + dist = var->GivValFloat()*UNIT; + var = var->GivNext(); + } + } + } + } + + if ( result != 0 ) + { + pSub = result->GivItemList(); + if ( pSub != 0 ) + { + pSub->SetValFloat(1); + pSub = pSub->GivNext(); // "y" + pSub->SetValFloat(2); + pSub = pSub->GivNext(); // "z" +// pSub->SetValFloat(3); + } + } + return TRUE; +} +////////////////////////////////////////////////////////////// + + +void CTestCBotDoc::OnTest() +{ + CBotProgram::DefineNum("WingedGrabber", 1); + CBotProgram::DefineNum("TrackedGrabber", 2); + CBotProgram::DefineNum("WheeledGrabber", 3); + CBotProgram::DefineNum("LeggedGrabber", 4); + CBotProgram::DefineNum("WingedShooter", 5); + CBotProgram::DefineNum("TrackedShooter", 6); + CBotProgram::DefineNum("WheeledShooter", 7); + CBotProgram::DefineNum("LeggedShooter", 8); + CBotProgram::DefineNum("WingedOrgaShooter", 9); + CBotProgram::DefineNum("TrackedOrgaShooter", 10); + CBotProgram::DefineNum("WheeledOrgaShooter", 11); + CBotProgram::DefineNum("LeggedOrgaShooter", 12); + CBotProgram::DefineNum("WingedSniffer", 13); + CBotProgram::DefineNum("TrackedSniffer", 14); + CBotProgram::DefineNum("WheeledSniffer", 14); + CBotProgram::DefineNum("LeggedSniffer", 15); + CBotProgram::DefineNum("Thumper", 16); + CBotProgram::DefineNum("PhazerShooter", 17); + CBotProgram::DefineNum("Recycler", 18); + CBotProgram::DefineNum("Shielder", 19); + CBotProgram::DefineNum("Subber", 20); + CBotProgram::DefineNum("Me", 21); + + CBotProgram::DefineNum("TypeMarkPath", 111); + + OnFileSave(); + +// CPerformDlg dlg; +// dlg.m_Script = m_DocText; +// dlg.DoModal(); + + // défini la routine RetObject + CBotProgram::AddFunction( "Radar", rRetObject, cRetObject ); + + // ajoute une routine pour cette classe + CBotProgram::AddFunction("Space", rSpace, cSpace); + + // défini la routine Test + CBotProgram::AddFunction( "TEST", rTEST, cTEST ); + CBotProgram::AddFunction( "F", rF, cF ); + + CBotProgram::AddFunction( "goto", rMove, cMove ); + CBotProgram::AddFunction( "fire", rTurn, cTurn ); + CBotProgram::AddFunction( "radar", rRadar, cRadar ); + + // crée une instance de la classe "Bot" pour ce robot + CBotVar* pThisRobot = CBotVar::Create( "", CBotTypResult(CBotTypClass, "object") ); + pThisRobot->SetUserPtr( (void*)1 ); + pThisRobot->SetIdent( 1234 ); + + delete m_pProg; + // crée un objet programme associé à cette instance + m_pProg = new CBotProgram(pThisRobot); + + // compile le programme + CString TextError; + int code, start, end; + + m_pEdit->GetWindowText(m_DocText); + if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + delete pThisRobot; + + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError = CBotProgram::GivErrorText( code ); + AfxMessageBox( TextError ); + + m_pEdit->SetFocus(); + return; + } + + // exécute pour voir + m_pProg->Start(m_Liste[0]); + + int mode = -1; + + if ( mode >= 0 ) { + + // sauve et restore à chaque pas possible + while (!m_pProg->Run(NULL, 1)) + { + const char* FunctionName; + int start1, end1; + m_pProg->GetRunPos(FunctionName, start1, end1); + if ( end1 <= 0 ) + m_pProg->GetRunPos(FunctionName, start1, end1); + m_pEdit->SetSel(start1, end1); + +if ( mode == 0 ) continue; + + FILE* pf; + pf = fOpen( "TEST.CBO", "wb" ); + CBotClass::SaveStaticState(pf); + m_pProg->SaveState(pf); + fClose(pf); + +if ( mode == 2 ) if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + delete pThisRobot; + + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError = CBotProgram::GivErrorText( code ); + AfxMessageBox( TextError ); + + m_pEdit->SetFocus(); + return; + } + + pf = fOpen( "TEST.CBO", "rb" ); + CBotClass::RestoreStaticState(pf); + m_pProg->RestoreState(pf); + fClose(pf); + + int start2, end2; + m_pProg->GetRunPos(FunctionName, start2, end2); + if ( end2 <= 0 ) + m_pProg->GetRunPos(FunctionName, start2, end2); + + if ( start1 != start2 || end1 != end2 ) + m_pProg->GetRunPos(FunctionName, start2, end2); + m_pEdit->SetSel(start2, end2); + } + + if (m_pProg->GetError(code, start, end)) + { + m_pEdit->SetSel(start, end); + TextError = CBotProgram::GivErrorText(code); + AfxMessageBox(TextError); + } + return;} + + while (!m_pProg->Run(NULL, 0)) + { + const char* FunctionName; + int start, end; + m_pProg->GetRunPos(FunctionName, start, end); + m_pEdit->SetSel(start, end); + + if ( FunctionName == NULL ) continue; + CString info (FunctionName); + CString sep (":\n"); + + int level = 0; + const char* Name; + while ( TRUE ) + { + CBotVar* pVar = m_pProg->GivStackVars(Name, level--); + if ( Name != FunctionName ) break; + if ( pVar == NULL ) continue; +// pVar->Maj(NULL, FALSE); + while ( pVar != NULL ) + { + info += sep; + info += pVar->GivName() + CBotString(" = ") + pVar->GivValString(); + sep = ", "; + pVar = pVar->GivNext(); + } + sep = "\n"; + } + if ( IDOK != AfxMessageBox(info, MB_OKCANCEL) ) break; + + if ( test == 1 ) + { + test = 0; + FILE* pf; + pf = fOpen( "TEST.CBO", "wb" ); + m_pProg->SaveState(pf); + fClose(pf); + } + + if ( test == 2 ) + { + test = 0; + FILE* pf; + pf = fOpen( "TEST.CBO", "rb" ); + m_pProg->RestoreState(pf); + fClose(pf); + } + + if ( test == 12 ) + { + test = 0; + FILE* pf; + pf = fOpen( "TEST.CBO", "wb" ); + m_pProg->SaveState(pf); + fClose(pf); + + pf = fOpen( "TEST.CBO", "rb" ); + m_pProg->RestoreState(pf); + fClose(pf); + + test = 13; + } + } + + if (m_pProg->GetError(code, start, end)) + { + m_pEdit->SetSel(start, end); + TextError = CBotProgram::GivErrorText(code); + AfxMessageBox(TextError); + } + + delete pThisRobot; +} + diff --git a/src/CBot/tests/TestCBot/TestCBotDoc.h b/src/CBot/tests/TestCBot/TestCBotDoc.h new file mode 100644 index 0000000..548607f --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBotDoc.h @@ -0,0 +1,78 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// TestCBotDoc.h : interface of the CTestCBotDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + +class CTestCBotDoc : public CDocument +{ +protected: // create from serialization only + CTestCBotDoc(); + DECLARE_DYNCREATE(CTestCBotDoc) + +// Attributes +public: + CEdit* m_pEdit; // pour mémoriser le texte, et l'afficher + CBotProgram* m_pProg; // le programme compilé + CString m_DocText; + CBotStringArray m_Liste; + BOOL m_bModified; + +// Operations +public: + BOOL Compile(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestCBotDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTestCBotDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTestCBotDoc) + afx_msg void OnRun(); + afx_msg void OnChangeEdit1(); + afx_msg void OnTest(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTCBOTDOC_H__4D1BB90B_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/TestCBot/TestCBotView.cpp b/src/CBot/tests/TestCBot/TestCBotView.cpp new file mode 100644 index 0000000..bca3c56 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBotView.cpp @@ -0,0 +1,142 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/. + +// TestCBotView.cpp : implementation of the CTestCBotView class +// + +#include "stdafx.h" +#include "TestCBot.h" + +#include "TestCBotDoc.h" +#include "TestCBotView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotView + +IMPLEMENT_DYNCREATE(CTestCBotView, CView) + +BEGIN_MESSAGE_MAP(CTestCBotView, CView) + //{{AFX_MSG_MAP(CTestCBotView) + ON_WM_SIZE() + ON_MESSAGE(WM_ACTWINDOW, ActWindow) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotView construction/destruction + +CTestCBotView::CTestCBotView() +{ +} + +CTestCBotView::~CTestCBotView() +{ +} + +BOOL CTestCBotView::PreCreateWindow(CREATESTRUCT& cs) +{ + return CView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotView drawing + +void CTestCBotView::OnDraw(CDC* pDC) +{ + CTestCBotDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotView diagnostics + +#ifdef _DEBUG +void CTestCBotView::AssertValid() const +{ + CView::AssertValid(); +} + +void CTestCBotView::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +CTestCBotDoc* CTestCBotView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestCBotDoc))); + return (CTestCBotDoc*)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestCBotView message handlers + +void CTestCBotView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) +{ + CTestCBotDoc* pDoc = GetDocument(); +// CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); + + if ( pDoc->m_pEdit == NULL) + { + pDoc->m_pEdit = new CEdit(); + CRect rect; + GetClientRect( rect ); + + pDoc->m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL, + rect, this, IDC_EDIT1 ); + pDoc->m_pEdit->SetTabStops(12); + pDoc->m_pEdit->SetWindowText(pDoc->m_DocText); + } + + if ( !bActivate && !pDoc->Compile() ) + { +// comment faire pour réactiver l'ancien document + } + + CView::OnActivateView(bActivate, pActivateView, pDeactiveView); + + if ( bActivate ) pDoc->m_pEdit->SetFocus(); +} + + +void CTestCBotView::OnSize(UINT nType, int cx, int cy) +{ + CView::OnSize(nType, cx, cy); + + CTestCBotDoc* pDoc = GetDocument(); + if ( pDoc->m_pEdit != NULL ) + { + CRect rect; + GetClientRect( rect ); + pDoc->m_pEdit->MoveWindow( rect ); + pDoc->m_pEdit->SetFocus(); + } +} + + + +LONG CTestCBotView::ActWindow(UINT wparam, LONG lparam) +{ +// GetParentFrame()->SetActiveView( this, TRUE ); +// CMDIChildWnd::OnMDIActivate(1, this, this) + return 0; +} diff --git a/src/CBot/tests/TestCBot/TestCBotView.h b/src/CBot/tests/TestCBot/TestCBotView.h new file mode 100644 index 0000000..065ee08 --- /dev/null +++ b/src/CBot/tests/TestCBot/TestCBotView.h @@ -0,0 +1,78 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.// TestCBotView.h : interface of the CTestCBotView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_) +#define AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CTestCBotView : public CView +{ +protected: // create from serialization only + CTestCBotView(); + DECLARE_DYNCREATE(CTestCBotView) + +// Attributes +public: + CTestCBotDoc* GetDocument(); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestCBotView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + protected: + virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTestCBotView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTestCBotView) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg LONG ActWindow(UINT wparam, LONG lparam) ; + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in TestCBotView.cpp +inline CTestCBotDoc* CTestCBotView::GetDocument() + { return (CTestCBotDoc*)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTCBOTVIEW_H__4D1BB90D_8E74_11D4_A439_00D059085115__INCLUDED_) diff --git "a/src/CBot/tests/TestCBot/a\2471.txt~" "b/src/CBot/tests/TestCBot/a\2471.txt~" new file mode 100644 index 0000000..0c57950 --- /dev/null +++ "b/src/CBot/tests/TestCBot/a\2471.txt~" @@ -0,0 +1,96 @@ +object radarGuepe(point orig, float dist) +{ + int i; + object pr, r; + float mindist; + + i = 0; + mindist = 1000; + while (i<30) + { + pr = radar(i); + if (pr != null) + { + + if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) + { + mindist = distance(orig, pr.position); + r = pr; + } + } + i = i+1; + } + if (mindist < dist) return(r); else return(null); +} + + +class Guepe +{ + + point pos; + + + void cherche(point orig, float dist) + { + object p; + point o; + + p = radarGuepe(orig, dist); + while (p == null) + { + wait(0.1); + p = radarGuepe(orig, dist); + } + + pos.x = p.position.x; + pos.y = p.position.y; + pos.z = p.position.z; + + //o = p.position; + //wait(0.1); + + //vitessex = (p.position.x - o.x)/0.1; + //vitessey = (p.position.y - o.y)/0.1; + //vitessez = (p.position.z - o.z)/0.1; + + } + + + void tire(point orig, float orient) + { + //float t = 3; //temps d'anticipation + float angle; + point cible; + + cible.x = pos.x;// + t*vitessex; + cible.y = pos.y;// + t*vitessey; + cible.z = pos.z;// + t*vitessez; + + if (cible.x == 0) angle = 90; else + angle = atan(cible.y / cible.x); + if (cible.x < 0) angle = angle + 180; + angle = angle - orient; + if (angle > 180) angle = angle - 360; + if (angle < -180) angle = angle + 360; + turn(angle); + + angle = atan((cible.z-orig.z) / distance2d(orig, cible)); + aim(angle); + + fire(0.1); + + } +} + +extern void object::Fourmi6() +{ + //fps(1000); + Guepe guepe = new Guepe(); + + while (true) + { + guepe.cherche(position, 50); + + guepe.tire(position, orientation); + } +} diff --git a/src/CBot/tests/TestCBot/res/TestCBot.ico b/src/CBot/tests/TestCBot/res/TestCBot.ico new file mode 100644 index 0000000..06a649d Binary files /dev/null and b/src/CBot/tests/TestCBot/res/TestCBot.ico differ diff --git a/src/CBot/tests/TestCBot/res/TestCBot.rc2 b/src/CBot/tests/TestCBot/res/TestCBot.rc2 new file mode 100644 index 0000000..b55f0d9 --- /dev/null +++ b/src/CBot/tests/TestCBot/res/TestCBot.rc2 @@ -0,0 +1,13 @@ +// +// TESTCBOT.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/tests/TestCBot/res/TestCBotDoc.ico b/src/CBot/tests/TestCBot/res/TestCBotDoc.ico new file mode 100644 index 0000000..3545614 Binary files /dev/null and b/src/CBot/tests/TestCBot/res/TestCBotDoc.ico differ diff --git a/src/CBot/tests/TestCBot/res/Toolbar.bmp b/src/CBot/tests/TestCBot/res/Toolbar.bmp new file mode 100644 index 0000000..04a71af Binary files /dev/null and b/src/CBot/tests/TestCBot/res/Toolbar.bmp differ diff --git a/src/CBot/tests/TestCBot/resource.h b/src/CBot/tests/TestCBot/resource.h new file mode 100644 index 0000000..d661201 --- /dev/null +++ b/src/CBot/tests/TestCBot/resource.h @@ -0,0 +1,44 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * 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://www.gnu.org/licenses/.//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by TestCBot.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_TESTCBTYPE 129 +#define IDD_DIALOG1 130 +#define IDD_CONSOLE 131 +#define IDD_DIALOG2 133 +#define IDC_EDIT1 1000 +#define TX_TYPENAMES 1000 +#define IDC_SPIN1 1001 +#define IDC_EDIT2 1002 +#define IDC_COMBO1 1003 +#define IDC_EDIT3 1004 +#define ID_RUN 32771 +#define ID_TEST 32772 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 135 +#define _APS_NEXT_COMMAND_VALUE 32773 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/CBot/tests/TestCBot/scenarios/B.txt b/src/CBot/tests/TestCBot/scenarios/B.txt new file mode 100644 index 0000000..53715f8 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/B.txt @@ -0,0 +1,18 @@ + + float [ ] TEST2 ( int [ ] param ) + { + float [ ] z; + for ( int i = 0 ; i < sizeof( param ) ; i++ ) try { z [i] = param [i] / 3; } + return z; + } + +extern public void T() +{ + int a [4]; + for ( int i = 0 ; i < 3 ; i++ ) a[i] = 4*i; + a [2] = 22; + + float [] b ; + b = TEST2 ( a ) ; + show ( a, b ); +} diff --git a/src/CBot/tests/TestCBot/scenarios/BUG2.txt b/src/CBot/tests/TestCBot/scenarios/BUG2.txt new file mode 100644 index 0000000..44de05a --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/BUG2.txt @@ -0,0 +1,107 @@ +object object :: TT ( int n ) +{ + object XX = radar(); + if ( n == 0 ) return null; + + while ( null == XX ) XX = radar(); + return XX; +} + +extern void object::Attack( ) +{ + show ( TT ( 0 ) ) ; + show ( TT ( 1 ) ) ; + return; + + int list[]; + int i; + object p; + float dist, prox; + point dest; + boolean advance = true; + + TEST(0); // ne stoppe pas si erreur +// while ( F () != 0 ) F(1); + + i = 0; + list[i++] = WingedGrabber; + list[i++] = TrackedGrabber; + list[i++] = WheeledGrabber; + list[i++] = LeggedGrabber; + list[i++] = WingedShooter; + list[i++] = TrackedShooter; + list[i++] = WheeledShooter; + list[i++] = LeggedShooter; + list[i++] = WingedOrgaShooter; + list[i++] = TrackedOrgaShooter; + list[i++] = WheeledOrgaShooter; + list[i++] = LeggedOrgaShooter; + list[i++] = WingedSniffer; + list[i++] = TrackedSniffer; + list[i++] = WheeledSniffer; + list[i++] = LeggedSniffer; + list[i++] = Thumper; + list[i++] = PhazerShooter; + list[i++] = Recycler; + list[i++] = Shielder; + list[i++] = Subber; + list[i++] = Me; + list[i++] = 3333; + list[i++] = 3334; + list[i++] = 3335; + list[i++] = 3336; + list[i++] = 3337; + list[i++] = 3338; + list[i++] = 3339; + list[i++] = 3331; + list[i++] = 3332; + list[i++] = 3330; + list[i++] = 1111; + list[i++] = 1112; + + F(F(0)); + + while ( true ) + { + p = radar(list, 0, 360, 0, 1000); + if ( p == null ) + { + F(2); + } + else + { + dist = F(p.position, position); + if ( dist <= 40 && !advance ) + { + fire(p.position); + advance = true; + } + else + { +//? if ( RetBaseDistance() > 20 ) + { + prox = dist-(5+F()*5); + if ( prox < 5 ) prox = 5; + dest.x = (position.x-p.position.x)*prox/dist + p.position.x; + dest.y = (position.y-p.position.y)*prox/dist + p.position.y; + dest.z = (position.z-p.position.z)*prox/dist + p.position.z; + goto(dest); + advance = false; + } + } + } + } +} + +// Calcule la distance jusqu'à la base. + +float object::RetBaseDistance() +{ + object p; + float dist; + + p = radar(4444, 0, 360, 0, 1000); + if ( p == null ) return 1000; + dist = F(p.position, position); + return dist; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/Deleted.txt b/src/CBot/tests/TestCBot/scenarios/Deleted.txt new file mode 100644 index 0000000..469a624 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/Deleted.txt @@ -0,0 +1,23 @@ +public extern void object :: ESSAI() +{ + while(true) + { + if ( true ) + { + goto(12); + break; + } + } + object x = null ; + + while ( x == null ) x = radar(); + + show ( x.position ) ; + + TEST(5, x); + + if ( x == null ) show ( "DELETED" ); + + show ( x.position ) ; + +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/MaClass.txt b/src/CBot/tests/TestCBot/scenarios/MaClass.txt new file mode 100644 index 0000000..ac472b4 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/MaClass.txt @@ -0,0 +1,16 @@ + +class MaClass +{ + int a = 1 ; + MaClass pointeur ; + MaClass next = null ; + CPoint autre = new CPoint( 1 , 1 ) ; +} + +extern public void Test ( ) +{ + MaClass x () ; + x.next = new MaClass ( ) ; + println ( x ) ; +} + diff --git a/src/CBot/tests/TestCBot/scenarios/Mc2.txt b/src/CBot/tests/TestCBot/scenarios/Mc2.txt new file mode 100644 index 0000000..172c259 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/Mc2.txt @@ -0,0 +1,4 @@ +class MaClass +{ + int t = 12; +} diff --git a/src/CBot/tests/TestCBot/scenarios/Mon fichier.txt b/src/CBot/tests/TestCBot/scenarios/Mon fichier.txt new file mode 100644 index 0000000..6b35bf8 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/Mon fichier.txt @@ -0,0 +1,2 @@ +Voici encore du texte +et une seconde ligne diff --git a/src/CBot/tests/TestCBot/scenarios/Nop.txt b/src/CBot/tests/TestCBot/scenarios/Nop.txt new file mode 100644 index 0000000..6a66f6f --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/Nop.txt @@ -0,0 +1,4 @@ +public extern void Nop() +{ + while ( true ) {} +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/POS.txt b/src/CBot/tests/TestCBot/scenarios/POS.txt new file mode 100644 index 0000000..688e4fb --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/POS.txt @@ -0,0 +1,14 @@ +void object :: T ( ) +{ + show ( position ) ; +} + +public extern void object :: POS() +{ + for ( int i = 0; i < 10 ; i++ ) + { + if ( i == 2 ) TEST ( 12 ) ; +// show ( position ); + T ( ) ; + } +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/T.txt b/src/CBot/tests/TestCBot/scenarios/T.txt new file mode 100644 index 0000000..50a792b --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/T.txt @@ -0,0 +1,4 @@ +public extern int T ( float n ) +{ + return n * 1.1; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/TESTALL.txt b/src/CBot/tests/TestCBot/scenarios/TESTALL.txt new file mode 100644 index 0000000..82247a0 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TESTALL.txt @@ -0,0 +1,161 @@ +int T ( int z ) +{ + return 45 + z ; +} + +class toto +{ + int val = 3 ; + int x = 3 * 3 ; + void toto( int n ) + { val = n + 3 ; } + int retval ( int param ) + { int r = val + param + x ; + val = param ; + return r ; } +} + +public extern void object :: Chose( ) +{ + int z [ 6 ]; + for ( int i = 0 ; i < 6 ; ) z [ i++ ] = 3 - i ; + show ( z ) ; + return; + + // test des tableaux + int [ ] a [ 3 ] ; +// a = null; + if ( a == null ) show ( "NULL" ); + + a [ 2 / 2 ] [ 2 ]= 5 ; + int [ ] b ; b = a [1] ; + b [ 0 ] = -4; + a [ 4 / 2 ] [ 1 ]= 1 ; + show ( a , b ) ; + return ; + { + toto chose = new toto (5 ) ; + toto truc = chose ; + show ( chose, chose.retval( 100 ) , + truc, truc.retval (40 ) ) ; + + return; + } + { + point A = new + point ( 4 * 4 , 2 ) ; + show ( A ) ; + return; + } + { + show ( T ( 1 ) , T ( 3.7 ) ) ; + return; + } + + { + point A ( 3, 4 ) , + B = A ; + + int n = -4; + show ( n ); + + show ( A, B ) ; + + boolean a = false; + boolean b = a or true; + if ( not a and b ) ; + return; + } + { + // test try + float x = nan ; int z = 0 ; + try { +// throw ( 3 * 4 + 33 ) ; + int zz ; goto ( 12 ) ; z = 1 ; z = 0 / 0 ; z = 2 ; + } + catch ( 45 + 0 * 6000 ) + { + show( "Exception 6000", z ) ; + } + catch ( x == 0 ) { show( "x nul" ) ; } + finally { show ( "fini" ) ; } + show ( "continue" ); + return; + } + { + // test des if + int a = 3; + if ( a == 3 ) show ( "33"); + else show ( "44"); + if ( a != 3 ) show ( "333"); + else show ( "444"); + return; + } + { + int a = 0; + // test break +un: + while ( true ) + { +deux: + while ( true ) + { + a++; + if ( a == 2 ) continue; + if ( a == 3 ) break deux; + show ( a ) ; + if ( a == 5 ) break un; + } + show ( "DEUX" ); + } + return; + } + { + // test switch + int a = 0; + + switch ( a ) + { + case 1 : show( "un" ) ; break; + case 2 : show( "deux" ) ; // break; + case 3 : show( "trois" ) ; break; + case 4 : show( "quatre" ) ; // break; + default : show( "par défaut" ) ; + } + return; + } + { + // test boucle while + float z = 3.3; + while ( z > 0 ) + { show ( z-- ) ; } + return; + } + + { + // test boucle do + float y = 3.3; + do { int x = 0; show(y); y++; } while ( y < 7 ) ; + return; + } + // test boucle for + int j = -7; show ( j ); + for ( int ii = 3, j = 31; ii < 6 ; ++ii, j = j -3 ) + { + j = 10 * j; + show ( ii, j ); + } + return; +{ + // déclarations de variables + int a; int b = 3; int c = 4*b, d = 1, e; + float x; float y = 3.3; float z = y / 2, u = 1, v; + boolean t; boolean tt = true or false; boolean ttt = false, tttt = true, t5; + string s; string ss = "hello"; string s2 = ss + " plus", s3 = "s3", s4; + + show( b, c, d ); + show( y, z, u ); + show( tt, ttt, tttt ); + show( ss, s2, s3 ); +} +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/TestCB1.txt b/src/CBot/tests/TestCBot/scenarios/TestCB1.txt new file mode 100644 index 0000000..516db47 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestCB1.txt @@ -0,0 +1,18 @@ +extern public void toto() +{ + print( "hello" ) ; + print( fac(5) ); + print( t() ) ; +} + +public int fac(int n) +{ + if ( n<2 ) return 1; + return n * fac(n-1); +} + +point t() +{ + point a(1,2); + return a; +} diff --git a/src/CBot/tests/TestCBot/scenarios/TestCBot1.txt b/src/CBot/tests/TestCBot/scenarios/TestCBot1.txt new file mode 100644 index 0000000..d27b4f8 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestCBot1.txt @@ -0,0 +1,27 @@ + +class CPoint2 +{ + float x, y; + void CPoint2(float x, float y) + { + this.x = x; + this.y = y; + } +} + +public extern void T ( ) +{ + CPoint2 X( 12, 33 ), Y ( -4, 4/3 ); + print ( X, Y ) ; +} + +public extern void Hello ( ) + +{ + println ( "Hello" ); +} + +public extern void test ( int n ) +{ + for ( int i = n; i>0 ; i--) print (i); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/TestCBot3.txt b/src/CBot/tests/TestCBot/scenarios/TestCBot3.txt new file mode 100644 index 0000000..b915f96 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestCBot3.txt @@ -0,0 +1,24 @@ +public extern void Test () +{ + for ( int x = 100000; x>0 ; x-- ) { } +} + +float MaRoutine( CPoint A, CPoint B ) +{ + A.x -= B.x ; // distance en x + A.y -= B.y ; // distance en y + A.x *= A.x; // carré de la distance + A.y += A.y; // carré de la distance + println ( A, B ) ; + return ( A.x + A.y ) ; +} + +public extern void TestAB ( ) +{ + CPoint A(3, 5) ; + CPoint B(4, -2); + println ( A, B ) ; + MaRoutine( A, B ) ; + println ( A, B ) ; +} + diff --git a/src/CBot/tests/TestCBot/scenarios/TestNull.txt b/src/CBot/tests/TestCBot/scenarios/TestNull.txt new file mode 100644 index 0000000..f447245 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestNull.txt @@ -0,0 +1,15 @@ +extern public void TestNull () +{ + CPoint pointeur = null; + + try { + pointeur.x = 4; } + catch ( 6007 ) {} + + pointeur = new CPoint(1,2); + + print ( pointeur.x, pointeur.y, + pointeur ); + + pointeur.x = 5; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt b/src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt new file mode 100644 index 0000000..1e49e37 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestRestoreState.txt @@ -0,0 +1,67 @@ +// routine de Daniel qui plante après RestoreState + +extern void object::Attack( ) +{ + int list[], i; + object p; + float dist, prox; + point nav1, nav2, dest; + boolean advance = true; + + i = 0; + list[i++] = WingedGrabber; + list[i++] = TrackedGrabber; + list[i++] = WheeledGrabber; + list[i++] = LeggedGrabber; + list[i++] = WingedShooter; + list[i++] = TrackedShooter; + list[i++] = WheeledShooter; + list[i++] = LeggedShooter; + list[i++] = WingedOrgaShooter; + list[i++] = TrackedOrgaShooter; + list[i++] = WheeledOrgaShooter; + list[i++] = LeggedOrgaShooter; + list[i++] = WingedSniffer; + list[i++] = TrackedSniffer; + list[i++] = WheeledSniffer; + list[i++] = LeggedSniffer; + list[i++] = Thumper; + list[i++] = PhazerShooter; + list[i++] = Recycler; + list[i++] = Shielder; + list[i++] = Subber; + list[i++] = Me; + + nav1.x = 1;//cmdline(0); + nav1.y = 1;//cmdline(1); + nav2.x = 2;//cmdline(2); + nav2.y = 2;//cmdline(3); + + while ( true ) + { + while ( true ) + { + // ennemi à proximité ? + p = radar(list, 0, 360, 0, 40); + if ( p == null ) break; + // lui tire dessus + fire(p.position); + } + + // se promène vers le point A + goto(nav1); + + while ( true ) + { + // ennemi à proximité ? + p = radar(list, 0, 360, 0, 40); + if ( p == null ) break; + // lui tire dessus + fire(p.position); + } + + // se promène vers le point B + goto(nav2); + } +} + diff --git a/src/CBot/tests/TestCBot/scenarios/TestStatic.txt b/src/CBot/tests/TestCBot/scenarios/TestStatic.txt new file mode 100644 index 0000000..f501aa5 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestStatic.txt @@ -0,0 +1,31 @@ +class ESSAI +{ + int x = 0; + static int nb = 3; + static int [ ] array ; + + void Put( int val) + { +show(nb); + array[ nb ] = val; +// this.nb++; + this.nb = this.nb + 1; +show(nb, array); + } + int Get( ) + { + nb--; +show("out", nb, array); + return array[ nb ] ; + } +} + +extern public void T() +{ + ESSAI t1 ( ) ; + ESSAI t2 ( ) ; + t1.nb++; + t1.Put( 11 ); t1.Put( 12 ); t2.Put( 13 ); + + show ( t1.Get(), t2.Get(), t2.Get() ) ; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/TestStr.txt b/src/CBot/tests/TestCBot/scenarios/TestStr.txt new file mode 100644 index 0000000..683ec1b --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/TestStr.txt @@ -0,0 +1,17 @@ +extern public void TSTR() +{ + string s = "C'est un essai"; + + print ( s, strlen(s), strleft(s, 3), strright(s,3), strmid(s, 2), strmid(s,2,3), strfind(s, "un"), strfind(s, "sdgfld") ); + + show ( strupper(s), strlower(s) ); + + s = "123.45" ; + print ( strval(s) ); + + + string sub = strright("abcdef", 2); // sub vaut "ef###", # étant un caractère bizarre quelconque + show (sub); + int pos = strfind("abcdef", "xy"); // pos vaut -1. Pourquoi pas nan ? + show(pos); +} diff --git a/src/CBot/tests/TestCBot/scenarios/Z.txt b/src/CBot/tests/TestCBot/scenarios/Z.txt new file mode 100644 index 0000000..714119b --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/Z.txt @@ -0,0 +1,14 @@ +public extern void tp() +{ + int a [4], b[]; + a [ 0 ] = 8 ; + + b = T ( a ) ; + show ( a, b ); +} + +int[] T ( int[] Z ) +{ + for ( int i = 0; i < 4 ; i++ ) Z[ i ] = i * i ; + return Z; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/a1.txt b/src/CBot/tests/TestCBot/scenarios/a1.txt new file mode 100644 index 0000000..165bc95 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/a1.txt @@ -0,0 +1,96 @@ +object radarGuepe(point orig, float dist) +{ + int i; + object pr, r; + float mindist; + + i = 0; + mindist = 1000; + while (i<30) + { + pr = radar(i); + if (pr != null) + { + + if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) + { + mindist = distance(orig, pr.position); + r = pr; + } + } + i = i+1; + } + if (mindist < dist) return(r); else return(null); +} + + +class Guepe +{ + + point pos; + + + void cherche(point orig, float dist) + { + object p; + point o; + + p = radarGuepe(orig, dist); + while (p == null) + { + wait(0.1); + p = radarGuepe(orig, dist); + } + + pos.x = p.position.x; + pos.y = p.position.y; + pos.z = p.position.z; + + //o = p.position; + //wait(0.1); + + //vitessex = (p.position.x - o.x)/0.1; + //vitessey = (p.position.y - o.y)/0.1; + //vitessez = (p.position.z - o.z)/0.1; + + } + + + void tire(point orig, float orient) + { + //float t = 3; //temps d'anticipation + float angle; + point cible; + + cible.x = pos.x;// + t*vitessex; + cible.y = pos.y;// + t*vitessey; + cible.z = pos.z;// + t*vitessez; + + if (cible.x == 0) angle = 90; else + angle = atan(cible.y / cible.x); + if (cible.x < 0) angle = angle + 180; + angle = angle - orient; + if (angle > 180) angle = angle - 360; + if (angle < -180) angle = angle + 360; + turn(angle); + + angle = atan((cible.z-orig.z) / distance2d(orig, cible)); + aim(angle); + + fire(0.1); + + } +} + +extern void object::Fourmi6() +{ + //fps(1000); + Guepe guepe = new Guepe(); + + while (true) + { + guepe.cherche(position, 50); + + guepe.tire(position, orientation); + } +} diff --git a/src/CBot/tests/TestCBot/scenarios/array.txt b/src/CBot/tests/TestCBot/scenarios/array.txt new file mode 100644 index 0000000..081b60e --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/array.txt @@ -0,0 +1,24 @@ + +public extern void TestTableau () +{ + int tableau [ 12 ] ; + + point array[ 12 ] [ 14 ] ; + + point zéro ( 1, 2 ) ; + point a = zéro ; + + for ( int i = 0 ; i < 10 ; i++ ) array[ i ] [ i ]= zéro ; + + array[ 5 ] [3 ] . x =1.5 ; + + array[ 2 ] [ 2 ] . y = array[ 5 ] [ 5 ] . x ; + + array[ 4 ] = array [ 2 ] ; + + for ( int i = 0 ; i < 10 ; i++ ) for ( int j = 0 ; j < 4 ; j++ ) println ( i, j, array [ i ] [ j ] ) ; + + show( zéro, a, array ); + +} + diff --git "a/src/CBot/tests/TestCBot/scenarios/a\2361.txt" "b/src/CBot/tests/TestCBot/scenarios/a\2361.txt" new file mode 100644 index 0000000..165bc95 --- /dev/null +++ "b/src/CBot/tests/TestCBot/scenarios/a\2361.txt" @@ -0,0 +1,96 @@ +object radarGuepe(point orig, float dist) +{ + int i; + object pr, r; + float mindist; + + i = 0; + mindist = 1000; + while (i<30) + { + pr = radar(i); + if (pr != null) + { + + if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) + { + mindist = distance(orig, pr.position); + r = pr; + } + } + i = i+1; + } + if (mindist < dist) return(r); else return(null); +} + + +class Guepe +{ + + point pos; + + + void cherche(point orig, float dist) + { + object p; + point o; + + p = radarGuepe(orig, dist); + while (p == null) + { + wait(0.1); + p = radarGuepe(orig, dist); + } + + pos.x = p.position.x; + pos.y = p.position.y; + pos.z = p.position.z; + + //o = p.position; + //wait(0.1); + + //vitessex = (p.position.x - o.x)/0.1; + //vitessey = (p.position.y - o.y)/0.1; + //vitessez = (p.position.z - o.z)/0.1; + + } + + + void tire(point orig, float orient) + { + //float t = 3; //temps d'anticipation + float angle; + point cible; + + cible.x = pos.x;// + t*vitessex; + cible.y = pos.y;// + t*vitessey; + cible.z = pos.z;// + t*vitessez; + + if (cible.x == 0) angle = 90; else + angle = atan(cible.y / cible.x); + if (cible.x < 0) angle = angle + 180; + angle = angle - orient; + if (angle > 180) angle = angle - 360; + if (angle < -180) angle = angle + 360; + turn(angle); + + angle = atan((cible.z-orig.z) / distance2d(orig, cible)); + aim(angle); + + fire(0.1); + + } +} + +extern void object::Fourmi6() +{ + //fps(1000); + Guepe guepe = new Guepe(); + + while (true) + { + guepe.cherche(position, 50); + + guepe.tire(position, orientation); + } +} diff --git "a/src/CBot/tests/TestCBot/scenarios/a\2471.txt" "b/src/CBot/tests/TestCBot/scenarios/a\2471.txt" new file mode 100644 index 0000000..0c57950 --- /dev/null +++ "b/src/CBot/tests/TestCBot/scenarios/a\2471.txt" @@ -0,0 +1,96 @@ +object radarGuepe(point orig, float dist) +{ + int i; + object pr, r; + float mindist; + + i = 0; + mindist = 1000; + while (i<30) + { + pr = radar(i); + if (pr != null) + { + + if (F(orig, pr.position) < mindist and pr.category == AlienWasp and pr.altitude > 3) + { + mindist = distance(orig, pr.position); + r = pr; + } + } + i = i+1; + } + if (mindist < dist) return(r); else return(null); +} + + +class Guepe +{ + + point pos; + + + void cherche(point orig, float dist) + { + object p; + point o; + + p = radarGuepe(orig, dist); + while (p == null) + { + wait(0.1); + p = radarGuepe(orig, dist); + } + + pos.x = p.position.x; + pos.y = p.position.y; + pos.z = p.position.z; + + //o = p.position; + //wait(0.1); + + //vitessex = (p.position.x - o.x)/0.1; + //vitessey = (p.position.y - o.y)/0.1; + //vitessez = (p.position.z - o.z)/0.1; + + } + + + void tire(point orig, float orient) + { + //float t = 3; //temps d'anticipation + float angle; + point cible; + + cible.x = pos.x;// + t*vitessex; + cible.y = pos.y;// + t*vitessey; + cible.z = pos.z;// + t*vitessez; + + if (cible.x == 0) angle = 90; else + angle = atan(cible.y / cible.x); + if (cible.x < 0) angle = angle + 180; + angle = angle - orient; + if (angle > 180) angle = angle - 360; + if (angle < -180) angle = angle + 360; + turn(angle); + + angle = atan((cible.z-orig.z) / distance2d(orig, cible)); + aim(angle); + + fire(0.1); + + } +} + +extern void object::Fourmi6() +{ + //fps(1000); + Guepe guepe = new Guepe(); + + while (true) + { + guepe.cherche(position, 50); + + guepe.tire(position, orientation); + } +} diff --git a/src/CBot/tests/TestCBot/scenarios/bug.txt b/src/CBot/tests/TestCBot/scenarios/bug.txt new file mode 100644 index 0000000..4ec6eb3 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/bug.txt @@ -0,0 +1,12 @@ +public extern void object::Bug() +{ + point a; + a = position; + TEST(); + float d=dist(a, position); +} + +float dist(point a, point b) +{ + return a.x-b.x; +} diff --git a/src/CBot/tests/TestCBot/scenarios/bugmw.txt b/src/CBot/tests/TestCBot/scenarios/bugmw.txt new file mode 100644 index 0000000..284ee43 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/bugmw.txt @@ -0,0 +1,9 @@ +extern public void main() +{ + show(fact(30)) ; +} + +public int fact(int n) +{ + return (fact(n-1)*n) ; +} diff --git a/src/CBot/tests/TestCBot/scenarios/ccc.txt b/src/CBot/tests/TestCBot/scenarios/ccc.txt new file mode 100644 index 0000000..dbcd1d5 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/ccc.txt @@ -0,0 +1,8 @@ +public extern void ccc() +{ + int a; + a = 0 ; + + if ( a == 0 ); + +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/enum.txt b/src/CBot/tests/TestCBot/scenarios/enum.txt new file mode 100644 index 0000000..a592a7f --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/enum.txt @@ -0,0 +1,9 @@ + +enum JourDeLaSemaine { + lundi = 1, + mardi, + mercredi, + jeudi, + vendredi, + samedi, + dimanche = 0 } \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/fibo.txt b/src/CBot/tests/TestCBot/scenarios/fibo.txt new file mode 100644 index 0000000..88f5357 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/fibo.txt @@ -0,0 +1,25 @@ + +extern public int Fibo( int n, boolean b ) +{ + if ( n < 2 ) return n; + int a = Fibo(n-1, b) + Fibo(n-2, false); + if ( b ) print (n + "=" + a); + return a; +} + +extern public void t() +{ + Fibo( 23, true); +} + +extern public void tt() +{ + t(); +} + +// cette routine n'est évidemment pas du tout obtimisée +// c'est même un très mauvais exemple de programmation récursive + +// pour un test de durée, Fibo(23, true) prend +// en mode Debug 67 secondes +// en mode Release 8 secondes diff --git a/src/CBot/tests/TestCBot/scenarios/file.txt b/src/CBot/tests/TestCBot/scenarios/file.txt new file mode 100644 index 0000000..2a22dd9 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/file.txt @@ -0,0 +1,70 @@ +class CLASS22 +{ + static int nb = 2; + void T22 ( ) { nb = nb / 0 ; } +} + +public extern void object :: TEST() +{ + switch ( 1 ) + { + case 1: + { + file h(); + h.open("Mon Fichier.txt", "r"); +show ( h.filename, h.handle ); +h.filename = "xx"; +h.handle = 1 ; + h.readln(); + h.close(); + } + case 2: + { + file h("Mon Fichier.txt"); + h.open("r"); + h.readln(); + h.close(); + } + case 3: + { + file h("Mon Fichier.txt", "r"); + h.readln(); + h.close(); + } + case 4: + { + file h(); + h.filename = "Mon Fichier.txt"; + h.open("r"); + h.readln(); + h.close(); + } + case 5: + { + file h = fileopen( "Mon 2Fichier.txt", "r" ); + h.readln(); + h.close(); + } + } +{ + file h( ) ; + h.filename = "Test.h"; + h.open ( "r" ); + + + file pf ( "Mon Fichier.txt" ) ; + pf . open ( "w" ) ; + pf . writeln ( "Voici encore du texte" ) ; + pf . writeln ( "et une seconde ligne" ) ; + pf . close( ); + + pf . open ( "r" ) ; + + while ( not pf . eof( ) ) + { + string s = pf . readln ( ); + show ( s ); + } + pf.close( ); +} +} diff --git a/src/CBot/tests/TestCBot/scenarios/h.txt b/src/CBot/tests/TestCBot/scenarios/h.txt new file mode 100644 index 0000000..c395319 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/h.txt @@ -0,0 +1,5 @@ +void tf() +{ + file h; + h.handle += 1 ; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/include.txt b/src/CBot/tests/TestCBot/scenarios/include.txt new file mode 100644 index 0000000..e8f8cc9 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/include.txt @@ -0,0 +1,27 @@ +class Z +{ + static int x = 0; + private int y; + + void T( ) + { + // autorisé ici + y = x ; + this.y = this.x ; + x = y ; + this.x = this.y ; + } +} + +extern public void test() +{ + Z a(); + 3 * a.x; // autorisé +//vu 3 * a.y; // interdit +//vu a.y = 3; // interdit ici + a.x = 1; // autorisé + + show ( a ); + a.T(); + show ( a ); +} diff --git a/src/CBot/tests/TestCBot/scenarios/intrinsic.txt b/src/CBot/tests/TestCBot/scenarios/intrinsic.txt new file mode 100644 index 0000000..f215791 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/intrinsic.txt @@ -0,0 +1,16 @@ +public extern void TestIntrinsic() +{ + point a ( 1, 2 ); + print (a); + + a.x = 3; + a.y = 4; + + point b = a; + + println ( b.x, b.y, b ) ; + if ( b == a ) b.y = 0; + println (a,b); + if ( b != a ) b.y = a.y; + println(a,b); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/methode1.txt b/src/CBot/tests/TestCBot/scenarios/methode1.txt new file mode 100644 index 0000000..080bba2 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/methode1.txt @@ -0,0 +1,57 @@ +class t { + point p; +} + +void object :: toto() +{ + show ( Position ) ; +} + +extern public void object :: XX() +{ + int test []; + test [ 9999 ] = 3; + + toto () ; +/* + Radar(); + + object test ; + test = this. Radar(); + + do { + test = this.Radar(); + } while ( test == null ); + +/* + t test [ 4 ]; + for ( int i = 0 ; i < 4 ; i++ ) test [ i ] = new t(); + test [ 3 ] .p.x = 2; + show ( test ); +/* + int a = nan; + show ( a ) ; + + a = TypeMarkPath; + show ( a, a++, --a ) ; + + if ( a != nan ) a += 1 ; + + a = TypeMarkPath; + float q = a ; + show ( a, q ) ; + +return; + + a += ++a; + show ( a ) ; + + boolean i = false; + + if ( i == true ) {} + + object p; + if ( p == null) { p = p ; } +*/ +} + diff --git a/src/CBot/tests/TestCBot/scenarios/methode2.txt b/src/CBot/tests/TestCBot/scenarios/methode2.txt new file mode 100644 index 0000000..76ce7f4 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/methode2.txt @@ -0,0 +1,50 @@ + +extern void Toto() +{ + TEST(12); + + for ( int i = 0 ; i<1000; i++) + { + int j = 1; + if (i==55) TEST(12); + } + + TEST(2); + + +// Nouveau(); + int toto[4]; + point Z[3]; + + Z[1].x = 11; Z[1].y = 12; + + toto[2] = 12; + toto[1] = nan; + +// point test, autre(2,3) ; +// object titi = Radar(); + + TEST ( 1 ) ; + + toto[0] = 11; + + TEST ( 2 ) ; + + toto[6] = 0; +} + +extern void object::Nouveau() +{ + point a; + a = np(Position); +} + +point np(point b) +{ + point c; + c.x = b.y; + c.y = b.x; + return c ; +} + + diff --git a/src/CBot/tests/TestCBot/scenarios/mp1.txt b/src/CBot/tests/TestCBot/scenarios/mp1.txt new file mode 100644 index 0000000..599cfc4 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/mp1.txt @@ -0,0 +1,25 @@ +class Guepet +{ + + float a; + float b; + + void init() + { + a = 12.34; + b = 56.78; + } + + +} + +extern void object::Fourmi6() +{ + Guepet guepe =new Guepet(); + + guepe.init(); + + + show("test "+guepe.a+" "+guepe.b); + +} diff --git a/src/CBot/tests/TestCBot/scenarios/mp2.txt b/src/CBot/tests/TestCBot/scenarios/mp2.txt new file mode 100644 index 0000000..1c2972c --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/mp2.txt @@ -0,0 +1,28 @@ +class Guepet +{ + + float a; + float b; + + void init() + { + a = 12.34; + b = 56.78; + + object x = radar(123); + show("radar "+x.position.x); + show("C'est fait"); + } + + +} + +extern void object::Fourmi6() +{ + Guepet guepe=new Guepet(); + + guepe.init(); + + show("test "+guepe.a+" "+guepe.b); + +} diff --git a/src/CBot/tests/TestCBot/scenarios/mw.txt b/src/CBot/tests/TestCBot/scenarios/mw.txt new file mode 100644 index 0000000..c237670 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/mw.txt @@ -0,0 +1,16 @@ +extern public void main() +{ +// goto( 3, 4 ); + + while( true ) + { + try { goto (12) ; } + catch( FF( ) ) + { show( "ko"); } + } +} + +boolean FF() +{ + return false; +} diff --git a/src/CBot/tests/TestCBot/scenarios/null.txt b/src/CBot/tests/TestCBot/scenarios/null.txt new file mode 100644 index 0000000..ae76b74 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/null.txt @@ -0,0 +1,5 @@ +extern public void xxx () +{ + CPoint test = null ; + if ( test == null ) show ( "NULL" ); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/opnew.txt b/src/CBot/tests/TestCBot/scenarios/opnew.txt new file mode 100644 index 0000000..7d6838c --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/opnew.txt @@ -0,0 +1,20 @@ +extern public void xx () +{ + CPoint pointeur, test = null ; + pointeur = new CPoint ( 3, 4 ); + + if ( test == null ) show ( "NULL" ); + + CPoint pp = pointeur; + +show( pointeur , pp ); + + pp.x = 33.3; + if ( pointeur.x != pp.x ) 0/0; + + pp = new CPoint(); +// pointeur = pp; + +show( pointeur , pp ); + +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/plante.txt b/src/CBot/tests/TestCBot/scenarios/plante.txt new file mode 100644 index 0000000..363461b --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/plante.txt @@ -0,0 +1,25 @@ +class Guepet +{ + + point pos; + float t = 0.1; + + void init() + { + pos.x = 12.123; + pos.y = 34.345; + + F(t); + } + + +} + +extern void object::Fourmi6() +{ + Guepet guepe=new Guepet(); + + guepe.init(); + + show ( guepe ); +} diff --git a/src/CBot/tests/TestCBot/scenarios/pointer.txt b/src/CBot/tests/TestCBot/scenarios/pointer.txt new file mode 100644 index 0000000..2d4d907 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/pointer.txt @@ -0,0 +1,41 @@ +extern public void x () +{ + show ( 3 ** 4 ); + float z = 1e-3; + show ( z ); + + CPoint b ( 4,5 ); + show ( b ); + + CPoint a ( ) ; + a.x = 21; a.y = 12; + show ( a ) ; + + CPoint test = new CPoint ( 1,1 ); + test = new CPoint ( 2, 2 ); + show ( test ); +} + +// crée un objet et retourne son pointeur +CPoint newcpoint() +{ + CPoint p = new CPoint ( 3, 3 ); + return p; +} + +extern public void y () +{ + CPoint test = newcpoint(); + println ( test ); + dontmodif( test ); + println ( test ); +} + +// ne doit pas modifier l'objet en paramètre +void dontmodif ( CPoint pp ) +{ + pp.x = 5; + pp.y = 2; + println ( pp, pp.x, pp.y ); +} + diff --git a/src/CBot/tests/TestCBot/scenarios/postinc.txt b/src/CBot/tests/TestCBot/scenarios/postinc.txt new file mode 100644 index 0000000..cdf6ab5 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/postinc.txt @@ -0,0 +1,7 @@ +extern public void X() +{ + point A [ ] ; + A[5] = new point (2,3); + int val = A[5].x++ + --A[5].y; + show ( A, val ); +} diff --git a/src/CBot/tests/TestCBot/scenarios/radar.txt b/src/CBot/tests/TestCBot/scenarios/radar.txt new file mode 100644 index 0000000..09d84a2 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/radar.txt @@ -0,0 +1,39 @@ +extern void object::Bug( ) +{ + try{ int a = 44 ; a = 12 / 0 ; } + catch(6000) { int b = 4 ; } + finally { int z = 1 ; } + +// tp ( A, B ); + +/* int a = 4, b = 2, c = nan; + float x, y = 3/2, z = nan; + boolean i, j = false, k = true; + + string s, ss = "xyz"; + + while ( false ) + { + object left, right; + + left = Radar(TypeMarkPath, -45, 120, 100); + right = Radar(TypeMarkPath, 45, 120, 100); + + if ( left == null && right == null ) + { + } + } + int t = fact ( 4 ) ;*/ +} + +void tp( point a , point b ) +{ + a.x += b.x; +} + + +int fact( int n ) +{ + if ( n < 2 ) return n; + return n * fact ( n - 1 ) ; +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/solution.txt b/src/CBot/tests/TestCBot/scenarios/solution.txt new file mode 100644 index 0000000..f78cf12 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/solution.txt @@ -0,0 +1,13 @@ +extern void object::Solution( ) +{ +show ( "Solution " + Position ); + Carré(15); + Carré(25); +} + +void object::Carré(float côté) +{ +show ( "Carré " + Position ); + Move(côté); + Turn(-90); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/test.txt b/src/CBot/tests/TestCBot/scenarios/test.txt new file mode 100644 index 0000000..a912415 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/test.txt @@ -0,0 +1,8 @@ +extern public void x() +{ + float a= 1, b = 2; + a = b * ( 2 + 2 ); +// print (a); + a += 4; +// print (a); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/test23.txt b/src/CBot/tests/TestCBot/scenarios/test23.txt new file mode 100644 index 0000000..d6e1ddd --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/test23.txt @@ -0,0 +1,10 @@ +extern public void object::TEST23() +{ + CLASS22 T; + T.T22( ) ; + + show( position ); + show( this.position ); + +// T22(); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/testmw.txt b/src/CBot/tests/TestCBot/scenarios/testmw.txt new file mode 100644 index 0000000..6570f6d --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/testmw.txt @@ -0,0 +1,14 @@ +extern public int testmw( int a) +{ + boolean b = true ; + + if (b) + return 1 ; + else + return a ; 0 * testmw(a-1) ; +} + +public int Fibo2 ( int n ) +{ + print ( " bof " ); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/this.txt b/src/CBot/tests/TestCBot/scenarios/this.txt new file mode 100644 index 0000000..b8a9e04 --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/this.txt @@ -0,0 +1,13 @@ +extern void object :: TEST22 ( ) +{ + show( position ); + show( this.position ); + + T(); +} + +public void object :: T22() +{ + show( position ); + show( this.position ); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/tt.txt b/src/CBot/tests/TestCBot/scenarios/tt.txt new file mode 100644 index 0000000..cd13c9d --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/tt.txt @@ -0,0 +1,12 @@ +extern public void T() { T1(); } + +public void T1() +{ + show( "T1" ); + T2(); +} + +public void T2() +{ + show( "T2" ); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/tt2.txt b/src/CBot/tests/TestCBot/scenarios/tt2.txt new file mode 100644 index 0000000..ad9dc1d --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/tt2.txt @@ -0,0 +1,5 @@ +extern public void TT() +{ + T1(); + T2(); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/scenarios/vide.txt b/src/CBot/tests/TestCBot/scenarios/vide.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/CBot/tests/TestCBot/scenarios/zz.txt b/src/CBot/tests/TestCBot/scenarios/zz.txt new file mode 100644 index 0000000..da764ac --- /dev/null +++ b/src/CBot/tests/TestCBot/scenarios/zz.txt @@ -0,0 +1,6 @@ +extern public void zz() +{ + MaClass TOTO (); + + show (TOTO); +} \ No newline at end of file diff --git a/src/CBot/tests/TestCBot/xTestCBot.clw b/src/CBot/tests/TestCBot/xTestCBot.clw new file mode 100644 index 0000000..5b84c16 --- /dev/null +++ b/src/CBot/tests/TestCBot/xTestCBot.clw @@ -0,0 +1,245 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CBotConsoleDlg +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "TestCBot.h" +LastPage=0 + +ClassCount=7 +Class1=CTestCBotApp +Class2=CTestCBotDoc +Class3=CTestCBotView +Class4=CMainFrame + +ResourceCount=7 +Resource1=IDD_ABOUTBOX +Resource2=IDR_MAINFRAME +Resource3=IDR_TESTCBTYPE +Class5=CAboutDlg +Class6=CChildFrame +Resource4=IDD_ABOUTBOX (French (France)) +Resource5=IDR_TESTCBTYPE (French (France)) +Resource6=IDD_CONSOLE +Class7=CBotConsoleDlg +Resource7=IDR_MAINFRAME (French (France)) + +[CLS:CTestCBotApp] +Type=0 +HeaderFile=TestCBot.h +ImplementationFile=TestCBot.cpp +Filter=N + +[CLS:CTestCBotDoc] +Type=0 +HeaderFile=TestCBotDoc.h +ImplementationFile=TestCBotDoc.cpp +Filter=N +BaseClass=CDocument +VirtualFilter=DC +LastObject=IDC_EDIT2 + +[CLS:CTestCBotView] +Type=0 +HeaderFile=TestCBotView.h +ImplementationFile=TestCBotView.cpp +Filter=C +BaseClass=CView +VirtualFilter=VWC +LastObject=CTestCBotView + +[CLS:CMainFrame] +Type=0 +HeaderFile=MainFrm.h +ImplementationFile=MainFrm.cpp +Filter=T +BaseClass=CMDIFrameWnd +VirtualFilter=fWC +LastObject=CMainFrame + + +[CLS:CChildFrame] +Type=0 +HeaderFile=ChildFrm.h +ImplementationFile=ChildFrm.cpp +Filter=M + +[CLS:CAboutDlg] +Type=0 +HeaderFile=TestCBot.cpp +ImplementationFile=TestCBot.cpp +Filter=D + +[DLG:IDD_ABOUTBOX] +Type=1 +ControlCount=4 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308352 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 +Class=CAboutDlg + +[MNU:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command4=ID_APP_EXIT +Command5=ID_VIEW_TOOLBAR +Command6=ID_VIEW_STATUS_BAR +Command7=ID_APP_ABOUT +CommandCount=7 +Command3=ID_FILE_MRU_FILE1 + +[TB:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_EDIT_CUT +Command5=ID_EDIT_COPY +Command6=ID_EDIT_PASTE +Command7=ID_FILE_PRINT +CommandCount=8 +Command8=ID_APP_ABOUT + +[MNU:IDR_TESTCBTYPE] +Type=1 +Class=CTestCBotView +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_CLOSE +Command4=ID_FILE_SAVE +Command5=ID_FILE_SAVE_AS +Command9=ID_EDIT_CUT +Command10=ID_EDIT_COPY +Command11=ID_EDIT_PASTE +Command12=ID_VIEW_TOOLBAR +Command13=ID_VIEW_STATUS_BAR +Command14=ID_WINDOW_NEW +CommandCount=18 +Command6=ID_FILE_MRU_FILE1 +Command7=ID_APP_EXIT +Command8=ID_EDIT_UNDO +Command15=ID_WINDOW_CASCADE +Command16=ID_WINDOW_TILE_HORZ +Command17=ID_WINDOW_ARRANGE +Command18=ID_APP_ABOUT + +[ACL:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command5=ID_EDIT_CUT +Command6=ID_EDIT_COPY +Command7=ID_EDIT_PASTE +Command8=ID_EDIT_UNDO +Command9=ID_EDIT_CUT +Command10=ID_EDIT_COPY +Command11=ID_EDIT_PASTE +Command12=ID_NEXT_PANE +CommandCount=13 +Command4=ID_EDIT_UNDO +Command13=ID_PREV_PANE + + +[TB:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_EDIT_CUT +Command5=ID_EDIT_COPY +Command6=ID_EDIT_PASTE +Command7=ID_FILE_PRINT +Command8=ID_RUN +Command9=ID_APP_ABOUT +CommandCount=9 + +[MNU:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_MRU_FILE1 +Command4=ID_APP_EXIT +Command5=ID_VIEW_TOOLBAR +Command6=ID_VIEW_STATUS_BAR +Command7=ID_APP_ABOUT +CommandCount=7 + +[MNU:IDR_TESTCBTYPE (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_CLOSE +Command4=ID_FILE_SAVE +Command5=ID_FILE_SAVE_AS +Command6=ID_FILE_MRU_FILE1 +Command7=ID_APP_EXIT +Command8=ID_EDIT_UNDO +Command9=ID_EDIT_CUT +Command10=ID_EDIT_COPY +Command11=ID_EDIT_PASTE +Command12=ID_VIEW_TOOLBAR +Command13=ID_VIEW_STATUS_BAR +Command14=ID_WINDOW_NEW +Command15=ID_WINDOW_CASCADE +Command16=ID_WINDOW_TILE_HORZ +Command17=ID_WINDOW_ARRANGE +Command18=ID_APP_ABOUT +CommandCount=18 + +[ACL:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_EDIT_COPY +Command2=ID_FILE_NEW +Command3=ID_FILE_OPEN +Command4=ID_FILE_SAVE +Command5=ID_EDIT_PASTE +Command6=ID_EDIT_UNDO +Command7=ID_EDIT_CUT +Command8=ID_RUN +Command9=ID_NEXT_PANE +Command10=ID_PREV_PANE +Command11=ID_RUN +Command12=ID_EDIT_COPY +Command13=ID_EDIT_PASTE +Command14=ID_EDIT_CUT +Command15=ID_EDIT_UNDO +CommandCount=15 + +[DLG:IDD_ABOUTBOX (French (France))] +Type=1 +Class=CAboutDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 + +[DLG:IDD_CONSOLE] +Type=1 +Class=CBotConsoleDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT2,edit,1350631552 +Control3=IDOK,button,1342242817 +Control4=IDC_EDIT1,edit,1352734724 + +[CLS:CBotConsoleDlg] +Type=0 +HeaderFile=CBotConsoleDlg.h +ImplementationFile=CBotConsoleDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC + diff --git a/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp b/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp new file mode 100644 index 0000000..077f080 --- /dev/null +++ b/src/CBot/tests/old TstCBot/BotConsoleDlg.cpp @@ -0,0 +1,164 @@ +// BotConsoleDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "TstCBot.h" +#include "BotConsoleDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg dialog + + +CBotConsoleDlg::CBotConsoleDlg(CWnd* pParent /*=NULL*/) + : CDialog(CBotConsoleDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CBotConsoleDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + m_pProg = NULL; + m_threadinfo.m_bRun = FALSE; +} + + +void CBotConsoleDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CBotConsoleDlg) + DDX_Control(pDX, IDOK, m_cOK); + DDX_Control(pDX, IDC_EDIT2, m_Edit2); + DDX_Control(pDX, IDC_EDIT1, m_Edit1); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CBotConsoleDlg, CDialog) + //{{AFX_MSG_MAP(CBotConsoleDlg) + ON_MESSAGE(WM_ENDPROG, EndProg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg message handlers + +UINT ThreadProc(ThreadInfo *info) +{ + CTime t0 = CTime::GetCurrentTime(); + int Cpt = 0; + + info->m_pProg->Start("LaCommande"); + while ( !info->m_bStop && !info->m_pProg->Run() ) + { + Cpt++; + if ( Cpt%20 == 0 ) info->m_pEdit1->ReplaceSel("."); + } + + if ( info->m_bStop ) + { + info->m_pEdit1->ReplaceSel("\r\nInterrompu\r\n"); + } + else if (info->m_pProg->GivError() == 0) + { + CTime t = CTime::GetCurrentTime(); + CTimeSpan ts = t - t0; + + char buffer[200]; + sprintf( buffer, "\r\nExécution terminée en %d secondes.\r\nInterrompue %d fois.\r\n", + ts.GetTotalSeconds(), Cpt); + + info->m_pEdit1->ReplaceSel(buffer); + } + + info->m_pWndMessage->SendMessage(WM_ENDPROG, 0, 0) ; + return 0 ; +} + +LONG CBotConsoleDlg::EndProg(UINT wparam, LONG lparam) +{ + m_threadinfo.m_bRun = FALSE; + + if (m_pProg->GetError(m_code, m_start, m_end)) + { + AfxMessageBox(m_code); + CDialog::OnCancel(); + return 1; + } + delete m_pProg; + m_pProg = NULL; + + m_Edit2.EnableWindow(TRUE); + m_cOK.EnableWindow(TRUE); + + m_Edit2.SetWindowText(""); + m_Edit2.SetFocus(); + return 0 ; +} + +void CBotConsoleDlg::OnOK() +{ + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + pApp->m_pConsole = &m_Edit1; + + CString Commande; + m_Edit2.GetWindowText(Commande); + + CString s = "void LaCommande() { " + Commande + " ;}"; + m_pProg = new CBotProgram(); + CBotStringArray liste; + m_pProg->Compile(s, liste); + int err, start, end; + if ( m_pProg->GetError(err, start, end) ) + { + AfxMessageBox(err); + m_Edit2.SetSel(start-20, end-20); + return; + } + + m_Edit1.ReplaceSel(Commande + " ->\r\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_pProg = m_pProg; + m_threadinfo.m_bStop = FALSE; + m_threadinfo.m_bRun = TRUE; + + AfxBeginThread((AFX_THREADPROC)ThreadProc, &m_threadinfo) ; +} + +void CBotConsoleDlg::OnCancel() +{ + if (!m_threadinfo.m_bRun) CDialog::OnCancel(); + m_threadinfo.m_bStop = TRUE ; +} + + +BOOL CBotConsoleDlg::OnInitDialog() +{ + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + + CDialog::OnInitDialog(); + + m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n"); + for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ ) + { + CBotString x = CString(pApp->m_Liste[i]) + "\r\n"; + m_Edit1.ReplaceSel(x); + } + m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n"); + + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/CBot/tests/old TstCBot/BotConsoleDlg.h b/src/CBot/tests/old TstCBot/BotConsoleDlg.h new file mode 100644 index 0000000..9b54ff2 --- /dev/null +++ b/src/CBot/tests/old TstCBot/BotConsoleDlg.h @@ -0,0 +1,65 @@ +#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) +#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// BotConsoleDlg.h : header file +// + +struct ThreadInfo +{ + CEdit* m_pEdit1 ; + CBotProgram* m_pProg; + CWnd* m_pWndMessage; + BOOL m_bStop; + BOOL m_bRun; +}; + + +///////////////////////////////////////////////////////////////////////////// +// CBotConsoleDlg dialog + +class CBotConsoleDlg : public CDialog +{ +// Construction +public: + CBotConsoleDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CBotConsoleDlg) + enum { IDD = IDD_CONSOLE }; + CButton m_cOK; + CEdit m_Edit2; + CEdit m_Edit1; + //}}AFX_DATA + + CBotProgram* m_pProg; + ThreadInfo m_threadinfo; + + int m_code, m_start, m_end; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBotConsoleDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CBotConsoleDlg) + virtual void OnOK(); + virtual void OnCancel(); + virtual BOOL OnInitDialog(); + afx_msg LONG EndProg(UINT wparam, LONG lparam) ; + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/BotErrorDlg.cpp b/src/CBot/tests/old TstCBot/BotErrorDlg.cpp new file mode 100644 index 0000000..87d56f0 --- /dev/null +++ b/src/CBot/tests/old TstCBot/BotErrorDlg.cpp @@ -0,0 +1,56 @@ +// BotErrorDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "TstCBot.h" +#include "BotErrorDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBotErrorDlg dialog + + +CBotErrorDlg::CBotErrorDlg(CWnd* pParent /*=NULL*/) + : CDialog(CBotErrorDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CBotErrorDlg) + m_TextProgram = _T(""); + //}}AFX_DATA_INIT +} + + +void CBotErrorDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CBotErrorDlg) + DDX_Control(pDX, IDC_EDIT1, m_eProgram); + DDX_Control(pDX, IDC_STATIC1, m_sMessage); + DDX_Text(pDX, IDC_EDIT1, m_TextProgram); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CBotErrorDlg, CDialog) + //{{AFX_MSG_MAP(CBotErrorDlg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBotErrorDlg message handlers + +BOOL CBotErrorDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_sMessage.SetWindowText(m_TextError); + m_eProgram.SetFocus(); + m_eProgram.SetSel(m_start, m_end); + + return FALSE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/CBot/tests/old TstCBot/BotErrorDlg.h b/src/CBot/tests/old TstCBot/BotErrorDlg.h new file mode 100644 index 0000000..522afad --- /dev/null +++ b/src/CBot/tests/old TstCBot/BotErrorDlg.h @@ -0,0 +1,51 @@ +#if !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_) +#define AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// BotErrorDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CBotErrorDlg dialog + +class CBotErrorDlg : public CDialog +{ +// Construction +public: + CBotErrorDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CBotErrorDlg) + enum { IDD = IDD_DIALOG1 }; + CEdit m_eProgram; + CStatic m_sMessage; + CString m_TextProgram; + //}}AFX_DATA + + + CString m_TextError; + int m_start, m_end; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBotErrorDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CBotErrorDlg) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BOTERRORDLG_H__80E73D20_7454_11D4_A439_00D059085115__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/CBotTest.txt b/src/CBot/tests/old TstCBot/CBotTest.txt new file mode 100644 index 0000000..ce20e26 --- /dev/null +++ b/src/CBot/tests/old TstCBot/CBotTest.txt @@ -0,0 +1,36 @@ + +extern void TheTest() +{ + for (int x = 130; x>0; x--) print (x); +} + +extern void Test() +{ + int var = 10000 ; + while (var > 0) var = var -1; +} +// exécuté en 30 secondes + +extern void Autre() +{ + int var = 10000 ; + while (var > 0) if ( var > 0 ) var = var -1; +} +// exécuté en 45 secondes + +int Y ( int n ) +{ + if ( n < 2 ) return n; + int a = Y(n-1) + Y(n-2); + return a; +} + +extern int X ( int n ) +{ + if ( n < 2 ) { print(n); return n; } + int a = X(n-1) + Y(n-2); + print (a); + return a; +} + + diff --git a/src/CBot/tests/old TstCBot/CMyThread.cpp b/src/CBot/tests/old TstCBot/CMyThread.cpp new file mode 100644 index 0000000..ca92c77 --- /dev/null +++ b/src/CBot/tests/old TstCBot/CMyThread.cpp @@ -0,0 +1,107 @@ +// CMyThread.cpp : pour créer un processus pour la console +// + +#include "stdafx.h" +#include "TstCBot.h" +#include "CMyThread.h" +#include "BotConsoleDlg.h" + + +//IMPLEMENT_DYNAMIC (CMyThread, CWinThread) +IMPLEMENT_DYNCREATE (CMyThread, CWinThread) + +///////////////////////////////////////////////////////////////////////////// +// CMyThread + +BEGIN_MESSAGE_MAP(CMyThread, CWinThread) + //{{AFX_MSG_MAP(CMyThread) + //}}AFX_MSG_MAP + // Standard file based document commands +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMyThread construction + +CMyThread::CMyThread() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +///////////////////////////////////////////////////////////////////////////// +// CMyThread initialization +/* +BOOL CMyThread::InitInstance() +{ + AfxEnableControlContainer(); + + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + + // ouvre une fenêtre pour afficher les sorties + CRect rect; + AfxGetMainWnd()->GetClientRect( rect ); + rect += CPoint(30,30); + + CWnd* pWnd = new CWnd(); + pWnd->CreateEx( 0, + AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), + "CBot console", WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE, + rect, + AfxGetMainWnd()->GetParent(), NULL, NULL); + m_pMainWnd = pWnd; + + pApp->m_pEdit2 = new CEdit(); + + m_pMainWnd->GetClientRect( rect ); + rect.bottom -= 40; + pApp->m_pEdit2->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN| + ES_AUTOVSCROLL|ES_READONLY, + rect, m_pMainWnd, IDC_EDIT2 ); + + pApp->m_pEdit2->ReplaceSel("Les fonctions suivantes sont disponibles:\n\r"); + for ( int i = 0; i < pApp->m_Liste.RetSize(); i++ ) + { + pApp->m_pEdit2->ReplaceSel(pApp->m_Liste[i] + "\r\n"); + } + pApp->m_pEdit2->ReplaceSel("Entrez une commande ci-dessous.\r\r"); + + +// pApp->m_pEdit2->SetFocus(); + + pApp->m_pEdit3 = new CEdit(); + m_pMainWnd->GetClientRect( rect ); + rect.top = rect.bottom-40; + pApp->m_pEdit3->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP, + rect, m_pMainWnd, IDC_EDIT1 ); + pApp->m_pEdit3->SetFocus(); + + return TRUE; +}*/ + +BOOL CMyThread::InitInstance() +{ + CBotConsoleDlg dlg; + m_pMainWnd = &dlg; // cela ferme l'application avec la DBOX ! + + int nResponse = dlg.DoModal(); + + return TRUE; +} + + +int CMyThread::ExitInstance() +{ + return 0; +} + + +///////////////////////////////////////////////////////////////////////////// +// CMyThread message handlers + + +void CMyThread::OnReturn() +{ + // TODO: Add your command handler code here + __asm int 3; +} diff --git a/src/CBot/tests/old TstCBot/CMyThread.h b/src/CBot/tests/old TstCBot/CMyThread.h new file mode 100644 index 0000000..1134077 --- /dev/null +++ b/src/CBot/tests/old TstCBot/CMyThread.h @@ -0,0 +1,44 @@ +// CMyThread.h : pour créer un processus pour la console +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + + +#include "stdafx.h" +#include "TstCBot.h" + +class CMyThread : public CWinThread +{ +// DECLARE_DYNAMIC(CMyThread) + DECLARE_DYNCREATE(CMyThread) + +public: + + +// Constructor + CMyThread(); + virtual BOOL InitInstance(); + virtual int ExitInstance(); // return app exit code + +// Implementation + + //{{AFX_MSG(CTstCBotApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg void OnReturn(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__20B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/MainFrm.cpp b/src/CBot/tests/old TstCBot/MainFrm.cpp new file mode 100644 index 0000000..6c0962c --- /dev/null +++ b/src/CBot/tests/old TstCBot/MainFrm.cpp @@ -0,0 +1,91 @@ +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "TstCBot.h" + +#include "MainFrm.h" +#include "BotErrorDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here + +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CFrameWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + + diff --git a/src/CBot/tests/old TstCBot/MainFrm.h b/src/CBot/tests/old TstCBot/MainFrm.h new file mode 100644 index 0000000..56b9c41 --- /dev/null +++ b/src/CBot/tests/old TstCBot/MainFrm.h @@ -0,0 +1,55 @@ +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CMainFrame : public CFrameWnd +{ +protected: // create from serialization only + CMainFrame(); + DECLARE_DYNCREATE(CMainFrame) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnCp1(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__70B3756C_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/ReadMe.txt b/src/CBot/tests/old TstCBot/ReadMe.txt new file mode 100644 index 0000000..67dc05b --- /dev/null +++ b/src/CBot/tests/old TstCBot/ReadMe.txt @@ -0,0 +1,93 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : TstCBot +======================================================================== + + +AppWizard has created this TstCBot application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your TstCBot application. + +TstCBot.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CTstCBotApp application class. + +TstCBot.cpp + This is the main application source file that contains the application + class CTstCBotApp. + +TstCBot.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Developer Studio. + +res\TstCBot.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file TstCBot.rc. + +res\TstCBot.rc2 + This file contains resources that are not edited by Microsoft + Developer Studio. You should place all resources not + editable by the resource editor in this file. + +TstCBot.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CFrameWnd and controls all SDI frame features. + + +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one document type and one view: + +TstCBotDoc.h, TstCBotDoc.cpp - the document + These files contain your CTstCBotDoc class. Edit these files to + add your special document data and to implement file saving and loading + (via CTstCBotDoc::Serialize). + +TstCBotView.h, TstCBotView.cpp - the view of the document + These files contain your CTstCBotView class. + CTstCBotView objects are used to view CTstCBotDoc objects. + + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TstCBot.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Developer Studio reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC40XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC40DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/tests/old TstCBot/Resource.h b/src/CBot/tests/old TstCBot/Resource.h new file mode 100644 index 0000000..6863fd8 --- /dev/null +++ b/src/CBot/tests/old TstCBot/Resource.h @@ -0,0 +1,68 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by TstCBot.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_TSTCBOTYPE 129 +#define IDD_DIALOG1 130 +#define IDD_CONSOLE 131 +#define IDC_EDIT1 1000 +#define TX_TYPENAMES 1000 +#define IDC_STATIC1 1001 +#define IDC_EDIT2 1002 +#define TX_OPENPAR 5000 +#define TX_CLOSEPAR 5001 +#define TX_NOTBOOL 5002 +#define TX_UNDEFVAR 5003 +#define TX_BADLEFT 5004 +#define TX_ENDOF 5005 +#define TX_OUTCASE 5006 +#define TX_NOTERM 5007 +#define TX_CLOSEBLK 5008 +#define TX_ELSEWITHOUTIF 5009 +#define TX_OPENBLK 5010 +#define TX_BADTYPE 5011 +#define TX_REDEFVAR 5012 +#define TX_BAD2TYPE 5013 +#define TX_UNDEFCALL 5014 +#define TX_MISDOTS 5015 +#define TX_WHILE 5016 +#define TX_BREAK 5017 +#define TX_LABEL 5018 +#define TX_NOLABEL 5019 +#define TX_NOCASE 5020 +#define TX_BADNUM 5021 +#define TX_VOID 5022 +#define TX_NOTYP 5023 +#define TX_NOVAR 5024 +#define TX_NOFONC 5025 +#define TX_OVERPARAM 5026 +#define TX_REDEF 5027 +#define TX_LOWPARAM 5028 +#define TX_BADPARAM 5029 +#define TX_NUMPARAM 5030 +#define TX_NOITEM 5031 +#define TX_DOT 5032 +#define TX_NOCONST 5033 +#define TX_REDEFCLASS 5034 +#define TX_DIVZERO 6000 +#define TX_NOTINIT 6001 +#define TX_BADTHROW 6002 +#define TX_NORETVAL 6003 +#define TX_NORUN 6004 +#define TX_NOCALL 6005 +#define ID_CP1 32771 +#define ID_EXE 32772 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 132 +#define _APS_NEXT_COMMAND_VALUE 32775 +#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/CBot/tests/old TstCBot/StdAfx.cpp b/src/CBot/tests/old TstCBot/StdAfx.cpp new file mode 100644 index 0000000..ae0ec93 --- /dev/null +++ b/src/CBot/tests/old TstCBot/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// TstCBot.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/src/CBot/tests/old TstCBot/StdAfx.h b/src/CBot/tests/old TstCBot/StdAfx.h new file mode 100644 index 0000000..7d46ace --- /dev/null +++ b/src/CBot/tests/old TstCBot/StdAfx.h @@ -0,0 +1,26 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__70B3756A_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/TstCBot.clw b/src/CBot/tests/old TstCBot/TstCBot.clw new file mode 100644 index 0000000..4c54168 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBot.clw @@ -0,0 +1,189 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CTstCBotView +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "TstCBot.h" +LastPage=0 + +ClassCount=7 +Class1=CTstCBotApp +Class2=CTstCBotDoc +Class3=CTstCBotView +Class4=CMainFrame + +ResourceCount=6 +Resource1=IDD_ABOUTBOX +Resource2=IDR_MAINFRAME +Class5=CAboutDlg +Resource3=IDD_ABOUTBOX (French (France)) +Resource4=IDD_CONSOLE +Class6=CBotErrorDlg +Resource5=IDD_DIALOG1 (French (Switzerland)) +Class7=CBotConsoleDlg +Resource6=IDR_MAINFRAME (French (France)) + +[CLS:CTstCBotApp] +Type=0 +HeaderFile=TstCBot.h +ImplementationFile=TstCBot.cpp +Filter=N + +[CLS:CTstCBotDoc] +Type=0 +HeaderFile=TstCBotDoc.h +ImplementationFile=TstCBotDoc.cpp +Filter=N +BaseClass=CDocument +VirtualFilter=DC +LastObject=CTstCBotDoc + +[CLS:CTstCBotView] +Type=0 +HeaderFile=TstCBotView.h +ImplementationFile=TstCBotView.cpp +Filter=C +BaseClass=CView +VirtualFilter=VWC +LastObject=CTstCBotView + +[CLS:CMainFrame] +Type=0 +HeaderFile=MainFrm.h +ImplementationFile=MainFrm.cpp +Filter=T +BaseClass=CFrameWnd +VirtualFilter=fWC +LastObject=CMainFrame + + + +[CLS:CAboutDlg] +Type=0 +HeaderFile=TstCBot.cpp +ImplementationFile=TstCBot.cpp +Filter=D + +[DLG:IDD_ABOUTBOX] +Type=1 +Class=CAboutDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 + +[MNU:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_FILE_SAVE_AS +Command5=ID_FILE_MRU_FILE1 +Command6=ID_APP_EXIT +Command7=ID_EDIT_UNDO +Command8=ID_EDIT_CUT +Command9=ID_EDIT_COPY +Command10=ID_EDIT_PASTE +Command11=ID_VIEW_STATUS_BAR +Command12=ID_CP1 +Command13=ID_EXE +Command14=ID_APP_ABOUT +CommandCount=14 + +[ACL:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_CP1 +Command2=ID_FILE_NEW +Command3=ID_FILE_OPEN +Command4=ID_FILE_SAVE +Command5=ID_EXE +Command6=ID_EDIT_UNDO +Command7=ID_EDIT_CUT +Command8=ID_EXE +Command9=ID_CP1 +Command10=ID_EXE +CommandCount=10 + +[MNU:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_FILE_SAVE_AS +Command5=ID_FILE_MRU_FILE1 +Command6=ID_APP_EXIT +Command7=ID_EDIT_UNDO +Command8=ID_EDIT_CUT +Command9=ID_EDIT_COPY +Command10=ID_EDIT_PASTE +Command11=ID_VIEW_STATUS_BAR +Command12=ID_CP1 +Command13=ID_EXE +Command14=ID_APP_ABOUT +CommandCount=14 + +[ACL:IDR_MAINFRAME (French (France))] +Type=1 +Class=? +Command1=ID_CP1 +Command2=ID_FILE_NEW +Command3=ID_FILE_OPEN +Command4=ID_FILE_SAVE +Command5=ID_EXE +Command6=ID_EDIT_UNDO +Command7=ID_EDIT_CUT +Command8=ID_EXE +Command9=ID_CP1 +Command10=ID_EXE +CommandCount=10 + +[DLG:IDD_ABOUTBOX (French (France))] +Type=1 +Class=CAboutDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 + +[CLS:CBotErrorDlg] +Type=0 +HeaderFile=BotErrorDlg.h +ImplementationFile=BotErrorDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=CBotErrorDlg + +[DLG:IDD_DIALOG1 (French (Switzerland))] +Type=1 +ControlCount=4 +Control1=IDOK,button,1342242817 +Control2=IDC_EDIT1,edit,1352728708 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_STATIC1,static,1342308352 + +[DLG:IDD_CONSOLE] +Type=1 +Class=CBotConsoleDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_EDIT2,edit,1350631552 +Control3=IDOK,button,1342242817 +Control4=IDC_EDIT1,edit,1352734724 + +[CLS:CBotConsoleDlg] +Type=0 +HeaderFile=BotConsoleDlg.h +ImplementationFile=BotConsoleDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=IDOK + diff --git a/src/CBot/tests/old TstCBot/TstCBot.cpp b/src/CBot/tests/old TstCBot/TstCBot.cpp new file mode 100644 index 0000000..8ac4557 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBot.cpp @@ -0,0 +1,412 @@ +// TstCBot.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "TstCBot.h" + +#include "MainFrm.h" +#include "TstCBotDoc.h" +#include "TstCBotView.h" +#include "CMyThread.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +//////////////////////////////////////////////////////////////////// +// routine show() +// utilisable depuis le programme écrit en CBot + +// exécution +BOOL rShow( CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + CString s; + + if ( pVar == NULL ) + { + Exception = 22; return FALSE; + } + + while ( pVar != NULL ) + { + CString ss; + ss.LoadString( TX_TYPENAMES + pVar->RetType() ); + s += ss + " "; + + ss = pVar->RetName(); + if (ss.IsEmpty()) ss = ""; + s += ss + " = "; + + s += pVar->RetValString(); + s += "\n"; + pVar = pVar->RetNext(); + } + + AfxMessageBox(s, MB_OK|MB_ICONINFORMATION); + +// if ( pResult && pResult->RetType() == CBotTypInt) pResult->SetValInt(123); + + return TRUE; // pas d'interruption +} + +int cShow( CBotVar* &pVar, CBotString& RetClass) +{ + if ( pVar == NULL ) return 22; + return CBotTypInt; // tous paramètres acceptés, un entier en retour +} + +int cErr( CBotVar* &pVar, CBotString& RetClass) +{ + pVar = pVar->RetNext(); // avance le pointeur sur l'erreur + return 6666; +} + +//////////////////////////////////////////////////////////////////// +// routine print() +// utilisable depuis le programme écrit en CBot + +// exécution +BOOL rPrintLn( CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + CString s; + + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + CEdit* pEdit = pApp->m_pConsole; + + if (pEdit == NULL) return TRUE; + pEdit->GetWindowText(s); + + while ( pVar != NULL ) + { + if ( !s.IsEmpty() ) s += "\r\n"; + s += pVar->RetValString(); + pVar = pVar->RetNext(); + } + + pEdit->SetWindowText(s); + pEdit->SetSel(s.GetLength(), s.GetLength()); + pEdit->SetFocus(); + return TRUE; // pas d'interruption +} + +BOOL rPrint( CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + CString s; + + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + CEdit* pEdit = pApp->m_pConsole; + + if (pEdit == NULL) return TRUE; + pEdit->GetWindowText(s); + + while ( pVar != NULL ) + { + if ( !s.IsEmpty() ) s += " "; + s += pVar->RetValString(); + pVar = pVar->RetNext(); + } + + pEdit->SetWindowText(s); + pEdit->SetSel(s.GetLength(), s.GetLength()); + pEdit->SetFocus(); + return TRUE; // pas d'interruption +} + +int cPrint( CBotVar* &pVar, CBotString& RetClass) +{ + return 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 ) +{ + CString s; + + if ( pVar == NULL )return TRUE; // constructeur sans paramètres est ok + + if ( pVar->RetType() > CBotTypDouble ) + { + Exception = 6023; return FALSE; + } + + CBotVar* pX = pThis->RetItem("x"); + if ( pX == NULL ) + { + Exception = 6024; return FALSE; + } + + pX->SetValFloat( pVar->RetValFloat() ); + pVar = pVar->RetNext(); + + if ( pVar == NULL ) + { + Exception = 6022; return FALSE; + } + + if ( pVar->RetType() > CBotTypDouble ) + { + Exception = 6023; return FALSE; + } + + CBotVar* pY = pThis->RetItem("y"); + if ( pY == NULL ) + { + Exception = 6024; return FALSE; + } + + pY->SetValFloat( pVar->RetValFloat() ); + pVar = pVar->RetNext(); + + if ( pVar != NULL ) + { + Exception = 6025; return FALSE; + } + + return TRUE; // pas d'interruption +} + +int cCPoint( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass) +{ + // l'objet doit être de la classe CPoint + if ( !pThis->IsElemOfClass("CPoint") ) return 6021; + + // ok si aucun paramètres ! + if ( pVar == NULL ) return 0; + + // paramètre de type numérique svp + if ( pVar->RetType() > CBotTypDouble ) return 6023; + pVar = pVar->RetNext(); + + // il doit y avoir un second paramètre + if ( pVar == NULL ) return 6022; + // également de type numérique + if ( pVar->RetType() > CBotTypDouble )return 6023; + pVar = pVar->RetNext(); + + // et pas plus de 2 paramètres svp + if ( pVar != NULL ) return 6025; + + return 0; // cette fonction retourne void +} + +// méthode déterminant l'opposé +BOOL rOppose( CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception ) +{ + CString s; + + if ( pVar != NULL ) // pas de paramètre + { + Exception = 6025; return FALSE; + } + + CBotVar* pvar = pThis->RetItemList(); // demande la chaîne des items + + // tous les paramètres sont des nombres + while (pvar != NULL) + { + pvar->SetValFloat( -pvar->RetValFloat() ); + pvar = pvar->RetNext(); + } + + pResult->Copy(pThis); + return TRUE; // pas d'interruption +} + +int cOppose( CBotVar* pThis, CBotVar* &pVar, CBotString& RetClass) +{ + // l'objet doit être de la classe CPoint + if ( !pThis->IsElemOfClass("CPoint") ) return 6021; + + RetClass = "CPoint"; // l'objet rendu est de cette class + + // ok si aucun paramètres ! + if ( pVar == NULL ) return CBotTypClass; // le paramètre retourné est une instance de la classe + + return TX_OVERPARAM; // ça va pas +} + + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotApp + +BEGIN_MESSAGE_MAP(CTstCBotApp, CWinApp) + //{{AFX_MSG_MAP(CTstCBotApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotApp construction + +CTstCBotApp::CTstCBotApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CTstCBotApp object + +CTstCBotApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotApp initialization + +BOOL CTstCBotApp::InitInstance() +{ + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + // You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CTstCBotDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CTstCBotView)); + AddDocTemplate(pDocTemplate); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The one and only window has been initialized, so show and update it. + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->UpdateWindow(); + + + +/////////////////////////////////// +// défini la fonction "show()" +// -------------------------------- + + CBotProgram::AddFunction("show", rShow, cShow); + CBotProgram::AddFunction("err", rShow, cErr); + CBotProgram::AddFunction("print", rPrint, cPrint); + CBotProgram::AddFunction("println", rPrintLn, cPrint); + + +/////////////////////////////////// +// définie la classe globale CPoint +// -------------------------------- + + CBotClass* m_pClassPoint; + + 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); + // ajoute la méthode Opposé + m_pClassPoint->AddFunction("Opposé", rOppose, cOppose); + + +////////////////////////////////////////////////////////////////// +// compile un bout de programme pour voir s'il est bien accessible +// depuis un autre "module" + + CBotProgram* p = new CBotProgram; + CBotStringArray Liste; + p->Compile(" public void MonProgram( ) { show (\"mon programme\") ;}", Liste ); + + // l'objet n'est pas détruit et plus référencé + // je sais c'est pas bien + + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CTstCBotApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotApp commands diff --git a/src/CBot/tests/old TstCBot/TstCBot.dsp b/src/CBot/tests/old TstCBot/TstCBot.dsp new file mode 100644 index 0000000..35e5c0b --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBot.dsp @@ -0,0 +1,180 @@ +# Microsoft Developer Studio Project File - Name="TstCBot" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=TstCBot - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TstCBot.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TstCBot.mak" CFG="TstCBot - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TstCBot - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "TstCBot - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TstCBot - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "TstCBot - Win32 Release" +# Name "TstCBot - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\BotConsoleDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TstCBot.cpp +# End Source File +# Begin Source File + +SOURCE=.\TstCBot.rc + +!IF "$(CFG)" == "TstCBot - Win32 Release" + +!ELSEIF "$(CFG)" == "TstCBot - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\TstCBotDoc.cpp +# End Source File +# Begin Source File + +SOURCE=.\TstCBotView.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\BotConsoleDlg.h +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TstCBot.h +# End Source File +# Begin Source File + +SOURCE=.\TstCBotDoc.h +# End Source File +# Begin Source File + +SOURCE=.\TstCBotView.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\TstCBot.ico +# End Source File +# Begin Source File + +SOURCE=.\res\TstCBot.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\TstCBotDoc.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/src/CBot/tests/old TstCBot/TstCBot.h b/src/CBot/tests/old TstCBot/TstCBot.h new file mode 100644 index 0000000..616db43 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBot.h @@ -0,0 +1,62 @@ +// TstCBot.h : main header file for the TSTCBOT application +// + +#if !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols +#include "..\CBotDll.h" + + +class CMyThread; + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotApp: +// See TstCBot.cpp for the implementation of this class +// + +class CTstCBotApp : public CWinApp +{ +public: + CTstCBotApp(); + + CMyThread* m_pThread; + CWnd* m_pView; + CEdit* m_pConsole; + CBotStringArray m_Liste; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTstCBotApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CTstCBotApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TSTCBOT_H__70B37568_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) + +#define WM_STARTPROG WM_APP + 0 +#define WM_ENDPROG WM_APP + 1 diff --git a/src/CBot/tests/old TstCBot/TstCBot.rc b/src/CBot/tests/old TstCBot/TstCBot.rc new file mode 100644 index 0000000..9e91c76 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBot.rc @@ -0,0 +1,471 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 12, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\TstCBot.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""l.fra\\afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\TstCBot.ico" +IDR_TSTCBOTYPE ICON DISCARDABLE "res\\TstCBotDoc.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&Fichier" + BEGIN + MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW + MENUITEM "&Ouvrir...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE + MENUITEM "En®istrer sous...", ID_FILE_SAVE_AS + MENUITEM SEPARATOR + MENUITEM "Fichier récent", ID_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Quitter", ID_APP_EXIT + END + POPUP "&Edition" + BEGIN + MENUITEM "&Annuler\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "&Couper\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY + MENUITEM "C&oller\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Affichage" + BEGIN + MENUITEM "Barre d'é&tat", ID_VIEW_STATUS_BAR + END + POPUP "&Tests" + BEGIN + MENUITEM "&Compile\tAlt+C", ID_CP1 + MENUITEM "&Execute\tAlt+V", ID_EXE + END + POPUP "&?" + BEGIN + MENUITEM "&A propos de TstCBot...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "C", ID_CP1, VIRTKEY, ALT, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EXE, VIRTKEY, ALT, NOINVERT + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_F5, ID_EXE, VIRTKEY, NOINVERT + VK_F7, ID_CP1, VIRTKEY, NOINVERT + "X", ID_EXE, VIRTKEY, ALT, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "A propos de TstCBot" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "TstCBot version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 1900",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040C04B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Application MFC TstCBot\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TstCBot\0" + VALUE "LegalCopyright", "Copyright (C) 1900\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TstCBot.EXE\0" + VALUE "ProductName", "Application TstCBot\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Traduction", 0x40c, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "TstCBot\n\nTstCBo\n\n\nTstCBot.Document\nTstCBo Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "TstCBot" + AFX_IDS_IDLEMESSAGE "Prêt" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "MAJ" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "DEF" + ID_INDICATOR_OVR "ECR" + ID_INDICATOR_REC "ENR" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "Crée un nouveau document\nNouveau" + ID_FILE_OPEN "Ouvre un document existant\nOuvrir" + ID_FILE_CLOSE "Ferme le document actif\nFermer" + ID_FILE_SAVE "Enregistre le document actif\nEnregistrer" + ID_FILE_SAVE_AS "Enregistre le document actif sous un nouveau nom\nEnregistrer sous" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "Affiche des informations sur le programme, le numéro de version et le copyright\nA propos de" + ID_APP_EXIT "Ferme l'application ; propose d'enregistrer les documents\nQuitter" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "Ouvre ce document" + ID_FILE_MRU_FILE2 "Ouvre ce document" + ID_FILE_MRU_FILE3 "Ouvre ce document" + ID_FILE_MRU_FILE4 "Ouvre ce document" + ID_FILE_MRU_FILE5 "Ouvre ce document" + ID_FILE_MRU_FILE6 "Ouvre ce document" + ID_FILE_MRU_FILE7 "Ouvre ce document" + ID_FILE_MRU_FILE8 "Ouvre ce document" + ID_FILE_MRU_FILE9 "Ouvre ce document" + ID_FILE_MRU_FILE10 "Ouvre ce document" + ID_FILE_MRU_FILE11 "Ouvre ce document" + ID_FILE_MRU_FILE12 "Ouvre ce document" + ID_FILE_MRU_FILE13 "Ouvre ce document" + ID_FILE_MRU_FILE14 "Ouvre ce document" + ID_FILE_MRU_FILE15 "Ouvre ce document" + ID_FILE_MRU_FILE16 "Ouvre ce document" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "Passe au volet de fenêtre suivant\nVolet suivant" + ID_PREV_PANE "Revient au volet précédent\nVolet précédent" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_SPLIT "Fractionne la fenêtre active en deux volets\nFractionner" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "Efface la sélection\nEffacer" + ID_EDIT_CLEAR_ALL "Efface tout\nEffacer tout" + ID_EDIT_COPY "Copie la sélection et la place dans le Presse-papiers\nCopier" + ID_EDIT_CUT "Supprime la sélection et la place dans le Presse-papiers\nCopier" + ID_EDIT_FIND "Recherche le texte spécifié\nRechercher" + ID_EDIT_PASTE "Insère le contenu du Presse-papiers\nColler" + ID_EDIT_REPEAT "Répète la dernière action\nRépéter" + ID_EDIT_REPLACE "Remplace le texte spécifique par un texte différent\nRemplacer" + ID_EDIT_SELECT_ALL "Sélectionne le document entier\nSélectionner tout" + ID_EDIT_UNDO "Annule la dernière action\nAnnuler" + ID_EDIT_REDO "Rétablit l'action précédemment annulée\nRétablir" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_STATUS_BAR "Affiche ou masque la barre d'état\nBarre d'état" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "Change la taille de la fenêtre" + AFX_IDS_SCMOVE "Change la position de la fenêtre" + AFX_IDS_SCMINIMIZE "Réduit la fenêtre en icône" + AFX_IDS_SCMAXIMIZE "Agrandit la fenêtre au format de l'écran" + AFX_IDS_SCNEXTWINDOW "Passe à la fenêtre de document suivante" + AFX_IDS_SCPREVWINDOW "Passe à la fenêtre de document précédente" + AFX_IDS_SCCLOSE "Ferme la fenêtre active et propose l'enregistrement des documents" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "Restaure la fenêtre à sa taille d'origine" + AFX_IDS_SCTASKLIST "Active la liste des tâches" +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_TYPENAMES "les différents types" + 1001 "Byte" + 1002 "Short" + 1003 "Char" + 1004 "Int" + 1005 "Long" + 1006 "Real" + 1007 "Double" +END + +STRINGTABLE DISCARDABLE +BEGIN + 1008 "Boolean" + 1009 "Class" + 1010 "String" +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_OPENPAR "Il manque une parenthèse ouvrante." + TX_CLOSEPAR "Il manque une parenthèse fermante." + TX_NOTBOOL "L'expression doit être un boolean." + TX_UNDEFVAR "Variable non déclarée." + TX_BADLEFT "Assignation impossible." + TX_ENDOF "Instruction non terminée." + TX_OUTCASE "Instruction ""case"" hors d'un bloc ""switch""." + TX_NOTERM "Instructions après la fin." +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_CLOSEBLK "Il manque la fin du bloc." + TX_ELSEWITHOUTIF "Instruction ""else"" sans ""if"" correspondant." + TX_OPENBLK "Début d'un bloc attendu." + TX_BADTYPE "Mauvais type de résultat pour l'assignation." + TX_REDEFVAR "Redéfinition d'une variable." + TX_BAD2TYPE "Les deux opérandes ne sont pas de types compatibles." + TX_UNDEFCALL "Routine inconnue." + TX_MISDOTS "Séparateur "" : "" attendu." + TX_WHILE "Manque le mot ""while""." + TX_BREAK "Instruction ""break"" en dehors d'une boucle." + TX_LABEL "Un label ne peut se placer que devant un ""for"", un ""while"", un ""do"" ou un ""switch""." + TX_NOLABEL "Cette étiquette n'existe pas" + TX_NOCASE "Manque une instruction ""case""." + TX_BADNUM "Un nombre est attendu." + TX_VOID "Paramètre void." + TX_NOTYP "Déclaration de type attendu" +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_DIVZERO "Division par zéro." + TX_NOTINIT "Variable non initialisée." + TX_BADTHROW "Valeur négative refusée pour ""throw""." + TX_NORETVAL "La fonction n'a pas retourné de résultat" + TX_NORUN "Pas de fonction en exécution" + TX_NOCALL "Appel d'une fonction inexistante" +END + +STRINGTABLE DISCARDABLE +BEGIN + TX_NOVAR "Nom d'une variable attendu" + TX_NOFONC "Nom de la fonction attendu." + TX_OVERPARAM "Trop de paramètres" + TX_REDEF "Cette fonction existe déjà." + TX_LOWPARAM "Pas assez de paramètres" + TX_BADPARAM "Aucune fonction de ce nom n'accepte ce(s) type(s) de paramètre(s)" + TX_NUMPARAM "Aucune fonction de ce nom n'accepte ce nombre de paramètres" + TX_NOITEM "Cet élément n'exite pas dans cette classe." + TX_DOT "L'objet n'est pas une instance d'une classe." + TX_NOCONST "Il n'y a pas de constructeur approprié." + TX_REDEFCLASS "Cette classe existe déjà." +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// French (Switzerland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRS) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH_SWISS +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONSOLE DIALOG DISCARDABLE 0, 0, 401, 210 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "CBot Console" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Commande :",IDC_STATIC,7,177,40,8 + EDITTEXT IDC_EDIT2,7,189,329,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "Exécute",IDOK,344,189,50,14 + EDITTEXT IDC_EDIT1,7,7,387,167,ES_MULTILINE | ES_READONLY | + ES_WANTRETURN | WS_VSCROLL +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_CONSOLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 394 + TOPMARGIN, 7 + BOTTOMMARGIN, 203 + END +END +#endif // APSTUDIO_INVOKED + +#endif // French (Switzerland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE 12, 1 +#pragma code_page(1252) +#endif +#include "res\TstCBot.rc2" // non-Microsoft Visual C++ edited resources +#include "l.fra\afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/CBot/tests/old TstCBot/TstCBotDoc.cpp b/src/CBot/tests/old TstCBot/TstCBotDoc.cpp new file mode 100644 index 0000000..7d7e2ef --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBotDoc.cpp @@ -0,0 +1,83 @@ +// TstCBotDoc.cpp : implementation of the CTstCBotDoc class +// + +#include "stdafx.h" +#include "TstCBot.h" + +#include "TstCBotDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotDoc + +IMPLEMENT_DYNCREATE(CTstCBotDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTstCBotDoc, CDocument) + //{{AFX_MSG_MAP(CTstCBotDoc) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotDoc construction/destruction + +CTstCBotDoc::CTstCBotDoc() +{ + // TODO: add one-time construction code here + +} + +CTstCBotDoc::~CTstCBotDoc() +{ +} + +BOOL CTstCBotDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotDoc serialization + +void CTstCBotDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotDoc diagnostics + +#ifdef _DEBUG +void CTstCBotDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTstCBotDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotDoc commands + diff --git a/src/CBot/tests/old TstCBot/TstCBotDoc.h b/src/CBot/tests/old TstCBot/TstCBotDoc.h new file mode 100644 index 0000000..ae1d0f7 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBotDoc.h @@ -0,0 +1,55 @@ +// TstCBotDoc.h : interface of the CTstCBotDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + +class CTstCBotDoc : public CDocument +{ +protected: // create from serialization only + CTstCBotDoc(); + DECLARE_DYNCREATE(CTstCBotDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTstCBotDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTstCBotDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTstCBotDoc) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TSTCBOTDOC_H__70B3756E_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) diff --git a/src/CBot/tests/old TstCBot/TstCBotView.cpp b/src/CBot/tests/old TstCBot/TstCBotView.cpp new file mode 100644 index 0000000..3ee9094 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBotView.cpp @@ -0,0 +1,291 @@ +// TstCBotView.cpp : implementation of the CTstCBotView class +// + +#include "stdafx.h" +#include "TstCBot.h" + +#include "TstCBotDoc.h" +#include "TstCBotView.h" +#include "BotConsoleDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotView + +IMPLEMENT_DYNCREATE(CTstCBotView, CView) + +BEGIN_MESSAGE_MAP(CTstCBotView, CView) + //{{AFX_MSG_MAP(CTstCBotView) + ON_WM_SIZE() + ON_COMMAND(ID_CP1, OnCp1) + ON_COMMAND(ID_EXE, OnExe) + ON_COMMAND(ID_FILE_SAVE, OnFileSave) + ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotView construction/destruction + +CTstCBotView::CTstCBotView() +{ + // TODO: add construction code here + m_pEdit = NULL; + m_pProg = NULL; +} + +CTstCBotView::~CTstCBotView() +{ +} + +BOOL CTstCBotView::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +void CTstCBotView::OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView ) +{ + if ( m_pEdit == NULL) + { + m_pEdit = new CEdit(); + CRect rect; + GetClientRect( rect ); + + m_pEdit->Create( WS_VISIBLE|WS_BORDER|WS_TABSTOP|ES_MULTILINE|ES_WANTRETURN|ES_NOHIDESEL|ES_AUTOVSCROLL, + rect, this, IDC_EDIT1 ); + m_pEdit->SetTabStops(12); + LoadEdition("CBotTest.txt"); + m_pEdit->SetFocus(); + } +} + + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotView drawing + +void CTstCBotView::OnDraw(CDC* pDC) +{ + CTstCBotDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + + // TODO: add draw code for native data here +} + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotView diagnostics + +#ifdef _DEBUG +void CTstCBotView::AssertValid() const +{ + CView::AssertValid(); +} + +void CTstCBotView::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +CTstCBotDoc* CTstCBotView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTstCBotDoc))); + return (CTstCBotDoc*)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTstCBotView message handlers + +void CTstCBotView::OnSize(UINT nType, int cx, int cy) +{ + CView::OnSize(nType, cx, cy); + + if ( m_pEdit != NULL ) + { + CRect rect; + GetClientRect( rect ); + m_pEdit->MoveWindow( rect ); + m_pEdit->SetFocus(); + } +} + +void CTstCBotView::SaveEdition(const char* filename) +{ + CString program; + + m_pEdit->GetWindowText(program); + + FILE* pf = fopen(filename, "wb"); + if (pf==NULL) return; + + fputs (program, pf); + fclose(pf); +} + +void CTstCBotView::LoadEdition(const char* filename) +{ + CString program("{ int x = 10000; while (x > 0) x = x-1; }"); + + FILE* pf = fopen(filename, "r"); + if (pf!=NULL) + { + char buffer[10000]; + program.Empty(); + + while (NULL != fgets (buffer, 100000, pf)) + { + program += buffer; + program = program.Left(program.GetLength()-1) + "\r\n"; + } + + fclose(pf); + } + + m_pEdit->SetWindowText(program); +} + + + +// compile le programme +#include + +void CTstCBotView::OnCp1() +{ + CString program; + + SaveEdition("CBotTest.txt"); + + m_pEdit->GetWindowText(program); + + CString TextError; + int code, start, end; + + if ( m_pProg == NULL ) m_pProg = new CBotProgram(); + + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + + if (m_pProg->Compile(program, pApp->m_Liste)) + { + CString done = "Compilation sans erreur.\nLes fonctions suivantes sont externes:\n"; + + for ( int i = 0; i < pApp->m_Liste.RetSize(); i++) + { + done += CString(pApp->m_Liste[i]) + "\n"; + } + + AfxMessageBox( done ); + } + else + { + m_pProg->GetError(code, start, end); + delete m_pProg; + m_pProg = NULL; + + m_pEdit->SetSel( start, end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError.LoadString( code ); + if (TextError.IsEmpty()) + { + char buf[100]; + sprintf(buf, "Erreur numéro %d.", code); + TextError = buf; + } + AfxMessageBox( TextError ); + } + + m_pEdit->SetFocus(); +} + + +////////////////////////////////////////////////////// + + +void CTstCBotView::OnExe() +{ + CTstCBotApp* pApp = (CTstCBotApp*)AfxGetApp(); + + if( m_pProg == NULL) + { + AfxMessageBox("Pas de programme compilé !"); + return; + } + + if( pApp->m_Liste.RetSize() == 0 ) + { + AfxMessageBox("Aucune fonction marquée \"extern\" !"); + return; + } + + + + CBotConsoleDlg dlg; + dlg.DoModal(); // dialogue pour faire la console + + if ( dlg.m_code>0 ) + { + CString TextError; + + m_pEdit->SetSel( dlg.m_start, dlg.m_end ); + m_pEdit->SetFocus(); // met en évidence la partie avec problème + + TextError.LoadString( dlg.m_code ); + if (TextError.IsEmpty()) + { + char buf[100]; + sprintf(buf, "Erreur numéro %d.", dlg.m_code); + TextError = buf; + } +// AfxMessageBox( TextError ); + } + + m_pEdit->SetFocus(); + + return; +} + + + +void CTstCBotView::OnFileSave() +{ + // TODO: Add your command handler code here + SaveEdition("CBotTest.txt"); +} + +void CTstCBotView::OnFileSaveAs() +{ + CFileDialog *pDlg; + CString s; + + pDlg = new CFileDialog(FALSE, "TXT", NULL, + OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY, + "cboxtest|*.txt", this); + if ( pDlg == NULL ) return; + + if ( pDlg->DoModal() == IDOK ) // choix du fichier ... + { + SaveEdition(pDlg->GetPathName()); + } + + delete pDlg; +} + +#if 0 +void test() +{ + int y,z; + + for (;;); + for (x = 0; y = 1; z = 3) int q = 6; + for (int x = 0; int y = 1; int z = 3) int q = 6; + // pour voir +} +#endif + diff --git a/src/CBot/tests/old TstCBot/TstCBotView.h b/src/CBot/tests/old TstCBot/TstCBotView.h new file mode 100644 index 0000000..d5aede5 --- /dev/null +++ b/src/CBot/tests/old TstCBot/TstCBotView.h @@ -0,0 +1,81 @@ +// TstCBotView.h : interface of the CTstCBotView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) +#define AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + +class CBotProgram; +class CBotClass; + + +class CTstCBotView : public CView +{ +protected: // create from serialization only + CTstCBotView(); + DECLARE_DYNCREATE(CTstCBotView) + + CEdit* m_pEdit; // texte en édition + CWnd* m_pWnd; + CBotProgram* m_pProg; // programme compilé + +// Attributes +public: + CTstCBotDoc* GetDocument(); + +// Operations +public: + void LoadEdition(const char* name); + void SaveEdition(const char* name); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTstCBotView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView ); + protected: + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTstCBotView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTstCBotView) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnCp1(); + afx_msg void OnExe(); + afx_msg void OnFileSave(); + afx_msg void OnFileSaveAs(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in TstCBotView.cpp +inline CTstCBotDoc* CTstCBotView::GetDocument() + { return (CTstCBotDoc*)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TSTCBOTVIEW_H__70B37570_5DFD_11D4_A15E_00E0189013DF__INCLUDED_) + + + diff --git a/src/CBot/tests/old TstCBot/res/TstCBot.ico b/src/CBot/tests/old TstCBot/res/TstCBot.ico new file mode 100644 index 0000000..7eef0bc Binary files /dev/null and b/src/CBot/tests/old TstCBot/res/TstCBot.ico differ diff --git a/src/CBot/tests/old TstCBot/res/TstCBot.rc2 b/src/CBot/tests/old TstCBot/res/TstCBot.rc2 new file mode 100644 index 0000000..2186272 --- /dev/null +++ b/src/CBot/tests/old TstCBot/res/TstCBot.rc2 @@ -0,0 +1,13 @@ +// +// TSTCBOT.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico b/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico new file mode 100644 index 0000000..2a1f1ae Binary files /dev/null and b/src/CBot/tests/old TstCBot/res/TstCBotDoc.ico differ diff --git a/src/CBot/tests/old TstCBot/test complet 1.txt b/src/CBot/tests/old TstCBot/test complet 1.txt new file mode 100644 index 0000000..0fd4fa5 --- /dev/null +++ b/src/CBot/tests/old TstCBot/test complet 1.txt @@ -0,0 +1,213 @@ +// test de l'interpréteur CBot, (c) D. Dumoulin 2000 + +Int Somme ( Int x, Int y ) +{ + return x + y; +} + +Real Somme ( Real x, Real y ) +{ + return x + y; +} + +void A_Faire() +{ + CPoint position; // utilise une classe externe + position.x = 123.5; + position.y = -45.1; + + show ( position ); +} + +/* Les nouveautés sont les suivantes + __________________________________________________ + + On peut définir des fonctions, avec la syntaxe habituelle au C + void MaFonction( Int x, Real y ) { ... } + + Les caractéristiques sont pour l'instant les suivantes: + + - ce programme TstCBot exécute la dernière fonction définie + + - on peut définir deux fonctions du même nom, + si la liste de paramètres est différente. + Par exemple + Int Somme( Int x, Int y ) + Real Somme( Real x, Real y ); + Note: si la seconde n'existait pas, Somme ( 1.3, 4.8 ) + serait fait sur les nombres entier 1 + 4 + La priorité est donnée à la routine qui ne pert pas + de bits dans la conversion des paramètres. + + - il n'y a pas d'erreur de compilation si une routine + ne retourne pas de valeur alors qu'elle devrait, + par contre il y a une erreur "correcte" à l'exécution + + - il est possible d'utiliser une fonction qui est définie + plus bas dans le programme. + __________________________________________________ + + Tous les blocs d'instructions existent maintenant, à savoir + + label : + while (condition) { instructions; break label; continue label; } + + label : + do { instructions; break label; continue label; } while (condition) + + label: + for (initial; condition; incrément) { instructions; break; continue } + + switch ( valeur ) { case 1: instructions; case 2: break ; } + + try {instructions; throw exception; } catch (exception) {instructions;} + catch (testlogique) {instructions;} + finally {instructions;} + // le bloc finally est exécuter dans tous les cas + // qu'il y ait eu exception ou non, et aussi en cas de break, continue ou return + __________________________________________________ + + Les "exceptions" sont juste des numéros (31 bits) + 6000 = division par zéro + 6001 = variable non initialisée + 6002 = valeur négative pour un throw + 6003 = la fonction n'a pas retourné de valeur + + les autres numéros sont à disposition + (COLOBOT aura surement des numéros d'exception propre) + l'association d'un mot clef pour ces exceptions est à venir. + __________________________________________________ + + L'interpréteur a été un peu optimiser, une boucle de un millon de décrément + ne prend plus que +*/ + +void Test () +{ // début du bloc d'instructions + + Int z = 1000000; + while ( z>0 ) z--; + + return; + { + // test la préséance pour les assignations + Int a = 9; + a += (a = 3); + if ( a != 12 ) 1/0; // le résultat correct est 12 + + Int b = 9; + b = b + (b = 3); + if (b != 12) 1/0; // même chose + + // la fonction show est une fonction externe + // définie par TstCBot + // elle peut prendre un nombre quelconque de paramètres + show ( a, b ); + } + + { + // petit test sur les chaînes + String x = "ch." ; + String y ; + x += y = x + " de la brume."; + + // concaténation de chaînes, accepte des autres types + String s = 1 + 2 + " test " + 3 + 4 ; + + show( x, y, s ); + + // les tests sur les chaînes ne sont pas standard en Java + // mais c'est si pratique : + + if ( s != "3 test 34" ) 1/0; // le résultat correct est "3 test 34" + // car 1+2 est évalué en premier entre 2 nombres + // et ensuite on additionne des chaînes "3" "4" + } + + { + // teste toutes les opérations avec les entiers (32 bits) + Int a = 4; + Int b = 4; + + Int c = a++ * --b; // post incrément, pré décrément + if ( c != 12 ) 1/0; + + c = ++a * b--; // pré incrément, post décrément + if ( c!=18 ) 1/0; + + a = a+b-a*b/a%3; // 6 + 2 - ( 6 * 2 / 6 % 3 ) -> 6 + if ( a != 6 ) 1/0; + + a += 2; a-=1; a*=3; a/=4; a%=3; // (6+2 -1) *3 /4 modulo 3 = 21 / 4 modulo 3 = 2 + if ( a!= 2) 0/0; + + if (-5 << 3 != -40) 0/0; // shift à gauche + if ( -5 >> 1 != -3) 0/0; // shift arithmétique à droite 11111011 -> 11111101 = -3 + if ( -5 >>> 1 != 0x3ffffffd) 0/0; // shift non signé à droite + + a = -10; // fait la même chose en assignation + a <<= 1; // -20 + a >>= 2; // -5 + a >>>= 1; // pert le signe + if ( a != 0x3ffffffd) 0/0; // + + Int x = 5/3; // division d'entiers + if ( x != 1 ) 0/0; + Int xx = 5.0/3.0; // division de réels, assigné à un entier + if ( xx != 1 ) 0/0; + + Int y = 0xF0035678; + if ( ~y != 0x0FFCA987 ) 0/0; // NOT bit à bit + if ( (0x3456 ^ 0x54f0) != 0x60A6) // XOR bit à bit + 0/0; + if ( (0x23 | 0x83) != 0xA3 ) 0/0; // OR bit à bit + if ( (0x23 & 0x83) != 0x03 ) 0/0; // AND bit à bit + + Int z = 0x0123; + z |= 0x8010; if ( z != 0x8133) 0/0; + z &= 0xF018; if ( z != 0x8010) 0/0; + z ^= 0xFF17; if ( z != 0x7F07) 0/0; + } + + { + // test pour les booléens + Boolean a, b= true, c = false; + a = b | c & b; + if ( a != b ) 0/0; + if ( !a ) 0/0; + if ( b ^ a ) 0/0; // XOR + if ( true || 0/0<1 ) {}; + if ( false && 0/0<1) {}; + // a ? "vrai" : "faux"; + } + + { + // petit test sur les nombres réels + Real x = 1. / 3, y = 0; + + if ( 3 * x != 1 ) x = x / y; // provoque une division par zéro + else y = 1.123; + } + + + // test de durée + // attention, le programme de test ne stoppe qu'à la fin d'exécution + // bien que la boucle est interrompue plusieures fois + + // la boucle est plus rapide si elle est au début du programme ! + { + Int z = 10000; + while ( z > 0 ) z = z - 1; + } + +} + +void t() +{ + A_Faire(); + + show ( Somme ( 1, 2 ) ); + show ( Somme ( 1., 2 ) ); + show ( Somme ( 4.5, 2.7 ) ); +} + diff --git a/src/CBot/tests/old TstCBot/x.txt b/src/CBot/tests/old TstCBot/x.txt new file mode 100644 index 0000000..95856e0 --- /dev/null +++ b/src/CBot/tests/old TstCBot/x.txt @@ -0,0 +1,43 @@ +// test de l'interpréteur CBot, (c) D. Dumoulin 2000 + +// pour l'instant, seule les primitives suivantes sont implémentées + +// { ... ; ... ; ... } un bloc d'instructions +// int x, y = 12, z; // déclaration de nombre entier +// float a, b= 2/3, c=b+1; // déclaration de nombres réels +// boolean tst = true; // déclaration d'un booléen +// String x = "hello"; // déclaration d'une chaînes + +// z = x = x * y / ( z + 1 - x ); // assignation en chaîne et les 4 opérations + +// while ( x >= 0 ) x = x - 1; // boucle while, et test > >= < <= == != +// if ( x < y ) x = x + 1; // test si +// else y = y + 1; // sinon + +/* et les opérations suivantes: + + plus unaire x = +y; + - moins unaire x = -y; + + || OU logique + && ET logique + ! NOT logique + | OU bit à bit + & ET bit à bit + ^ XOR bit à bit + ~ NON bit à bit + +// les commentaires sont acceptés +/* y compris les commentaires + sur plusieures lignes */ + + +{ +String str ; + +str = "abc" ; + +show (str) ; + +show( str = str + "+++" , ) ; + +} -- cgit v1.2.3-1-g7c22