-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
66 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Note to developers of jasptools | ||
These are some short musings on the internal workings of jasptools. | ||
|
||
jasptools calls the function `run` in `common.R` instead of directly calling the analysis itself. | ||
The advantage of this method is that changes to `run` in `common.R` are immediately incorporated in jasptools. | ||
The downside of this approach is that it needs to convert the results from JSON (and thereby loses attributes) as well as use an alternative method to obtain the state file (see the next section). | ||
|
||
#### Globals | ||
jasptools uses three different mechanisms to share variables between inner functions and to the environment outside jasptools. | ||
1. `.internal`: environment that holds internal variables; these are used to pass information between functions. | ||
The state entry is special, because it interfaces directly with the JASP code. Rather than storing and then loading the state, it is passed to jasptools, which is much faster. | ||
2. `.pkgOptions`: environment that holds variables to be changed by users; mainly paths to resources. | ||
3. global variables: the rbridge in JASP defines certain global variables that JASP assumes are always globally accessible and these need to be matched in jasptools. They include `perform`, `.ppi` and `.baseCitation` (the global functions on the other hand are defined in the jasptools file rbridge.R). Global variables are set every time `run` is called through `.setRCPPMasks`. | ||
|
||
#### Handling of S3 methods | ||
Currently it is necessary to export the S3 methods used for generic functions in JASP (e.g., those defined in `common.R`). | ||
The reason for this is that they are not found on the search path when defined in an environment within jasptools (see `utils::methods`) and consequently are not registered. | ||
The S3 methods are briefly exported during runtime to the .GlobalEnv with `.exportS3Methods` before they are again destroyed. | ||
|
||
#### Changing package resources | ||
jasp-desktop follows a fixed structure, meaning that in every development environment the resources are in the same place. | ||
Once jasptools verifies that it is located within /Tools/ it converts the relative paths to the resources to absolute paths. | ||
Now, if these resources are changed, jasptools will need to be adjusted. Firstly, `zzz.R` needs to be modified where it states `# set locations of all required resources (json, analyses, html, packages)` and secondly `.pkgOptions` in `pkg-settings.R` must reflect the same changes. | ||
|
||
#### Changing to TOML | ||
At the moment jasptools only supports JSON format for the description files. | ||
Should we decide to change this in the future, then the functions that interface with the description file must be adapted. | ||
These functions can be found in `options.R` (`.analysisOptionsFromFile`), `main.R` (`run`) and in `utils.R` (`.getJSON`). | ||
It is not a problem that the code that is send to `view` still uses JSON as this is unlikely to change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters