Namespace documentation: Private namespaces and detailed look-up rules
[shapes.git] / source / globals.h
blob41f70980c8c049ebea4e3e8f9a75dc5da3114dce
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2010 Henrik Tidefelt
19 #pragma once
21 #include "Shapes_Lang_decls.h"
22 #include "Shapes_Kernel_decls.h"
23 #include "Shapes_Computation_decls.h"
24 #include "Shapes_Concrete_decls.h"
25 #include "Shapes_Helpers_decls.h"
26 #include "Shapes_Exceptions_decls.h"
27 #include "SimplePDF_decls.h"
28 #include "FontMetrics_decls.h"
30 #include "refcount.h"
31 #include "ptrowner.h"
32 #include "elementarylength.h"
33 #include "simplepdfo.h"
34 #include "pdfimport.h"
35 #include "config.h"
37 #ifdef HAVE_FT2
38 #include <ft2build.h>
39 #include FT_FREETYPE_H
40 #endif
42 // The following types do not belong to any particular namespace for some reason, and are therefore declared like this:
43 class ShapesScanner;
46 namespace Shapes
49 namespace Interaction
52 extern bool debugBacktrace;
53 extern bool debugSystem;
54 extern size_t debugStep;
55 extern const char * displayUnitName;
56 extern Concrete::Length displayUnit;
57 extern double displayUnitFactor;
58 extern bool fontMetricMessages;
59 extern bool fontMetricDebug;
60 extern bool characterColumnInBytes;
61 extern bool pdfLaTeXInteractionTo_stderr;
62 extern bool logGlobals;
63 typedef enum { WARNING_DISPLAY = 0, WARNING_ERROR, WARNING_IGNORE } WarningAction;
64 extern WarningAction warningAction;
68 namespace Computation
71 extern Concrete::Length the_arcdelta;
72 extern double the_dtMin;
73 extern bool dtMinIsError;
74 extern Concrete::Length theDistanceTol;
75 extern Concrete::Length theTrixelizeSplicingTol;
76 extern Concrete::Length theTrixelizeOverlapTol;
77 extern RefCountPtr< const Computation::PaintedPolygon3D > THE_NULL_POLYGON3D;
78 extern bool fontMetricGuessIsError;
79 extern Computation::BasicSimplex theTwoTriangleSimplex;
82 namespace Kernel
85 extern Kernel::PassedEnv theGlobalEnvironment; // Useful for functions in the core refering to their home environment.
86 extern std::list< Kernel::Environment * > theEnvironmentList;
87 extern Kernel::TeXLabelManager theTeXLabelManager;
88 extern SimplePDF::PDF_Version the_PDF_version;
89 extern bool allowTransparency;
90 extern bool allowSingletonPaths;
91 extern size_t theIndirectObjectCount;
92 extern SimplePDF::DocumentInfo theDocInfo;
93 extern Kernel::Import thePDFImporter;
94 extern Kernel::DebugLog theDebugLog;
96 extern RefCountPtr< const Kernel::GraphicsState > THE_NO_STATE;
97 extern RefCountPtr< const Kernel::GraphicsState > THE_DEFAULT_STATE;
99 extern RefCountPtr< const Lang::Function > THE_NO_FUNCTION;
101 extern Arguments EMPTY_ARGLIST;
102 extern VariableHandle THE_SLOT_VARIABLE;
103 extern VariableHandle THE_FALSE_VARIABLE;
104 extern VariableHandle THE_TRUE_VARIABLE;
105 extern VariableHandle THE_VOID_VARIABLE;
107 extern StateHandle THE_SLOT_STATE;
109 extern RefCountPtr< const Lang::Symbol > THE_NAVIGATION_SYMBOL;
110 extern RefCountPtr< const Lang::Symbol > THE_ANNOTATION_SYMBOL;
112 extern PtrOwner_back_Access< std::list< Exceptions::Exception * > > thePostCheckErrorsList;
114 #ifdef HAVE_FT2
115 extern FT_Library theFreeType;
116 const char * FreeTypeErrorMessage( FT_Error code );
117 #endif
120 namespace Lang
123 extern RefCountPtr< const Lang::GroupNull2D > THE_NULL2D;
124 extern RefCountPtr< const Lang::GroupNull3D > THE_NULL3D;
125 extern RefCountPtr< const Lang::DynamicBindings > THE_NULL_DYNAMIC_BINDINGS;
126 extern RefCountPtr< const Lang::LightGroup > THE_NULL_LIGHTS;
127 extern RefCountPtr< const Lang::SingleListNull > THE_CONS_NULL;
128 extern RefCountPtr< const Lang::Structure > THE_EMPTY_STRUCT;
129 extern RefCountPtr< const Lang::SpecularReflectionNull > THE_SPECULARREFLECTION_NULL;
130 // extern RefCountPtr< const Lang::PaintedPoltgon2D > THE_NULL_POLYGON2D;
131 extern RefCountPtr< const Lang::ColorSpace > THE_INHERITED_COLOR_SPACE;
132 extern RefCountPtr< const Lang::ColorSpace > THE_COLOR_SPACE_DEVICE_GRAY;
133 extern RefCountPtr< const Lang::ColorSpace > THE_COLOR_SPACE_DEVICE_RGB;
134 extern RefCountPtr< const Lang::ColorSpace > THE_COLOR_SPACE_DEVICE_CMYK;
135 extern RefCountPtr< const Lang::Drawable2D > THE_POINTPICTURE;
136 extern RefCountPtr< const Lang::Void > THE_VOID;
137 extern RefCountPtr< const Lang::ElementaryPath2D > THE_EMPTYPATH2D;
138 extern RefCountPtr< const Lang::ElementaryPath3D > THE_EMPTYPATH3D;
139 extern RefCountPtr< const Lang::Boolean > THE_FALSE;
140 extern RefCountPtr< const Lang::Boolean > THE_TRUE;
141 extern RefCountPtr< const Lang::Gray > THE_BLACK;
142 extern RefCountPtr< const Lang::Gray > THE_OCCLUDING_WHITE;
143 extern RefCountPtr< const Lang::Alpha > THE_OPAQUE;
144 extern RefCountPtr< const Lang::Class > THE_OBJECT;
145 extern RefCountPtr< const Lang::CoreFunction > THE_NO_ARROW;
146 extern RefCountPtr< const Lang::CoreFunction > THE_IDENTITY;
147 extern RefCountPtr< const Lang::Dash > THE_SOLID_DASH;
148 extern RefCountPtr< const Lang::SoftMask > THE_NONE_MASK;
149 extern RefCountPtr< const Lang::SoftMask > THE_SAME_MASK;
150 extern RefCountPtr< const Lang::Font > THE_FONT_HELVETICA;
152 extern Transform2D THE_2D_IDENTITY;
153 extern Transform3D THE_3D_IDENTITY;
155 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_MINUSMINUS;
156 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_PLUSPLUS;
157 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_AMPERSAND;
158 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_AMPERSAND_MORE;
159 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_PLUS;
160 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_MINUS;
161 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_ANGLE;
162 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_STAR;
163 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_PROJECTION;
164 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_SLASH;
165 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_COMPOSE;
166 extern RefCountPtr< const Lang::UnaryOperatorFunction > THE_OPERATOR_NEG;
167 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_LESS;
168 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_GREATER;
169 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_EQEQ;
170 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_EQNEQ;
171 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_LESSEQ;
172 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_GREATEREQ;
173 extern RefCountPtr< const Lang::UnaryOperatorFunction > THE_OPERATOR_NOT;
174 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_AND;
175 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_OR;
176 extern RefCountPtr< const Lang::BinaryOperatorFunction > THE_OPERATOR_XOR;
178 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_ABS;
179 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_RANGE;
182 namespace Ast
185 extern ShapesScanner theShapesScanner;
186 extern Ast::Expression * theProgram;
187 extern std::list< Ast::Node * > * theInteractiveInput;
188 extern PtrOwner_back_Access< std::list< Ast::AnalysisEnvironment * > > theAnalysisEnvironmentList;
189 extern Ast::AnalysisEnvironment * theGlobalAnalysisEnvironment;
190 extern Ast::DummyExpression THE_CORE_DEFAULT_VALUE_EXPRESSION;
191 extern Ast::DummyExpression THE_INTERNAL_VALUE_EXPRESSION;
193 extern PtrOwner_back_Access< std::list< Exceptions::Exception * > > theAnalysisErrorsList;
195 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_coords2D;
196 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_cornercoords2D;
197 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_coords3D;
198 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_polarHandle2DFree_r;
199 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_polarHandle2DFree_ra;
200 extern RefCountPtr< const Lang::CoreFunction > THE_FUNCTION_TeX;
204 namespace Interaction
206 void warn_or_push( Exceptions::Exception * message, PtrOwner_back_Access< std::list< Exceptions::Exception * > > * errorsList );
207 void displayWarning( const Exceptions::Exception & ball );