Complete translation to C/SDL
This used to have an issue but it was closed because it was mostly not about the specifics of the current effort (due to experiments with Python/Tk etc.) the key things to note are some changes in my coding approach.
- We're not scared of global variables. This is a utility, not a library, so no-one should be using this code within their separate project unless they intend to replace Embroidermodder 2. So namespace pollution is not an issue.
- All code files are included directly into
embroidermodder.cso the build is really simple. - We're not using CMake for building this project since if someone has all the libraries as shared objects the compilation could be a single line of shell. There is a
build.shutility to help with this, but it's far simpler than a CMake build and optional. - This project, unlike
libembroidery, is focussed mainly on the data structures and configuration.em2_data.candem2_structs.cshould be a really good way of understanding the code rather than starting with what the functions are. These hold the role that XML or another markup would hold in many other GUIs. - There are three core features which all other features are subordinate to, they all use integer constants to refer to their specific behaviours:
- The actuator: a function that calls the action to be taken, connecting the user interface element to a function
- The widget builders: functions that constructs a widget given the data describing the toolbars, menubars, context menus etc.
- The settings system: a few arrays of all the settings to allow for bulk copying when the user wants to preview a feature without applying it or loading a setting from file.
The actual design of Embroidermodder 2 remains very similar and the specifics of the C++/Qt version have been hand translated into this version. The continuity from Embroidermodder 2 (before 2022) to Embroidermodder 2 (2022) should be easy to follow once the translation is complete.
For specifics on the actuator, we have issue #282 , this is the parent issue for that one.
Also for the history of this change start with #143
Conclusions on the Lisp/scripting front.
Postscript is a language that we may have to support in libembroidery anyway since it is used to describe a lot of the existing vector graphics files out there, also we may use it to produce the pattern printouts. Postscript is also a stack oriented Turing complete computer language so we could establish a subset of it as out "shape description" mechanism for Embroidermodder.
See this tutorial for details: https://staff.science.uva.nl/a.j.p.heck/Courses/Mastercourse2005/tutorial.pdf
In exercise 9 it shows we have the ability to describe non trivial functions in this syntax:
1 2 div 1 2 div 3 sqrt mul add dup mul
Represents the expression $(\frac{1}{2}+\frac{1}{2}\sqrt{3})^2$. Since postscript is concatenative, we may represent the function $(x+\frac{1}{2}\sqrt{3})^2$ by just chopping this expression down:
1 2 div 3 sqrt mul add dup mul
Since add takes two arguments we have an incomplete lambda expression, it's just the input format is anonymous (unlike lisp). This seems like a really good reason to replace our "shape description" language with postscript (compiled into libembroidery) and remove TinyScheme.