-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Remove cog_platform_configure() function
Remove the cog_platform_configure() utility function, because at this point it does not do much else than calling cog_platform_new() and cog_platform_setup(). Instead, make sure that the platform instance is a global singleton and that it is created on-demand on the first call of a the cog_platform_get() accessor. In order to allow manually indicating which platform plug-in to use, a new cog_init() function is added. While at it, make it unnecessary for programs to always call cog_modules_add_directory() if they only need to use the default module path. The upside of these changes is that the API gets much more convenient to use, and in the simplest of cases, it is enough to let the library initialize the platform instance. The one-time configuration using cog_platform_setup() is still needed, but now the following is enough to properly use the library: CogShell *shell = cog_shell_new("my-program", FALSE); if (!cog_platform_setup(cog_platform_get(), shell, "", NULL)) g_error("Cannot initialize Cog."); Note that the COG_MODULEDIR and COG_PLATFORM_NAME environment variables are still used when NULLs are passed to cog_init() or during implicit initialization.
- Loading branch information
Showing
11 changed files
with
140 additions
and
160 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Title: Running Cog Applications | ||
|
||
Running Cog Applications | ||
======================== | ||
|
||
Environment Variables | ||
--------------------- | ||
|
||
The runtime behaviour of the Cog core library can be influenced by a number of | ||
environment variables. | ||
|
||
`COG_MODULEDIR` | ||
: Allows to specify a non-default location where to search for platform | ||
plug-in modules. The default location is under `<libdir>/cog/modules` | ||
unless a custom location was specified during configuration when | ||
building. See [id@cog_modules_add_directory] and [id@cog_init] for | ||
more information. | ||
|
||
`COG_PLATFORM_NAME` | ||
: This variable can be set to the name of the platform plug-in module to | ||
use and prevent automatically determining which one to use. | ||
See [id@cog_init] for more information. |
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
Oops, something went wrong.