Updated the README
[libs.git] / src / Sylph.h
blob5bdcc99f922d202e3c0c1854b30e066dc5253059
1 /*
2 * LibSylph Class Library
3 * Copyright (C) 2009 Frank "SeySayux" Erens <seysayux@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the LibSylph Pulbic License as published
7 * by the LibSylph Developers; either version 1.0 of the License, or
8 * (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LibSylph
13 * Public License for more details.
15 * You should have received a copy of the LibSylph Public License
16 * along with this Library, if not, contact the LibSylph Developers.
18 * Created on 17 januari 2009, 15:14
21 #ifndef SYLPH_H_
22 #define SYLPH_H_
24 #include "Sylph/OS/OS.h"
25 #include "Sylph/Core/Application.h"
26 #include "Sylph/Core/Array.h"
27 #include "Sylph/Core/String.h"
28 #include "Sylph/Core/Common.h"
29 #include "Sylph/Core/AppType.h"
30 #include "Sylph/Core/UncaughtExceptionHandler.h"
32 #ifndef SYLPH_NO_SYLPHMAIN
33 #ifndef SYLPH_APP_NAME
34 #define SYLPH_APP_NAME "Application"
35 #endif
37 #ifdef SYLPH_OS_MACOSX
38 int main(int argc, char * argv[], char * envp[], char * apple[]);
39 #else
40 int main(int argc, char * argv[]);
41 #endif
42 static inline void SylphInit(int argc, char * argv[], char * apple[]) {
43 Sylph::Application::init(argc, argv, apple, Sylph::SYLPH_APP_TYPE,
44 SYLPH_APP_NAME);
46 extern int SylphMain(Sylph::Array<Sylph::String> argv);
48 #ifdef SYLPH_OS_MACOSX
50 int main(int argc, char * argv[], char * envp[], char * apple[]) {
51 try {
52 SylphInit(argc, argv, apple);
53 Array<String> args(argc);
54 for(int i = 0; i < argc; ++i) {
55 args[i] = argv[i];
57 return SylphMain(args);
58 } catch (Sylph::Exception & ex) {
59 Sylph::UncaughtExceptionHandler::handler->handle(ex);
62 #else
64 int main(int argc, char * argv[]) {
65 try {
66 SylphInit(argc, argv, Sylph::null);
67 Array<String> args(argc);
68 for(int i = 0; i < argc; ++i) {
69 args[i] = argv[i];
71 return SylphMain(args);
72 } catch (Sylph::Exception & ex) {
73 Sylph::UncaughtExceptionHandler::handler->handle(ex);
76 #endif
78 #endif
79 #endif /* SYLPH_H_ */