Opera 12.15 Source Code
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.

stdlib_module.h 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
  2. **
  3. ** Copyright (C) 2005-2007 Opera Software ASA. All rights reserved.
  4. **
  5. ** This file is part of the Opera web browser. It may not be distributed
  6. ** under any circumstances.
  7. */
  8. #ifndef MODULES_STDLIB_STDLIB_MODULE_H
  9. #define MODULES_STDLIB_STDLIB_MODULE_H
  10. #define STDLIB_MODULE_REQUIRED
  11. #ifdef STDLIB_MODULE_REQUIRED
  12. #include "modules/hardcore/opera/module.h"
  13. #ifdef DTOA_DAVID_M_GAY
  14. struct Bigint;
  15. #endif // DTOA_DAVID_M_GAY
  16. #ifdef STDLIB_DTOA_CONVERSION
  17. # if defined(DTOA_DAVID_M_GAY) && defined(DTOA_FLOITSCH_DOUBLE_CONVERSION)
  18. # error "DTOA_DAVID_M_GAY and DTOA_FLOITSCH_DOUBLE_CONVERSION are mutually exclusive 3P features"
  19. # endif
  20. #endif // STDLIB_DTOA_CONVERSION
  21. #if defined CORE_GOGI_MEMORY_DEBUG && defined DTOA_DAVID_M_GAY
  22. /** Enable dtoa locking if op_malloc() can call dtoa functions, or op_printf
  23. * with floating point numbers. */
  24. # define STDLIB_DTOA_LOCKS
  25. #endif // CORE_GOGI_MEMORY_DEBUG || DTOA_DAVID_M_GAY
  26. class StdlibModule : public OperaModule
  27. {
  28. public:
  29. StdlibModule();
  30. virtual void InitL(const OperaInitInfo& info);
  31. virtual void Destroy();
  32. virtual BOOL FreeCachedData(BOOL toplevel_context);
  33. #ifndef HAVE_GMTIME
  34. struct tm m_gmtime_result;
  35. #endif
  36. #ifndef HAVE_UNI_STRTOK
  37. uni_char *m_uni_strtok_datum;
  38. #endif
  39. #ifdef DTOA_DAVID_M_GAY
  40. Bigint *m_dtoa_freelist[16]; // Lifted from dtoa.cpp
  41. Bigint *m_dtoa_p5s; // ditto
  42. char *m_dtoa_result; // ditto
  43. # ifdef _DEBUG
  44. int m_dtoa_blocks_allocated; // ditto
  45. int m_dtoa_blocks_freed; // ditto
  46. int m_dtoa_blocks[16]; // ditto
  47. # endif // _DEBUG
  48. #endif // DTOA_DAVID_M_GAY
  49. #ifndef HAVE_RAND
  50. # ifdef MERSENNE_TWISTER_RNG
  51. UINT32 m_mt[624]; // the array for the state vector
  52. int m_mti; // mti==N+1 means mt[N] is not initialized
  53. UINT32 m_mag01[2]; // working storage for the generator
  54. # else
  55. int m_random_state; // state of simple RNG
  56. # endif // MERSENNE_TWISTER_RNG
  57. #endif // !HAVE_RAND
  58. double m_infinity; // +Infinity
  59. #if !defined STDLIB_DTOA_CONVERSION && !defined HAVE_STRTOD && !defined HAVE_SSCANF
  60. double m_negative_infinity; // -Infinity
  61. #endif
  62. double m_quiet_nan; // QNaN
  63. #ifdef DTOA_FLOITSCH_DOUBLE_CONVERSION
  64. // dtoa result buffer.
  65. char m_dtoa_buffer[33]; // ARRAY OK 2011-10-27 sof
  66. #endif // DTOA_FLOITSCH_DOUBLE_CONVERSION
  67. #ifdef STDLIB_DTOA_LOCKS
  68. bool LockDtoa(int lock);
  69. void UnlockDtoa(int lock);
  70. int m_dtoa_lock;
  71. #endif // STDLIB_DTOA_LOCKS
  72. };
  73. #define g_stdlib_infinity g_opera->stdlib_module.m_infinity
  74. #define g_stdlib_quiet_nan g_opera->stdlib_module.m_quiet_nan
  75. #ifdef DTOA_FLOITSCH_DOUBLE_CONVERSION
  76. #define g_stdlib_dtoa_buffer g_opera->stdlib_module.m_dtoa_buffer
  77. #endif // DTOA_FLOITSCH_DOUBLE_CONVERSION
  78. #endif // STDLIB_MODULE_REQUIRED
  79. #endif // !MODULES_STDLIB_STDLIB_MODULE_H