Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Filename : Global.cpp
  4. // Purpose : Global Initalization.
  5. //
  6. // Project : WordBreakers
  7. // Component: English word breaker
  8. //
  9. // Author : yairh
  10. //
  11. // Log:
  12. //
  13. // May 30 2000 yairh creation
  14. //
  15. ////////////////////////////////////////////////////////////////////////////////
  16. #include "base.h"
  17. #include "tokenizer.h"
  18. #include "formats.h"
  19. #include "synchro.h"
  20. extern CAutoClassPointer<CPropArray> g_pPropArray;
  21. static bool s_fGlobalInit = false;
  22. static CSyncCriticalSection s_csGlobalInit;
  23. void InitializeGlobalData()
  24. {
  25. if (s_fGlobalInit)
  26. {
  27. return;
  28. }
  29. CSyncMutexCatcher cs(s_csGlobalInit);
  30. if (s_fGlobalInit)
  31. {
  32. return;
  33. }
  34. CAutoClassPointer<CPropArray> apPropArray = new CPropArray;
  35. CAutoClassPointer<CClitics> apClitics = new CClitics;
  36. CAutoClassPointer<CSpecialAbbreviationSet> apEngAbbList = new CSpecialAbbreviationSet(g_aEngAbbList);
  37. CAutoClassPointer<CSpecialAbbreviationSet> apFrnAbbList = new CSpecialAbbreviationSet(g_aFrenchAbbList);
  38. CAutoClassPointer<CSpecialAbbreviationSet> apSpnAbbList = new CSpecialAbbreviationSet(g_aSpanishAbbList);
  39. CAutoClassPointer<CSpecialAbbreviationSet> apItlAbbList = new CSpecialAbbreviationSet(g_aItalianAbbList);
  40. CAutoClassPointer<CDateFormat> apDateFormat = new CDateFormat;
  41. CAutoClassPointer<CTimeFormat> apTimeFormat = new CTimeFormat;
  42. g_pPropArray = apPropArray.Detach();
  43. g_pClitics = apClitics.Detach();
  44. g_pEngAbbList = apEngAbbList.Detach() ;
  45. g_pFrnAbbList = apFrnAbbList.Detach();
  46. g_pSpnAbbList = apSpnAbbList.Detach() ;
  47. g_pItlAbbList = apItlAbbList.Detach() ;
  48. g_pDateFormat = apDateFormat.Detach();
  49. g_pTimeFormat = apTimeFormat.Detach();
  50. s_fGlobalInit = true;
  51. }