summaryrefslogtreecommitdiffstats
path: root/private/crt32/iostream/ostrshrt.cxx
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/iostream/ostrshrt.cxx
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/iostream/ostrshrt.cxx')
-rw-r--r--private/crt32/iostream/ostrshrt.cxx56
1 files changed, 56 insertions, 0 deletions
diff --git a/private/crt32/iostream/ostrshrt.cxx b/private/crt32/iostream/ostrshrt.cxx
new file mode 100644
index 000000000..e4818c15d
--- /dev/null
+++ b/private/crt32/iostream/ostrshrt.cxx
@@ -0,0 +1,56 @@
+/***
+* ostrshrt.cxx - definitions for ostream class operator<<(short) member functions
+*
+* Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains the member function definitions for ostream operator<<(short).
+*
+*Revision History:
+* 09-23-91 KRS Created. Split out from ostream.cxx for granularity.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <internal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream.h>
+#pragma hdrstop
+
+ostream& ostream::operator<<(short n)
+{
+_WINSTATIC char obuffer[8]; // CONSIDER: assumes max int is 65535
+_WINSTATIC char fmt[4] = "%hd";
+_WINSTATIC char leader[4] = "\0\0";
+ if (opfx()) {
+
+ if (n)
+ {
+ if (x_flags & (hex|oct))
+ {
+ if (x_flags & hex)
+ {
+ if (x_flags & uppercase)
+ fmt[2] = 'X';
+ else
+ fmt[2] = 'x';
+ leader[1] = fmt[2]; // 0x or 0X (or \0X)
+ }
+ else
+ fmt[2] = 'o';
+ if (x_flags & showbase)
+ leader[0] = '0';
+ }
+ else if ((n>0) && (x_flags & showpos))
+ {
+ leader[0] = '+';
+ }
+ }
+ sprintf(obuffer,fmt,n);
+ writepad(leader,obuffer);
+ osfx();
+ }
+ return *this;
+
+}