//////////////////////////////////////////////////////////////////////////////// // // Filename : Global.cpp // Purpose : Global Initalization. // // Project : WordBreakers // Component: English word breaker // // Author : yairh // // Log: // // May 30 2000 yairh creation // //////////////////////////////////////////////////////////////////////////////// #include "base.h" #include "tokenizer.h" #include "formats.h" #include "synchro.h" extern CAutoClassPointer g_pPropArray; static bool s_fGlobalInit = false; static CSyncCriticalSection s_csGlobalInit; void InitializeGlobalData() { if (s_fGlobalInit) { return; } CSyncMutexCatcher cs(s_csGlobalInit); if (s_fGlobalInit) { return; } CAutoClassPointer apPropArray = new CPropArray; CAutoClassPointer apClitics = new CClitics; CAutoClassPointer apEngAbbList = new CSpecialAbbreviationSet(g_aEngAbbList); CAutoClassPointer apFrnAbbList = new CSpecialAbbreviationSet(g_aFrenchAbbList); CAutoClassPointer apSpnAbbList = new CSpecialAbbreviationSet(g_aSpanishAbbList); CAutoClassPointer apItlAbbList = new CSpecialAbbreviationSet(g_aItalianAbbList); CAutoClassPointer apDateFormat = new CDateFormat; CAutoClassPointer apTimeFormat = new CTimeFormat; g_pPropArray = apPropArray.Detach(); g_pClitics = apClitics.Detach(); g_pEngAbbList = apEngAbbList.Detach() ; g_pFrnAbbList = apFrnAbbList.Detach(); g_pSpnAbbList = apSpnAbbList.Detach() ; g_pItlAbbList = apItlAbbList.Detach() ; g_pDateFormat = apDateFormat.Detach(); g_pTimeFormat = apTimeFormat.Detach(); s_fGlobalInit = true; }