Numworks Epsilon
1.4.1
Graphing Calculator Operating System
main.cpp
Go to the documentation of this file.
1
#include "
apps_container_storage.h
"
2
#include "
global_preferences.h
"
3
4
void
ion_main
(
int
argc,
char
* argv[]) {
5
#if EPSILON_GETOPT
6
for
(
int
i=1; i<argc; i++) {
7
if
(argv[i][0] !=
'-'
|| argv[i][1] !=
'-'
) {
8
continue
;
9
}
10
/* Option should be given at run-time:
11
* $ ./epsilon.elf --language fr
12
*/
13
if
(
strcmp
(argv[i],
"--language"
) == 0 && argc > i+1) {
14
const
char
* languageIdentifiers[] = {
"none"
,
"en"
,
"fr"
,
"es"
,
"de"
,
"pt"
};
15
const
char
* requestedLanguageId = argv[i+1];
16
for
(
int
i=0; i<
sizeof
(languageIdentifiers)/
sizeof
(languageIdentifiers[0]); i++) {
17
if
(
strcmp
(requestedLanguageId, languageIdentifiers[i]) == 0) {
18
GlobalPreferences::sharedGlobalPreferences
()->
setLanguage
((I18n::Language)i);
19
break
;
20
}
21
}
22
continue
;
23
}
24
/* Option should be given at run-time:
25
* $ ./epsilon.elf --[app_name]-[option] [arguments]
26
* For example:
27
* $ make -j8 PLATFORM=emscripten EPSILON_APPS=code
28
* $ ./epsilon.elf --code-script hello_world.py:print("hello") --code-lock-on-console
29
*/
30
const
char
* appNames[] = {
"home"
, EPSILON_APPS_NAMES};
31
for
(
int
j = 0; j <
AppsContainerStorage::sharedContainer
()->
numberOfApps
(); j++) {
32
App::Snapshot
* snapshot =
AppsContainerStorage::sharedContainer
()->
appSnapshotAtIndex
(j);
33
int
cmp =
strcmp
(argv[i]+2, appNames[j]);
34
if
(cmp ==
'-'
) {
35
snapshot->setOpt(argv[i]+2+
strlen
(appNames[j])+1, argv[i+1]);
36
break
;
37
}
38
}
39
}
40
#endif
41
AppsContainerStorage::sharedContainer
()->
run
();
42
}
AppsContainerStorage::appSnapshotAtIndex
App::Snapshot * appSnapshotAtIndex(int index) override
Definition:
apps_container_storage.cpp:32
global_preferences.h
apps_container_storage.h
ion_main
void ion_main(int argc, char *argv[])
Definition:
main.cpp:4
strlen
size_t strlen(const char *s)
Definition:
strlen.c:3
GlobalPreferences::setLanguage
void setLanguage(I18n::Language language)
Definition:
global_preferences.cpp:20
AppsContainerStorage::sharedContainer
static AppsContainerStorage * sharedContainer()
Definition:
apps_container_storage.cpp:17
App::Snapshot
Definition:
app.h:31
AppsContainer::run
void run() override
Definition:
apps_container.cpp:161
strcmp
int strcmp(const char *s1, const char *s2)
Definition:
strcmp.c:3
AppsContainerStorage::numberOfApps
int numberOfApps() override
GlobalPreferences::sharedGlobalPreferences
static GlobalPreferences * sharedGlobalPreferences()
Definition:
global_preferences.cpp:11
epsilon
apps
main.cpp
Generated by
1.8.14