1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
19 /** \file
20  * \ingroup creator
21  *
22  * Functionality for main() initialization.
23  */
24 
25 struct bArgs;
26 struct bContext;
27 
28 #ifndef WITH_PYTHON_MODULE
29 
30 /* creator_args.c */
31 void main_args_setup(struct bContext *C, struct bArgs *ba);
32 void main_args_setup_post(struct bContext *C, struct bArgs *ba);
33 
34 /* creator_signals.c */
35 void main_signal_setup(void);
36 void main_signal_setup_background(void);
37 void main_signal_setup_fpe(void);
38 
39 #endif /* WITH_PYTHON_MODULE */
40 
41 /* Shared data for argument handlers to store state in */
42 struct ApplicationState {
43   struct {
44     bool use_crash_handler;
45     bool use_abort_handler;
46   } signal;
47 
48   /* we may want to set different exit codes for other kinds of errors */
49   struct {
50     unsigned char python;
51   } exit_code_on_error;
52 };
53 extern struct ApplicationState app_state; /* creator.c */
54 
55 /* for the callbacks: */
56 #ifndef WITH_PYTHON_MODULE
57 #  define BLEND_VERSION_FMT "Blender %d.%02d.%d"
58 #  define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH
59 #endif
60 
61 #ifdef WITH_BUILDINFO_HEADER
62 #  define BUILD_DATE
63 #endif
64 
65 /* from buildinfo.c */
66 #ifdef BUILD_DATE
67 extern char build_date[];
68 extern char build_time[];
69 extern char build_hash[];
70 extern unsigned long build_commit_timestamp;
71 
72 /* TODO(sergey): ideally size need to be in sync with buildinfo.c */
73 extern char build_commit_date[16];
74 extern char build_commit_time[16];
75 
76 extern char build_branch[];
77 extern char build_platform[];
78 extern char build_type[];
79 extern char build_cflags[];
80 extern char build_cxxflags[];
81 extern char build_linkflags[];
82 extern char build_system[];
83 #endif
84