Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Port Sqplus to sqrat #5

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

bluehazzard
Copy link
Contributor

This is the port from sqplus to sqrat
The [NOT COMPILE] marked commits do not compiler, because the project files are not updated until 77c1e3e . I have split up the commits to make the changes more clear.

Motivation for the port

  • Sqplus is not maintained any more (at least there was no update for the last 3 years), sqrat has active development with fast bugfixes
  • Sqrat is header only
  • With sqrat it is possible to automate parameter fetching to easier bind a native function without writing specialized wrapper functions

Changes

SDK Api

All changes to the api affect only scripting related things... So if a plugin does not use scripting no changes to the code are needed.

  • SqPlus provided a vm wrapper. This has to be replaced: Add a wrapper for the squirrel VM (Virtual Machine) (63d2f5d). Prepared to handle multiple VM so it is possible to sandbox vms, or give every plugin a separate vm
  • Add a stack handler class (StackHandler) for easily work with the squirrel stack. It provides function for getting, pushing variables from and to the vm stack and error handling.
  • Add versioning for the script API (SCRIPT_BINDING_VERSION_MAJOR...)
  • Change ReplaceMacros to give the possibility to give the context name for error reporting to the scripting engine

Scripting changes

General

  • Update squirrel from 2.2.5 to 3.0.4 stable. This adds changes to the squirrel syntax (for ex. "base" is now a keyword)

wxWidgets related

  • The most important change is that it is possible to use wxStrings as native squirrel strings in any direction.
  • add "_tostring" methods for all wx types
  • add unicode support for wxString class (only UTF8)
  • add ToInt and ToDouble to wxString
  • add "wxT()"
  • add wxColour(int,int,int) constructor
  • add wxPoint::Cmp()
  • add wxSize::Cmp()
  • add wxStopWatch
  • move all wxWidgets const to the const table

cb binding related

  • move all constants to the const table

User experience

  • All script related errors (compiler, runtime) are displayed in a uniform way: separate dialogue and in the logging output
  • If the error occurs in some other parts then a script file (ex. prebuild steps) the location is reported

Help needed

  • [] The makefiles need to be updated
  • [] Header handling (ex. PCH)

Todo

old bugs

The "bugs" listed here are present in the sqplus AND in the sqrat implementation.

  • [] Improve error Handling during MacrosManager::ReplaceMacros(). The current implementation is not usable, because on an script error the compilation does not get aborted. (Test case: implement error in the build script of the codeblocks project and build the target "all")
  • [] The whole menu handling part has bugs
  • [] In the right click handling is no possibility to distinguish where the right click happened (Editor, log window, project tree)

improvements in the pipeline

  • [] Add the possibility to handle CB Events
  • [] Add debug support for scripts
  • [] Add wxWidgets dialogues and events
  • [] Handle script plugins like binary plugins
    ...

Update squirrel from 2.2.5 to 3.0.4 stable
does not update project files
will not compile
Remove the sqplus binding library
does not update project files
will not compile
Add the new sqrat binding library
does not update project files
will not compile
…it possible to compile files and catch errors from sqrat and squirrel. There is also a api for sand boxing a vm for temporary handling.
…at (1/3)

- remove all wx related stuff from cb squirrel files
+ Add ClearPlugins() function to clean up all registered Plugins
* All register functions expect a vm parameter to make it possible to
* register to different vms
…at (2/3)

* port c::b internal functions binding to sqrat
* move all wxWidgets related files to sq_wx subfolder
* split the string handling in a separate source file
* script binding register methods expect a vm parameter
  so multiple vms can be used
+ add wxString handler to the sqrat api, to make a automated
  conversation between squirrel strings and wxStrings (in any direction)
+ add "_tostring" methods for all wx types
+ add unicode support for wxString class (only UTF8)
+ add ToInt and ToDouble to wxString
+ add "wxT()"
+ add wxColour(int,int,int) constructor
+ add wxPoint::Cmp()
+ add wxSize::Cmp()
+ add wxStopWatch
* move all wxWidgets const to the const table
* Squirrel errors get reported in a seperate dialog and in the
  cb log output. Included is a stack trace and the local variables
  from the top function call
API change: ReplaceMacros has now a parameter to describe the name in
what context it is called. This is used for error reporting for the
scripting engine. Parameter has default value so no code rework is needed
Encapsulate the plugin script binding in a namespace (=table with the name "Abbreviations") to avoid name collisions, specially with the Function "AutoComplete". To access this function call Abbreviations.AutoComplete()
private:
// needed for SqPlus bindings
ScriptingManager(cb_unused const ScriptingManager& rhs); // prevent copy construction

void OnScriptMenu(wxCommandEvent& event);
void OnScriptPluginMenu(wxCommandEvent& event);
void RegisterScriptFunctions();
void OnDebugTimer(wxTimerEvent& event);
Copy link
Contributor Author

@bluehazzard bluehazzard Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is without functionality at the moment and can be removed...
void OnDebugTimer(wxTimerEvent& event);
wxTimer m_DebugerUpdateTimer;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant