]> git.mxchange.org Git - flightgear.git/blob - src/Main/globals.cxx
Reset: clear effects cache
[flightgear.git] / src / Main / globals.cxx
1 // globals.cxx -- Global state that needs to be shared among the sim modules
2 //
3 // Written by Curtis Olson, started July 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson - http://www.flightgear.org/~curt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software Foundation,
19 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23 #ifdef HAVE_CONFIG_H
24 #  include <config.h>
25 #endif
26
27 #include <boost/foreach.hpp>
28 #include <algorithm>
29
30 #include <simgear/structure/commands.hxx>
31 #include <simgear/misc/sg_path.hxx>
32 #include <simgear/misc/sg_dir.hxx>
33 #include <simgear/timing/sg_time.hxx>
34 #include <simgear/ephemeris/ephemeris.hxx>
35 #include <simgear/scene/material/matlib.hxx>
36 #include <simgear/structure/subsystem_mgr.hxx>
37 #include <simgear/structure/event_mgr.hxx>
38 #include <simgear/sound/soundmgr_openal.hxx>
39 #include <simgear/misc/ResourceManager.hxx>
40 #include <simgear/props/propertyObject.hxx>
41 #include <simgear/props/props_io.hxx>
42 #include <simgear/scene/model/modellib.hxx>
43
44 #include <Aircraft/controls.hxx>
45 #include <Airports/runways.hxx>
46 #include <ATCDCL/ATISmgr.hxx>
47 #include <Autopilot/route_mgr.hxx>
48 #include <GUI/FGFontCache.hxx>
49 #include <GUI/gui.h>
50 #include <MultiPlayer/multiplaymgr.hxx>
51 #include <Scenery/scenery.hxx>
52 #include <Scenery/tilemgr.hxx>
53 #include <Navaids/navlist.hxx>
54 #include <Viewer/renderer.hxx>
55 #include <Viewer/viewmgr.hxx>
56 #include <Sound/sample_queue.hxx>
57
58 #include "globals.hxx"
59 #include "locale.hxx"
60
61 #include "fg_props.hxx"
62 #include "fg_io.hxx"
63
64 class AircraftResourceProvider : public simgear::ResourceProvider
65 {
66 public:
67   AircraftResourceProvider() :
68     simgear::ResourceProvider(simgear::ResourceManager::PRIORITY_HIGH)
69   {
70   }
71   
72   virtual SGPath resolve(const std::string& aResource, SGPath&) const
73   {
74     string_list pieces(sgPathBranchSplit(aResource));
75     if ((pieces.size() < 3) || (pieces.front() != "Aircraft")) {
76       return SGPath(); // not an Aircraft path
77     }
78     
79   // test against the aircraft-dir property
80     const char* aircraftDir = fgGetString("/sim/aircraft-dir");
81     string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir));
82     if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) {
83         // current aircraft-dir matches resource aircraft
84         SGPath r(aircraftDir);
85         for (unsigned int i=2; i<pieces.size(); ++i) {
86           r.append(pieces[i]);
87         }
88         
89         if (r.exists()) {
90           return r;
91         }
92     }
93   
94   // try each aircraft dir in turn
95     std::string res(aResource, 9); // resource path with 'Aircraft/' removed
96     const string_list& dirs(globals->get_aircraft_paths());
97     string_list::const_iterator it = dirs.begin();
98     for (; it != dirs.end(); ++it) {
99       SGPath p(*it, res);
100       if (p.exists()) {
101         return p;
102       }
103     } // of aircraft path iteration
104     
105     return SGPath(); // not found
106   }
107 };
108
109 class CurrentAircraftDirProvider : public simgear::ResourceProvider
110 {
111 public:
112   CurrentAircraftDirProvider() :
113     simgear::ResourceProvider(simgear::ResourceManager::PRIORITY_HIGH)
114   {
115   }
116   
117   virtual SGPath resolve(const std::string& aResource, SGPath&) const
118   {
119     const char* aircraftDir = fgGetString("/sim/aircraft-dir");
120     SGPath p(aircraftDir);
121     p.append(aResource);
122     return p.exists() ? p : SGPath();
123   }
124 };
125
126 ////////////////////////////////////////////////////////////////////////
127 // Implementation of FGGlobals.
128 ////////////////////////////////////////////////////////////////////////
129
130 // global global :-)
131 FGGlobals *globals = NULL;
132
133
134 // Constructor
135 FGGlobals::FGGlobals() :
136     initial_state( NULL ),
137     renderer( new FGRenderer ),
138     subsystem_mgr( new SGSubsystemMgr ),
139     event_mgr( new SGEventMgr ),
140     sim_time_sec( 0.0 ),
141     fg_root( "" ),
142     fg_home( "" ),
143     time_params( NULL ),
144     ephem( NULL ),
145     matlib( NULL ),
146     route_mgr( NULL ),
147     ATIS_mgr( NULL ),
148     controls( NULL ),
149     viewmgr( NULL ),
150     commands( SGCommandMgr::instance() ),
151     channel_options_list( NULL ),
152     initial_waypoints( NULL ),
153     fontcache ( new FGFontCache ),
154     channellist( NULL ),
155     haveUserSettings(false),
156     _chatter_queue(NULL)
157 {
158     SGPropertyNode* root = new SGPropertyNode;
159     props = SGPropertyNode_ptr(root);
160     locale = new FGLocale(props);
161     
162     simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider);
163     simgear::ResourceManager::instance()->addProvider(new CurrentAircraftDirProvider);
164     initProperties();
165 }
166
167 void FGGlobals::initProperties()
168 {
169     simgear::PropertyObjectBase::setDefaultRoot(props);
170     
171     positionLon = props->getNode("position/longitude-deg", true);
172     positionLat = props->getNode("position/latitude-deg", true);
173     positionAlt = props->getNode("position/altitude-ft", true);
174     
175     viewLon = props->getNode("sim/current-view/viewer-lon-deg", true);
176     viewLat = props->getNode("sim/current-view/viewer-lat-deg", true);
177     viewAlt = props->getNode("sim/current-view/viewer-elev-ft", true);
178     
179     orientPitch = props->getNode("orientation/pitch-deg", true);
180     orientHeading = props->getNode("orientation/heading-deg", true);
181     orientRoll = props->getNode("orientation/roll-deg", true);
182
183 }
184
185 // Destructor
186 FGGlobals::~FGGlobals() 
187 {
188     // save user settings (unless already saved)
189     saveUserSettings();
190
191     // The AIModels manager performs a number of actions upon
192     // Shutdown that implicitly assume that other subsystems
193     // are still operational (Due to the dynamic allocation and
194     // deallocation of AIModel objects. To ensure we can safely
195     // shut down all subsystems, make sure we take down the 
196     // AIModels system first.
197     SGSubsystemRef ai = subsystem_mgr->get_subsystem("ai-model");
198     if (ai) {
199         subsystem_mgr->remove("ai-model");
200         ai->unbind();
201         ai.clear(); // ensure AI is deleted now, not at end of this method
202     }
203     
204     subsystem_mgr->shutdown();
205     subsystem_mgr->unbind();    
206
207     subsystem_mgr->remove("aircraft-model");
208     subsystem_mgr->remove("tile-manager");
209     subsystem_mgr->remove("model-manager");
210     _tile_mgr.clear();
211
212     // renderer touches subsystems during its destruction
213     set_renderer(NULL);
214     _scenery.clear();
215     _chatter_queue.clear();
216     
217     delete subsystem_mgr;
218     subsystem_mgr = NULL; // important so ::get_subsystem returns NULL 
219
220     delete time_params;
221     set_matlib(NULL);
222     delete route_mgr;
223     delete ATIS_mgr;
224     delete channel_options_list;
225     delete initial_waypoints;
226     delete fontcache;
227     delete channellist;
228
229     simgear::PropertyObjectBase::setDefaultRoot(NULL);
230     simgear::SGModelLib::resetPropertyRoot();
231     
232     delete locale;
233     locale = NULL;
234     
235     props.clear();
236     
237     delete commands;
238 }
239
240 // set the fg_root path
241 void FGGlobals::set_fg_root (const std::string &root) {
242     SGPath tmp(root);
243     fg_root = tmp.realpath();
244
245     // append /data to root if it exists
246     tmp.append( "data" );
247     tmp.append( "version" );
248     if ( tmp.exists() ) {
249         fgGetNode("BAD_FG_ROOT", true)->setStringValue(fg_root);
250         fg_root += "/data";
251         fgGetNode("GOOD_FG_ROOT", true)->setStringValue(fg_root);
252         SG_LOG(SG_GENERAL, SG_ALERT, "***\n***\n*** Warning: changing bad FG_ROOT/--fg-root to '"
253                 << fg_root << "'\n***\n***");
254     }
255
256     // remove /sim/fg-root before writing to prevent hijacking
257     SGPropertyNode *n = fgGetNode("/sim", true);
258     n->removeChild("fg-root", 0, false);
259     n = n->getChild("fg-root", 0, true);
260     n->setStringValue(fg_root.c_str());
261     n->setAttribute(SGPropertyNode::WRITE, false);
262     
263     simgear::ResourceManager::instance()->addBasePath(fg_root, 
264       simgear::ResourceManager::PRIORITY_DEFAULT);
265 }
266
267 // set the fg_home path
268 void FGGlobals::set_fg_home (const std::string &home) {
269     SGPath tmp(home);
270     fg_home = tmp.realpath();
271 }
272
273 PathList FGGlobals::get_data_paths() const
274 {
275     PathList r(additional_data_paths);
276     r.push_back(SGPath(fg_root));
277     return r;
278 }
279
280 PathList FGGlobals::get_data_paths(const std::string& suffix) const
281 {
282     PathList r;
283     BOOST_FOREACH(SGPath p, get_data_paths()) {
284         p.append(suffix);
285         if (p.exists()) {
286             r.push_back(p);
287         }
288     }
289
290     return r;
291 }
292
293 void FGGlobals::append_data_path(const SGPath& path)
294 {
295     if (!path.exists()) {
296         SG_LOG(SG_GENERAL, SG_WARN, "adding non-existant data path:" << path);
297     }
298     
299     additional_data_paths.push_back(path);
300 }
301
302 SGPath FGGlobals::find_data_dir(const std::string& pathSuffix) const
303 {
304     BOOST_FOREACH(SGPath p, additional_data_paths) {
305         p.append(pathSuffix);
306         if (p.exists()) {
307             return p;
308         }
309     }
310     
311     SGPath rootPath(fg_root);
312     rootPath.append(pathSuffix);
313     if (rootPath.exists()) {
314         return rootPath;
315     }
316     
317     SG_LOG(SG_GENERAL, SG_WARN, "dir not found in any data path:" << pathSuffix);
318     return SGPath();
319 }
320
321 void FGGlobals::append_fg_scenery (const std::string &paths)
322 {
323 //    fg_scenery.clear();
324     SGPropertyNode* sim = fgGetNode("/sim", true);
325
326   // find first unused fg-scenery property in /sim
327     int propIndex = 0;
328     while (sim->getChild("fg-scenery", propIndex) != NULL) {
329       ++propIndex; 
330     }
331   
332     BOOST_FOREACH(const SGPath& path, sgPathSplit( paths )) {
333         SGPath abspath(path.realpath());
334         if (!abspath.exists()) {
335           SG_LOG(SG_GENERAL, SG_WARN, "scenery path not found:" << abspath.str());
336           continue;
337         }
338
339       // check for duplicates
340       string_list::const_iterator ex = std::find(fg_scenery.begin(), fg_scenery.end(), abspath.str());
341       if (ex != fg_scenery.end()) {
342         SG_LOG(SG_GENERAL, SG_INFO, "skipping duplicate add of scenery path:" << abspath.str());
343         continue;
344       }
345       
346         simgear::Dir dir(abspath);
347         SGPath terrainDir(dir.file("Terrain"));
348         SGPath objectsDir(dir.file("Objects"));
349         
350       // this code used to add *either* the base dir, OR add the 
351       // Terrain and Objects subdirs, but the conditional logic was commented
352       // out, such that all three dirs are added. Unfortunately there's
353       // no information as to why the change was made.
354         fg_scenery.push_back(abspath.str());
355         
356         if (terrainDir.exists()) {
357           fg_scenery.push_back(terrainDir.str());
358         }
359         
360         if (objectsDir.exists()) {
361           fg_scenery.push_back(objectsDir.str());
362         }
363         
364         // insert a marker for FGTileEntry::load(), so that
365         // FG_SCENERY=A:B becomes list ["A/Terrain", "A/Objects", "",
366         // "B/Terrain", "B/Objects", ""]
367         fg_scenery.push_back("");
368         
369       // make scenery dirs available to Nasal
370         SGPropertyNode* n = sim->getChild("fg-scenery", propIndex++, true);
371         n->setStringValue(abspath.str());
372         n->setAttribute(SGPropertyNode::WRITE, false);
373     } // of path list iteration
374 }
375
376 void FGGlobals::append_aircraft_path(const std::string& path)
377 {
378   SGPath dirPath(path);
379   if (!dirPath.exists()) {
380     SG_LOG(SG_GENERAL, SG_WARN, "aircraft path not found:" << path);
381     return;
382   }
383   std::string abspath = dirPath.realpath();
384   
385   unsigned int index = fg_aircraft_dirs.size();  
386   fg_aircraft_dirs.push_back(abspath);
387   
388 // make aircraft dirs available to Nasal
389   SGPropertyNode* sim = fgGetNode("/sim", true);
390   sim->removeChild("fg-aircraft", index, false);
391   SGPropertyNode* n = sim->getChild("fg-aircraft", index, true);
392   n->setStringValue(abspath);
393   n->setAttribute(SGPropertyNode::WRITE, false);
394 }
395
396 void FGGlobals::append_aircraft_paths(const std::string& path)
397 {
398   string_list paths = sgPathSplit(path);
399   for (unsigned int p = 0; p<paths.size(); ++p) {
400     append_aircraft_path(paths[p]);
401   }
402 }
403
404 SGPath FGGlobals::resolve_aircraft_path(const std::string& branch) const
405 {
406   return simgear::ResourceManager::instance()->findPath(branch);
407 }
408
409 SGPath FGGlobals::resolve_maybe_aircraft_path(const std::string& branch) const
410 {
411   return simgear::ResourceManager::instance()->findPath(branch);
412 }
413
414 SGPath FGGlobals::resolve_resource_path(const std::string& branch) const
415 {
416   return simgear::ResourceManager::instance()
417     ->findPath(branch, SGPath(fgGetString("/sim/aircraft-dir")));
418 }
419
420 FGRenderer *
421 FGGlobals::get_renderer () const
422 {
423    return renderer;
424 }
425
426 void FGGlobals::set_renderer(FGRenderer *render)
427 {
428     if (render == renderer) {
429         return;
430     }
431     
432     delete renderer;
433     renderer = render;
434 }
435
436 SGSubsystemMgr *
437 FGGlobals::get_subsystem_mgr () const
438 {
439     return subsystem_mgr;
440 }
441
442 SGSubsystem *
443 FGGlobals::get_subsystem (const char * name)
444 {
445     if (!subsystem_mgr) {
446         return NULL;
447     }
448     
449     return subsystem_mgr->get_subsystem(name);
450 }
451
452 void
453 FGGlobals::add_subsystem (const char * name,
454                           SGSubsystem * subsystem,
455                           SGSubsystemMgr::GroupType type,
456                           double min_time_sec)
457 {
458     subsystem_mgr->add(name, subsystem, type, min_time_sec);
459 }
460
461 SGSoundMgr *
462 FGGlobals::get_soundmgr () const
463 {
464     if (subsystem_mgr)
465         return (SGSoundMgr*) subsystem_mgr->get_subsystem("sound");
466
467     return NULL;
468 }
469
470 SGEventMgr *
471 FGGlobals::get_event_mgr () const
472 {
473     return event_mgr;
474 }
475
476 SGGeod
477 FGGlobals::get_aircraft_position() const
478 {
479   return SGGeod::fromDegFt(positionLon->getDoubleValue(),
480                            positionLat->getDoubleValue(),
481                            positionAlt->getDoubleValue());
482 }
483
484 SGVec3d
485 FGGlobals::get_aircraft_position_cart() const
486 {
487     return SGVec3d::fromGeod(get_aircraft_position());
488 }
489
490 void FGGlobals::get_aircraft_orientation(double& heading, double& pitch, double& roll)
491 {
492   heading = orientHeading->getDoubleValue();
493   pitch = orientPitch->getDoubleValue();
494   roll = orientRoll->getDoubleValue();
495 }
496
497 SGGeod
498 FGGlobals::get_view_position() const
499 {
500   return SGGeod::fromDegFt(viewLon->getDoubleValue(),
501                            viewLat->getDoubleValue(),
502                            viewAlt->getDoubleValue());
503 }
504
505 SGVec3d
506 FGGlobals::get_view_position_cart() const
507 {
508   return SGVec3d::fromGeod(get_view_position());
509 }
510
511 static void treeDumpRefCounts(int depth, SGPropertyNode* nd)
512 {
513     for (int i=0; i<nd->nChildren(); ++i) {
514         SGPropertyNode* cp = nd->getChild(i);
515         if (SGReferenced::count(cp) > 1) {
516             SG_LOG(SG_GENERAL, SG_INFO, "\t" << cp->getPath() << " refcount:" << SGReferenced::count(cp));
517         }
518         
519         treeDumpRefCounts(depth + 1, cp);
520     }
521 }
522
523 void
524 FGGlobals::resetPropertyRoot()
525 {
526     delete locale;
527     
528     SG_LOG(SG_GENERAL, SG_INFO, "root props refcount:" << props.getNumRefs());
529     treeDumpRefCounts(0, props);
530
531     props = new SGPropertyNode;
532     initProperties();
533     locale = new FGLocale(props);
534     
535     // remove /sim/fg-root before writing to prevent hijacking
536     SGPropertyNode *n = props->getNode("/sim", true);
537     n->removeChild("fg-root", 0, false);
538     n = n->getChild("fg-root", 0, true);
539     n->setStringValue(fg_root.c_str());
540     n->setAttribute(SGPropertyNode::WRITE, false);
541 }
542
543 // Save the current state as the initial state.
544 void
545 FGGlobals::saveInitialState ()
546 {
547   initial_state = new SGPropertyNode();
548
549   // copy properties which are READ/WRITEable - but not USERARCHIVEd or PRESERVEd
550   int checked  = SGPropertyNode::READ+SGPropertyNode::WRITE+
551                  SGPropertyNode::USERARCHIVE+SGPropertyNode::PRESERVE;
552   int expected = SGPropertyNode::READ+SGPropertyNode::WRITE;
553   if (!copyProperties(props, initial_state, expected, checked))
554     SG_LOG(SG_GENERAL, SG_ALERT, "Error saving initial state");
555     
556   // delete various properties from the initial state, since we want to
557   // preserve their values even if doing a restore
558   // => Properties should now use the PRESERVE flag to protect their values
559   // on sim-reset. Remove some specific properties for backward compatibility.
560   SGPropertyNode* sim = initial_state->getChild("sim");
561   SGPropertyNode* cameraGroupNode = sim->getNode("rendering/camera-group");
562   if (cameraGroupNode) {
563     cameraGroupNode->removeChild("camera");
564     cameraGroupNode->removeChild("gui");
565   }
566 }
567
568 static std::string autosaveName()
569 {
570     std::ostringstream os;
571     string_list versionParts = simgear::strutils::split(VERSION, ".");
572     if (versionParts.size() < 2) {
573         return "autosave.xml";
574     }
575     
576     os << "autosave_" << versionParts[0] << "_" << versionParts[1] << ".xml";
577     return os.str();
578 }
579
580 // Restore the saved initial state, if any
581 void
582 FGGlobals::restoreInitialState ()
583 {
584     if ( initial_state == 0 ) {
585         SG_LOG(SG_GENERAL, SG_ALERT,
586                "No initial state available to restore!!!");
587         return;
588     }
589     // copy properties which are READ/WRITEable - but not USERARCHIVEd or PRESERVEd
590     int checked  = SGPropertyNode::READ+SGPropertyNode::WRITE+
591                    SGPropertyNode::USERARCHIVE+SGPropertyNode::PRESERVE;
592     int expected = SGPropertyNode::READ+SGPropertyNode::WRITE;
593     if ( copyProperties(initial_state, props, expected, checked)) {
594         SG_LOG( SG_GENERAL, SG_INFO, "Initial state restored successfully" );
595     } else {
596         SG_LOG( SG_GENERAL, SG_INFO,
597                 "Some errors restoring initial state (read-only props?)" );
598     }
599
600 }
601
602 // Load user settings from autosave.xml
603 void
604 FGGlobals::loadUserSettings(const SGPath& dataPath)
605 {
606     // remember that we have (tried) to load any existing autsave.xml
607     haveUserSettings = true;
608
609     SGPath autosaveFile = simgear::Dir(dataPath).file(autosaveName());
610     SGPropertyNode autosave;
611     if (autosaveFile.exists()) {
612       SG_LOG(SG_INPUT, SG_INFO, "Reading user settings from " << autosaveFile.str());
613       try {
614           readProperties(autosaveFile.str(), &autosave, SGPropertyNode::USERARCHIVE);
615       } catch (sg_exception& e) {
616           SG_LOG(SG_INPUT, SG_WARN, "failed to read user settings:" << e.getMessage()
617             << "(from " << e.getOrigin() << ")");
618       }
619     }
620     copyProperties(&autosave, globals->get_props());
621 }
622
623 // Save user settings in autosave.xml
624 void
625 FGGlobals::saveUserSettings()
626 {
627     // only save settings when we have (tried) to load the previous
628     // settings (otherwise user data was lost)
629     if (!haveUserSettings)
630         return;
631
632     if (fgGetBool("/sim/startup/save-on-exit")) {
633       // don't save settings more than once on shutdown
634       haveUserSettings = false;
635
636       SGPath autosaveFile(globals->get_fg_home());
637       autosaveFile.append(autosaveName());
638       autosaveFile.create_dir( 0700 );
639       SG_LOG(SG_IO, SG_INFO, "Saving user settings to " << autosaveFile.str());
640       try {
641         writeProperties(autosaveFile.str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);
642       } catch (const sg_exception &e) {
643         guiErrorMessage("Error writing autosave:", e);
644       }
645       SG_LOG(SG_INPUT, SG_DEBUG, "Finished Saving user settings");
646     }
647 }
648
649 FGViewer *
650 FGGlobals::get_current_view () const
651 {
652   return viewmgr->get_current_view();
653 }
654
655 long int FGGlobals::get_warp() const
656 {
657   return fgGetInt("/sim/time/warp");
658 }
659
660 void FGGlobals::set_warp( long int w )
661 {
662   fgSetInt("/sim/time/warp", w);
663 }
664
665 long int FGGlobals::get_warp_delta() const
666 {
667   return fgGetInt("/sim/time/warp-delta");
668 }
669
670 void FGGlobals::set_warp_delta( long int d )
671 {
672   fgSetInt("/sim/time/warp-delta", d);
673 }
674
675 FGScenery* FGGlobals::get_scenery () const
676 {
677     return _scenery.get();
678 }
679
680 void FGGlobals::set_scenery ( FGScenery *s )
681 {
682     _scenery = s;
683 }
684
685 FGTileMgr* FGGlobals::get_tile_mgr () const
686 {
687     return _tile_mgr.get();
688 }
689
690 void FGGlobals::set_tile_mgr ( FGTileMgr *t )
691 {
692     _tile_mgr = t;
693 }
694
695 void FGGlobals::set_matlib( SGMaterialLib *m )
696 {
697     if (matlib)
698         delete matlib;
699     matlib = m;
700 }
701
702 FGSampleQueue* FGGlobals::get_chatter_queue() const
703 {
704     return _chatter_queue;
705 }
706
707 void FGGlobals::set_chatter_queue(FGSampleQueue* queue)
708 {
709     _chatter_queue = queue;
710 }
711
712 // end of globals.cxx