Leaked source code of windows server 2003
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.

87 lines
2.3 KiB

  1. /***
  2. *iostrini.cpp - definition and initialization for predefined stream cout.
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Definition and initialization of and predefined iostream cout.
  8. *
  9. *Revision History:
  10. * 11-18-91 KRS Created.
  11. * 01-12-95 CFW Debug CRT allocs.
  12. * 01-26-94 CFW Static Win32s objects do not alloc on instantiation.
  13. * 06-14-95 CFW Comment cleanup.
  14. * 05-13-99 PML Remove Win32s
  15. *
  16. *******************************************************************************/
  17. #include <cruntime.h>
  18. #include <internal.h>
  19. #include <iostream.h>
  20. #include <fstream.h>
  21. #include <dbgint.h>
  22. #pragma hdrstop
  23. // put contructors in special MS-specific XIFM segment
  24. #pragma warning(disable:4074) // disable init_seg warning
  25. #pragma init_seg(compiler)
  26. ostream_withassign cout(_new_crt filebuf(1));
  27. static Iostream_init __InitCout(cout,-1);
  28. /***
  29. *Iostream_init::Iostream_init() - initialize predefined streams
  30. *
  31. *Purpose:
  32. * For compatibility only. Not used.
  33. *Entry:
  34. *
  35. *Exit:
  36. *
  37. *Exceptions:
  38. *
  39. *******************************************************************************/
  40. Iostream_init::Iostream_init() { } // do nothing
  41. /***
  42. *Iostream_init::Iostream_init() - initialize predefined streams
  43. *
  44. *Purpose:
  45. * Initializes predefined streams: cin, cout, cerr, clog;
  46. *Entry:
  47. * pstrm = cin, cout, cerr, or clog
  48. * sflg = 1 if cerr (unit buffered)
  49. * sflg = -1 if cout
  50. *
  51. *Exit:
  52. *
  53. *Exceptions:
  54. *
  55. *******************************************************************************/
  56. Iostream_init::Iostream_init(ios& pstrm, int sflg)
  57. {
  58. #if ((!defined(_WINDOWS)) || defined(_QWIN))
  59. pstrm.delbuf(1);
  60. if (sflg>=0) // make sure not cout
  61. pstrm.tie(&cout);
  62. if (sflg>0)
  63. pstrm.setf(ios::unitbuf);
  64. #endif
  65. }
  66. /***
  67. *Iostream_init::~Iostream_init() - destroy predefined streams on exit
  68. *
  69. *Purpose:
  70. * Destroy predefined streams: cin, cout, cerr, clog;
  71. *Entry:
  72. *
  73. *Exit:
  74. *
  75. *Exceptions:
  76. *
  77. *******************************************************************************/
  78. Iostream_init::~Iostream_init() { } // do nothing