Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Squirrel 3.1 and new bindings

(1/7) > >>

oBFusCATed:
Here is a branch: https://github.com/obfuscated/codeblocks_sf/tree/scripting/update_to_31

I've spend the last months working on this, because I need it for my debugger-test-suite I want to make.
This branch updates Squirrel to the latest released version - 3.1-stable.
It removes SqPlus, because it is no longer maintained and it is buggy (this was my main motivation to do the work).
I've applied some patches to the interpreter - comparing wxStrings with == now works.
Unfortunately the Squirrel devs don't intend to review my patch, nor do they plan to give feedback on it and they/he have repeatedly mentioned that this feature won't go in to the upstream, because it can slow down the language, but they don't have a test suite and so their claims are mostly predictive and not based on actual facts. Up to now I've not seen any problems with it.
I've added tests for most of the exposed APIs. This branch passes more tests then master/trunk.

I've not tested on Windows. Linux and macOS build and work fine as far as I can test.

If you need to know how the new binding works read the comments in sc_utils.h and if something is unclear don't hesitate to ask.
I plan to fix some of the remaining TODOs (you can search them with "FIXME (squirrel)") and then push this monstrosity.

Any feedback is welcome, especially on Windows.

Note: I've not tested every single wizard, so if you have favourite wizard give it a try and tell me if something is broken, I'm sure there are such cases!

stahta01:

--- Code: ---From 5c8abf12484cabd79be5b2603b3043a272172fe6 Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <[email protected]>
Date: Sat, 17 Apr 2021 00:52:52 -0400
Subject: Win fix

---
 src/include/scripting/include/squirrel.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/include/scripting/include/squirrel.h b/src/include/scripting/include/squirrel.h
index 4844317d5..a22e73081 100644
--- a/src/include/scripting/include/squirrel.h
+++ b/src/include/scripting/include/squirrel.h
@@ -27,8 +27,14 @@ extern "C" {
 #endif
 
 #ifndef SQUIRREL_API
-#define SQUIRREL_API extern
-#endif
+#ifdef _WIN32
+    // since we build the squirrel static library, and we need to export all the symbols
+    // the codeblocks.dll, we need to add the dllexport decoration
+    #define SQUIRREL_API __declspec(dllexport)
+#else
+    #define SQUIRREL_API extern
+#endif // _WIN32
+#endif // SQUIRREL_API
 
 #if (defined(_WIN64) || defined(_LP64))
 #ifndef _SQ64
--
2.31.1.windows.1

--- End code ---

--- Code: ---From 5e68a70734e0da0495cf57cbe617071452c0c3df Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <[email protected]>
Date: Sat, 17 Apr 2021 02:05:09 -0400
Subject: Add SQUIRREL_API to fix win build error

---
 src/include/scripting/bindings/sc_utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/scripting/bindings/sc_utils.h b/src/include/scripting/bindings/sc_utils.h
index 03eaf944a..838487109 100644
--- a/src/include/scripting/bindings/sc_utils.h
+++ b/src/include/scripting/bindings/sc_utils.h
@@ -183,7 +183,7 @@
 namespace ScriptBindings
 {
 
-void PrintStack(HSQUIRRELVM vm, const char *title, SQInteger oldTop = -1);
+SQUIRREL_API void PrintStack(HSQUIRRELVM vm, const char *title, SQInteger oldTop = -1);
 wxString ExtractLastSquirrelError(HSQUIRRELVM vm, bool canBeEmpty);
 
 struct PreserveTop
--
2.31.1.windows.1

--- End code ---

Tim S.

oBFusCATed:
Are you able to run the tests?
Steps:
1. Show the script console
2. Load the src/scripts/tests/script_test_plugin.script
3. Plugins -> Test scripting -> Test wx or Test sdk

Post the results here.

stahta01:
Edit3: "Test wx" seems to do nothing that I can see other than a box pops up for me to click on.

I had to manually create the folder "C:\Users\stahta01\AppData\Local\Temp\sdk_tests" before the SDK tests did much.
It crash a little later; going to have to try again to see if it still crashes.

Edit2: It did not crash the second time; but, the first time I was building Code::Blocks main project and I think that might be a partial reason it crashed.

I have neither a printer setup and I have no debugger setup inside Code::Blocks.


--- Code: ---Script plugin registered: Scripting_TestPlugin
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ProjectManager::SetProject took: 0.085 seconds.
Current target 'Debug_New' doesn't have valid compiler!
ProjectManager::SetProject took: 0.119 seconds.
ProjectManager::SetProject took: 0.094 seconds.
ProjectManager::SetProject took: 0.093 seconds.
Opening C:\Users\stahta01\AppData\Local\Temp\sdk_tests\NewProject2.cbp
Done.
ProjectManager::CloseAllProjects took: 0.179 seconds.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
cbEditor::AutoComplete() is obsolete.
Use AutoComplete(cbEditor &ed) from the Abbreviations plugin instead.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ProjectManager::SetProject took: 0.086 seconds.
Current target 'Debug_New' doesn't have valid compiler!
ProjectManager::SetProject took: 0.095 seconds.
ProjectManager::SetProject took: 0.095 seconds.
ProjectManager::SetProject took: 0.112 seconds.
Opening C:\Users\stahta01\AppData\Local\Temp\sdk_tests\NewProject2.cbp
Done.
ProjectManager::CloseAllProjects took: 0.181 seconds.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
cbEditor::AutoComplete() is obsolete.
Use AutoComplete(cbEditor &ed) from the Abbreviations plugin instead.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

--- End code ---

Tim S.

BlueHazzard:
Had to apply the patches of stahta01 to be able to compile

SDK test:

--- Code: ---Global executed tests: 24
Global passed tests:   24
Global failed tests:   0
--- End code ---

wx test

--- Code: ---Global executed tests: 138
Global passed tests:   126
Global failed tests:   13

--- End code ---

The failed tests are:

--- Code: ---[ERROR] Test: cmp string          FAILED (got false needed true)
[ERROR] Test: cmp string2         FAILED (got false needed true)
[ERROR] Test: cmp string not      FAILED (got false needed true)
[ERROR] Test: cmp string not2     FAILED (got false needed true)

[ERROR] Test: InsertDir value     FAILED (got "\newdir\share\codeblocks\" needed "newdir\\share\codeblocks\ ")
[ERROR] Test: PrependDir value    FAILED (got "\newdir\share\codeblocks\" needed "newdir\\share\codeblocks\ ")

--- End code ---
The other failed tests are related to path handling or volume, that failed also in the old implementation...

the failed tests for paths seem to be some error with the "::wxFILE_SEP_PATH" constant

@stahta01: the output of the tests is in the scripting console

Navigation

[0] Message Index

[#] Next page

Go to full version