Numworks Epsilon  1.4.1
Graphing Calculator Operating System
main.cpp
Go to the documentation of this file.
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) {
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++) {
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
42 }
App::Snapshot * appSnapshotAtIndex(int index) override
void ion_main(int argc, char *argv[])
Definition: main.cpp:4
size_t strlen(const char *s)
Definition: strlen.c:3
void setLanguage(I18n::Language language)
static AppsContainerStorage * sharedContainer()
void run() override
int strcmp(const char *s1, const char *s2)
Definition: strcmp.c:3
int numberOfApps() override
static GlobalPreferences * sharedGlobalPreferences()