-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.h
More file actions
1963 lines (1677 loc) · 70.5 KB
/
Header.h
File metadata and controls
1963 lines (1677 loc) · 70.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
NAME - MyButami™ Source© Include File
AUTHORS - Swaroop Bhonde & Omkar Ekbote
DESCRIPTION - Compilation of all required include directives for MyButami™ Source©
COPYRIGHT - Individual Copyrights to:
Copyright (c) 1990, 1991 by Borland International
All rights reserved.
VERSION - v1.0 (Designed for v0.9.0 BETA)
DATE/TIME - 15/02/07 21:51
VERSION SPECIFICATIONS - Includes the content of the following files (embedded):
iostream.h : Stardard I/O Compaitibility
conio.h : Console I/O Compaitibility
process.h : Library Functions : exit()
dos.h : Library Functions : delay()
string.h : String Library
grapihcs.h : MyButami™ GUI Module Compaitibility
USAGE - To be included in all future versions of MyButami™ Source© v0.9.0+
*/
/* iostream.h -- basic stream I/O declarations
Copyright (c) 1990, 1991 by Borland International
All rights reserved.
There are some inline functions here which generate a LOT of code
(as much as 300 bytes), but are available inline because AT&T did
it that way. We have also made them true functions in the library
and conditionally deleted the inline code from this header.
If you really want these big functions to be inline, #define the
macro name _BIG_INLINE_ before including this header.
Programs will compile and link correctly even if some modules are
compiled with _BIG_INLINE_ and some are not.
*/
#ifndef __cplusplus
#error Must use C++ for the type iostream.
#endif
#ifndef __IOSTREAM_H
#define __IOSTREAM_H
#if !defined( __DEFS_H )
#include <_defs.h>
#endif
#if !defined( __MEM_H )
#include <mem.h> // to get memcpy and NULL
#endif
#pragma option -Vo-
// Definition of EOF must match the one in <stdio.h>
#define EOF (-1)
// extract a char from int i, ensuring that zapeof(EOF) != EOF
#define zapeof(i) ((unsigned char)(i))
typedef long streampos;
typedef long streamoff;
_CLASSDEF(ios)
_CLASSDEF(streambuf)
_CLASSDEF(istream)
_CLASSDEF(ostream)
_CLASSDEF(iostream)
_CLASSDEF(istream_withassign)
_CLASSDEF(ostream_withassign)
_CLASSDEF(iostream_withassign)
class _CLASSTYPE ios {
public:
// stream status bits
enum io_state {
goodbit = 0x00, // no bit set: all is ok
eofbit = 0x01, // at end of file
failbit = 0x02, // last I/O operation failed
badbit = 0x04, // invalid operation attempted
hardfail = 0x80 // unrecoverable error
};
// stream operation mode
enum open_mode {
in = 0x01, // open for reading
out = 0x02, // open for writing
ate = 0x04, // seek to eof upon original open
app = 0x08, // append mode: all additions at eof
trunc = 0x10, // truncate file if already exists
nocreate = 0x20, // open fails if file doesn't exist
noreplace= 0x40, // open fails if file already exists
binary = 0x80 // binary (not text) file
};
// stream seek direction
enum seek_dir { beg=0, cur=1, end=2 };
// formatting flags
enum {
skipws = 0x0001, // skip whitespace on input
left = 0x0002, // left-adjust output
right = 0x0004, // right-adjust output
internal = 0x0008, // padding after sign or base indicator
dec = 0x0010, // decimal conversion
oct = 0x0020, // octal conversion
hex = 0x0040, // hexadecimal conversion
showbase = 0x0080, // use base indicator on output
showpoint = 0x0100, // force decimal point (floating output)
uppercase = 0x0200, // upper-case hex output
showpos = 0x0400, // add '+' to positive integers
scientific= 0x0800, // use 1.2345E2 floating notation
fixed = 0x1000, // use 123.45 floating notation
unitbuf = 0x2000, // flush all streams after insertion
stdio = 0x4000 // flush stdout, stderr after insertion
};
// constants for second parameter of seft()
static const long basefield; // dec | oct | hex
static const long adjustfield; // left | right | internal
static const long floatfield; // scientific | fixed
// constructor, destructor
_Cdecl ios(streambuf *);
virtual _Cdecl ~ios();
// for reading/setting/clearing format flags
long _Cdecl flags();
long _Cdecl flags(long);
long _Cdecl setf(long _setbits, long _field);
long _Cdecl setf(long);
long _Cdecl unsetf(long);
// reading/setting field width
int _Cdecl width();
int _Cdecl width(int);
// reading/setting padding character
char _Cdecl fill();
char _Cdecl fill(char);
// reading/setting digits of floating precision
int _Cdecl precision(int);
int _Cdecl precision();
// reading/setting ostream tied to this stream
ostream * _Cdecl tie(ostream *);
ostream * _Cdecl tie();
// find out about current stream state
int _Cdecl rdstate(); // return the stream state
int _Cdecl eof(); // non-zero on end of file
int _Cdecl fail(); // non-zero if an operation failed
int _Cdecl bad(); // non-zero if error occurred
int _Cdecl good(); // non-zero if no state bits set
void _Cdecl clear(int = 0); // set the stream state
_Cdecl operator void * (); // zero if state failed
int _Cdecl operator! (); // non-zero if state failed
streambuf * _Cdecl rdbuf(); // get the assigned streambuf
// for declaring additional flag bits and user words
static long _Cdecl bitalloc(); // acquire a new flag bit, value returned
static int _Cdecl xalloc(); // acquire a new user word, index returned
long & _Cdecl iword(int); // return the nth user word as an int
void * & _Cdecl pword(int); // return the nth user word as a pointer
static void _Cdecl sync_with_stdio();
// obsolete, for streams 1.2 compatibility
int _Cdecl skip(int);
protected:
// additional state flags for ispecial and ospecial
enum { skipping = 0x100, tied = 0x200 };
streambuf * bp; // the associated streambuf
ostream * x_tie; // the tied ostream, if any
int state; // status bits
int ispecial; // istream status bits ***
int ospecial; // ostream status bits ***
long x_flags; // formatting flag bits
int x_precision; // floating-point precision on output
int x_width; // field width on output
int x_fill; // padding character on output
int isfx_special; // unused ***
int osfx_special; // unused ***
int delbuf; // unused ***
int assign_private; // unused ***
/*
* The data members marked with *** above are not documented in the AT&T
* release of streams, so we cannot guarantee compatibility with any
* other streams release in the use or values of these data members.
* If you can document any expected behavior of these data members, we
* will try to adjust our implementation accordingly.
*/
_Cdecl ios(); // null constructor, does not initialize
void _Cdecl init(streambuf *); // the actual initialization
void _Cdecl setstate(int); // set all status bits
static void _Cdecl (*stdioflush)();
private:
// for extra flag bits and user words
static long nextbit;
static int usercount;
union ios_user_union *userwords;
int nwords;
void _Cdecl usersize(int);
// these declarations prevent automatic copying of an ios
_Cdecl ios(ios &); // declared but not defined
void _Cdecl operator= (ios &); // declared but not defined
};
inline streambuf * _Cdecl ios::rdbuf() { return bp; }
inline ostream * _Cdecl ios::tie() { return x_tie; }
inline char _Cdecl ios::fill() { return x_fill; }
inline int _Cdecl ios::precision() { return x_precision; }
inline int _Cdecl ios::rdstate() { return state; }
inline int _Cdecl ios::eof() { return state & eofbit; }
inline int _Cdecl ios::fail()
{ return state & (failbit | badbit | hardfail); }
inline int _Cdecl ios::bad() { return state & (badbit | hardfail); }
inline int _Cdecl ios::good() { return state == 0; }
inline long _Cdecl ios::flags() { return x_flags; }
inline int _Cdecl ios::width() { return x_width; }
inline int _Cdecl ios::width(int _w)
{ int _i = x_width; x_width = _w; return _i; }
inline char _Cdecl ios::fill(char _c)
{ char _x = x_fill; x_fill = _c; return _x; }
inline int _Cdecl ios::precision(int _p)
{ int _x = x_precision; x_precision = _p; return _x; }
inline _Cdecl ios::operator void *()
{ return fail() ? 0 : this; }
inline int _Cdecl ios::operator! () { return fail(); }
class _CLASSTYPE streambuf {
public:
// constructors and destructors
_Cdecl streambuf(); // make empty streambuf
_Cdecl streambuf(char *, int); // make streambuf with
// given char array
virtual _Cdecl ~streambuf();
// use the provided char array for the buffer if possible
virtual streambuf * _Cdecl setbuf( signed char *, int);
// WARNING: this function is not virtual; do not override
streambuf * _Cdecl setbuf(unsigned char *, int);
// obsolete, for streams 1.2 compatibility
streambuf * _Cdecl setbuf(char *, int, int);
// getting (extracting) characters
int _Cdecl sgetc(); // peek at next char
int _Cdecl snextc(); // advance to and return next char
int _Cdecl sbumpc(); // return current char and advance
void _Cdecl stossc(); // advance to next character
int _Cdecl sgetn(char *, int); // get next n chars
virtual int _Cdecl do_sgetn(char *, int); // implementation of sgetn
virtual int _Cdecl underflow(); // fill empty buffer
int _Cdecl sputbackc(char); // return char to input
virtual int _Cdecl pbackfail(int); // implementation of sputbackc
int _Cdecl in_avail(); // number of avail chars in buffer
// putting (inserting) characters
int _Cdecl sputc(int); // put one char
int _Cdecl sputn(const char *, int); // put n chars from string
virtual int _Cdecl do_sputn(const char * s, int n); // implementation of sputn
virtual int _Cdecl overflow(int = EOF); // flush buffer and make more room
int _Cdecl out_waiting(); // number of unflushed chars
// moving around in stream
virtual streampos _Cdecl seekoff(streamoff, ios::seek_dir,
int = (ios::in | ios::out));
virtual streampos _Cdecl seekpos(streampos, int = (ios::in | ios::out));
virtual int _Cdecl sync();
void _Cdecl dbp(); // for debugging streambuf implementations
protected:
char * _Cdecl base(); // return start of buffer area
char * _Cdecl ebuf(); // return end+1 of buffer area
int _Cdecl blen(); // return length of buffer area
char * _Cdecl pbase(); // return start of put area
char * _Cdecl pptr(); // return next location in put area
char * _Cdecl epptr(); // return end+1 of put area
char * _Cdecl eback(); // return base of putback section of get area
char * _Cdecl gptr(); // return next location in get area
char * _Cdecl egptr(); // return end+1 of get area
void _Cdecl setp(char *, char *); // initialize the put pointers
void _Cdecl setg(char *, char *, char *); // initialize the get pointers
void _Cdecl pbump(int); // advance the put pointer
void _Cdecl gbump(int); // advance the get pointer
void _Cdecl setb(char *, char *, int = 0 ); // set the buffer area
void _Cdecl unbuffered(int);// set the buffering state
int _Cdecl unbuffered(); // non-zero if not buffered
int _Cdecl allocate(); // set up a buffer area
virtual int _Cdecl doallocate(); // implementation of allocate
private:
short alloc_; // non-zero if buffer should be deleted
short unbuf_; // non-zero if unbuffered
char * base_; // start of buffer area
char * ebuf_; // end+1 of buffer area
char * pbase_; // start of put area
char * pptr_; // next put location
char * epptr_; // end+1 of put area
char * eback_; // base of putback section of get area
char * gptr_; // next get location
char * egptr_; // end+1 of get area
int _Cdecl do_snextc(); // implementation of snextc
// these declarations prevent copying of a streambuf
_Cdecl streambuf(streambuf &); // declared but not defined
void _Cdecl operator= (streambuf &); // declared but not defined
};
inline char * _Cdecl streambuf::base() { return base_; }
inline char * _Cdecl streambuf::pbase() { return pbase_; }
inline char * _Cdecl streambuf::pptr() { return pptr_; }
inline char * _Cdecl streambuf::epptr() { return epptr_; }
inline char * _Cdecl streambuf::gptr() { return gptr_; }
inline char * _Cdecl streambuf::egptr() { return egptr_; }
inline char * _Cdecl streambuf::eback() { return eback_; }
inline char * _Cdecl streambuf::ebuf() { return ebuf_; }
inline int _Cdecl streambuf::unbuffered() { return unbuf_; }
inline int _Cdecl streambuf::blen() { return (int)(ebuf_ - base_);}
inline streambuf *
_Cdecl streambuf::setbuf(unsigned char * _p, int _len)
{ // call the virtual function
return setbuf((signed char *)_p, _len); }
inline void _Cdecl streambuf::pbump(int _n) { pptr_ += _n; }
inline void _Cdecl streambuf::gbump(int _n) { gptr_ += _n; }
inline void _Cdecl streambuf::unbuffered(int _unb) { unbuf_ = (_unb != 0); }
inline int _Cdecl streambuf::in_avail()
{ return (egptr_ > gptr_) ? (int)(egptr_ - gptr_) : 0; }
inline int _Cdecl streambuf::out_waiting()
{ return pptr_ ? (int)(pptr_ - pbase_) : 0; }
inline int _Cdecl streambuf::allocate() {
return (base_ || unbuf_) ? 0 : doallocate();
}
inline int _Cdecl streambuf::sgetc() {
return (gptr_ >= egptr_) ? underflow() :
(unsigned char)(*gptr_);
}
inline int _Cdecl streambuf::snextc() {
return (! gptr_ || (++gptr_ >= egptr_)) ?
do_snextc() :
(unsigned char)(*gptr_);
}
inline int _Cdecl streambuf::sbumpc() {
return (gptr_ >= egptr_ && underflow() == EOF) ?
EOF :
(unsigned char)(*gptr_++);
}
inline void _Cdecl streambuf::stossc() {
if( gptr_ >= egptr_ ) underflow();
else ++gptr_;
}
inline int _Cdecl streambuf::sputbackc(char _c) {
return (gptr_ > eback_) ?
(unsigned char)(*--gptr_ = _c) :
pbackfail(_c);
}
inline int _Cdecl streambuf::sputc(int _c) {
return (pptr_ >= epptr_) ?
overflow((unsigned char)_c) :
(unsigned char)(*pptr_++ = _c);
}
#ifdef _BIG_INLINE_
inline int _Cdecl streambuf::sputn(const char * _s, int _n) {
if( _n <= (epptr_ - pptr_) ) {
memcpy(pptr_, _s, _n);
pbump(_n);
return _n;
}
return do_sputn(_s, _n);
}
inline int _Cdecl streambuf::sgetn(char * _s, int _n) {
if( _n <= (egptr_ - gptr_) ) {
memcpy(_s, gptr_, _n);
gbump(_n);
return _n;
}
return do_sgetn(_s, _n);
}
#endif
class _CLASSTYPE istream : virtual public ios {
public:
// constructor and destructor
_Cdecl istream(streambuf *);
virtual _Cdecl ~istream();
// Obsolete constructors, for streams 1.2 compatibility
// obsolete: set skip via format, tie via tie() function
_Cdecl istream(streambuf *, int _sk, ostream * _t=0);
// obsolete: use strstream
_Cdecl istream(int _sz, char *, int _sk=1);
// obsolete: use fstream
_Cdecl istream(int _fd, int _sk=1, ostream * _t=0);
int _Cdecl ipfx(int = 0); // input prefix function
int _Cdecl ipfx0(); // same as ipfx(0)
int _Cdecl ipfx1(); // same as ipfx(1)
void _Cdecl isfx() { } // unused input suffix function
// set/read the get pointer's position
istream & _Cdecl seekg(streampos);
istream & _Cdecl seekg(streamoff, seek_dir);
streampos _Cdecl tellg();
int _Cdecl sync();
/*
* Unformatted extraction operations
*/
// extract characters into an array
istream & _Cdecl get( signed char *, int, char = '\n');
istream & _Cdecl get(unsigned char *, int, char = '\n');
istream & _Cdecl read( signed char *, int);
istream & _Cdecl read(unsigned char *, int);
// extract characters into an array up to termination char
istream & _Cdecl getline( signed char *, int, char = '\n');
istream & _Cdecl getline(unsigned char *, int, char = '\n');
// extract characters into a streambuf up to termination char
istream & _Cdecl get(streambuf &, char = '\n');
// extract a single character
istream & _Cdecl get(unsigned char &);
istream & _Cdecl get( signed char &);
int _Cdecl get();
int _Cdecl peek(); // return next char without extraction
int _Cdecl gcount(); // number of unformatted chars last extracted
istream & _Cdecl putback(char); // push back char into input
// extract and discard chars but stop at delim
istream & _Cdecl ignore(int = 1, int = EOF);
/*
* Formatted extraction operations
*/
istream & _Cdecl operator>> (istream & (_Cdecl *_f)(istream &));
istream & _Cdecl operator>> (ios & (_Cdecl *_f)(ios &) );
istream & _Cdecl operator>> ( signed char *);
istream & _Cdecl operator>> (unsigned char *);
istream & _Cdecl operator>> (unsigned char &);
istream & _Cdecl operator>> ( signed char &);
istream & _Cdecl operator>> (short &);
istream & _Cdecl operator>> (int &);
istream & _Cdecl operator>> (long &);
istream & _Cdecl operator>> (unsigned short &);
istream & _Cdecl operator>> (unsigned int &);
istream & _Cdecl operator>> (unsigned long &);
istream & _Cdecl operator>> (float &);
istream & _Cdecl operator>> (double &);
istream & _Cdecl operator>> (long double &);
// extract from this istream, insert into streambuf
istream & _Cdecl operator>> (streambuf *);
protected:
_Cdecl istream();
void _Cdecl eatwhite(); // extract consecutive whitespace
private:
int gcount_; // chars extracted by last unformatted operation
signed char _Cdecl do_get(); // implementation of get
};
inline int _Cdecl istream::gcount() { return gcount_; }
inline int _Cdecl istream::ipfx0() { return ipfx(0); }
inline int _Cdecl istream::ipfx1() { return ipfx(1); }
#ifdef _BIG_INLINE_
inline istream & _Cdecl istream::operator>> (unsigned char & _c) {
if( ipfx0() )
_c = bp->in_avail() ? bp->sbumpc() : do_get();
return *this;
}
inline istream & _Cdecl istream::operator>> (signed char & _c) {
if( ipfx0() )
_c = bp->in_avail() ? bp->sbumpc() : do_get();
return *this;
}
#endif
inline istream & _Cdecl istream::operator>> (unsigned char *_p) {
return *this >> (signed char *)_p;
}
inline istream & _Cdecl istream::get(unsigned char *_p, int _l, char _t) {
return get((signed char *)_p, _l, _t);
}
inline istream & _Cdecl istream::read(unsigned char *_p, int _l) {
return read((signed char *)_p, _l);
}
inline istream & _Cdecl istream::getline(unsigned char *_p, int _l, char _t) {
return getline((signed char *) _p, _l, _t);
}
inline int _Cdecl istream::sync() { return bp->sync(); }
inline istream & _Cdecl istream::operator>> (istream & (_Cdecl *_f)(istream &)) {
return (*_f)(*this);
}
#ifdef _BIG_INLINE_
inline istream & _Cdecl istream::get(unsigned char & _c) {
if( ipfx1() )
if( bp->in_avail() ) {
gcount_ = 1;
_c = bp->sbumpc();
}
else _c = do_get();
return *this;
}
inline istream & _Cdecl istream::get(signed char & _c) {
if( ipfx1() )
if( bp->in_avail()) {
gcount_ = 1;
_c = bp->sbumpc();
}
else _c = do_get();
return *this;
}
inline int _Cdecl istream::get() {
if( ipfx1() ) {
int _c = bp->sbumpc();
if( _c == EOF ) setstate(eofbit);
else gcount_ = 1;
return _c;
}
else return EOF;
}
#endif
inline int _Cdecl istream::peek() { return ipfx1() ? bp->sgetc() : EOF; }
class _CLASSTYPE ostream : virtual public ios {
public:
// constructors and destructor
_Cdecl ostream(streambuf *);
virtual _Cdecl ~ostream();
// Obsolete constructors, for streams 1.2 compatibility
_Cdecl ostream(int _fd); // obsolete, use fstream
_Cdecl ostream(int _sz, char *); // obsolete, use strstream
int _Cdecl opfx(); // output prefix function
void _Cdecl osfx(); // output suffix function
ostream & _Cdecl flush();
// set/read the put pointer's position
ostream & _Cdecl seekp(streampos);
ostream & _Cdecl seekp(streamoff, seek_dir);
streampos _Cdecl tellp();
/*
* Unformatted insertion operations
*/
ostream & _Cdecl put(char); // insert the character
ostream & _Cdecl write(const signed char *, int); // insert the string
ostream & _Cdecl write(const unsigned char *, int); // insert the string
/*
* Formatted insertion operations
*/
// insert the character
ostream & _Cdecl operator<< ( signed char);
ostream & _Cdecl operator<< (unsigned char);
// for the following, insert character representation of numeric value
ostream & _Cdecl operator<< (short);
ostream & _Cdecl operator<< (unsigned short);
ostream & _Cdecl operator<< (int);
ostream & _Cdecl operator<< (unsigned int);
ostream & _Cdecl operator<< (long);
ostream & _Cdecl operator<< (unsigned long);
ostream & _Cdecl operator<< (float);
ostream & _Cdecl operator<< (double);
ostream & _Cdecl operator<< (long double);
// insert the null-terminated string
ostream & _Cdecl operator<< (const signed char *);
ostream & _Cdecl operator<< (const unsigned char *);
// insert character representation of the value of the pointer
ostream & _Cdecl operator<< (void *);
// extract from streambuf, insert into this ostream
ostream & _Cdecl operator<< (streambuf *);
// manipulators
ostream & _Cdecl operator<< (ostream & (_Cdecl *_f)(ostream &));
ostream & _Cdecl operator<< (ios & (_Cdecl *_f)(ios &));
protected:
int _Cdecl do_opfx(); // implementation of opfx
void _Cdecl do_osfx(); // implementation of osfx
_Cdecl ostream();
private:
void _Cdecl outstr(const signed char *, const signed char *);
};
inline int _Cdecl ostream::opfx() { return ospecial ? do_opfx() : 1; }
inline void _Cdecl ostream::osfx() { if( x_flags & (stdio | unitbuf) ) do_osfx(); }
#ifdef _BIG_INLINE_
inline ostream & _Cdecl ostream::operator<< (signed char _c) {
if( opfx() )
if( bp->sputc(_c) == EOF ) setstate(badbit);
osfx();
return *this;
}
#endif
inline ostream & _Cdecl ostream::operator<< (unsigned char _c) {
return *this << (signed char)_c;
}
inline ostream & _Cdecl ostream::operator<< (const signed char * _s) {
outstr(_s, (const signed char *)0);
return *this;
}
inline ostream & _Cdecl ostream::operator<< (const unsigned char * _s) {
outstr((const signed char *)_s, (const signed char *)0);
return *this;
}
inline ostream & _Cdecl ostream::operator<< (short _i)
{ return *this << (long) _i; }
inline ostream & _Cdecl ostream::operator<< (unsigned short _i)
{ return *this << (unsigned long) _i; }
inline ostream & _Cdecl ostream::operator<< (int _i)
{ return *this << (long) _i; }
inline ostream & _Cdecl ostream::operator<< (unsigned int _i)
{ return *this << (unsigned long) _i; }
inline ostream & _Cdecl ostream::operator<< (float _f)
{ return *this << (long double) _f; }
inline ostream & _Cdecl ostream::operator<< (double _d)
{ return *this << (long double) _d; }
inline ostream & _Cdecl ostream::operator<< (ostream & (_Cdecl *_f)(ostream &))
{ return (*_f)(*this); }
inline ostream & _Cdecl ostream::write(const unsigned char * _s, int _n)
{ return write((const signed char *)_s, _n); }
inline ostream & _Cdecl ostream::put(char _c) {
if( bp->sputc(_c) == EOF ) setstate(badbit);
return *this;
}
#ifdef _BIG_INLINE_
inline ostream & _Cdecl ostream::write(const signed char * _s, int _n) {
if( ! fail() )
if( bp->sputn((const char *)_s, _n) != _n )
setstate(badbit);
return *this;
}
#endif
class _CLASSTYPE iostream : public istream, public ostream {
public:
_Cdecl iostream(streambuf *);
virtual _Cdecl ~iostream();
protected:
_Cdecl iostream();
};
class _CLASSTYPE istream_withassign : public istream {
public:
// does no initialization
_Cdecl istream_withassign();
virtual _Cdecl ~istream_withassign();
// gets buffer from istream and does entire initialization
istream_withassign & _Cdecl operator= (istream &);
// associates streambuf with stream and does entire initialization
istream_withassign & _Cdecl operator= (streambuf *);
};
class _CLASSTYPE ostream_withassign : public ostream {
public:
// does no initialization
_Cdecl ostream_withassign();
virtual _Cdecl ~ostream_withassign();
// gets buffer from istream and does entire initialization
ostream_withassign & _Cdecl operator= (ostream &);
// associates streambuf with stream and does entire initialization
ostream_withassign & _Cdecl operator= (streambuf *);
};
class _CLASSTYPE iostream_withassign : public iostream {
public:
// does no initialization
_Cdecl iostream_withassign();
virtual _Cdecl ~iostream_withassign();
// gets buffer from stream and does entire initialization
iostream_withassign & _Cdecl operator= (ios &);
// associates streambuf with stream and does entire initialization
iostream_withassign & _Cdecl operator= (streambuf *);
};
/*
* The predefined streams
*/
extern istream_withassign _Cdecl cin;
extern ostream_withassign _Cdecl cout;
extern ostream_withassign _Cdecl cerr;
extern ostream_withassign _Cdecl clog;
/*
* Manipulators
*/
ostream & _Cdecl endl(ostream &); // insert newline and flush
ostream & _Cdecl ends(ostream &); // insert null to terminate string
ostream & _Cdecl flush(ostream &);// flush the ostream
ios & _Cdecl dec(ios &); // set conversion base to decimal
ios & _Cdecl hex(ios &); // set conversion base to hexadecimal
ios & _Cdecl oct(ios &); // set conversion base to octal
istream & _Cdecl ws(istream &); // extract whitespace characters
#pragma option -Vo.
#endif
/*========================================================================================== <--iostream.h Ends-->*/
/* conio.h
Direct MSDOS console input/output.
Copyright (c) 1987, 1991 by Borland International
All Rights Reserved.
*/
#if !defined(__CONIO_H)
#define __CONIO_H
#if !defined(__DEFS_H)
#include <_defs.h>
#endif
#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2
struct text_info {
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attribute;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
#if !defined(__COLORS)
#define __COLORS
enum COLORS {
BLACK, /* dark colors */
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
DARKGRAY, /* light colors */
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#endif
#define BLINK 128 /* blink bit */
extern int _Cdecl directvideo;
extern int _Cdecl _wscroll;
#ifdef __cplusplus
extern "C" {
#endif
void _Cdecl clreol( void );
void _Cdecl clrscr( void );
void _Cdecl gotoxy( int __x, int __y );
int _Cdecl wherex( void );
int _Cdecl wherey( void );
int _Cdecl getch( void );
int _Cdecl getche( void );
int _Cdecl kbhit( void );
int _Cdecl putch( int __c );
#ifndef _PORT_DEFS
int _Cdecl inp( unsigned __portid );
unsigned _Cdecl inpw( unsigned __portid );
int _Cdecl outp( unsigned __portid, int __value );
unsigned _Cdecl outpw( unsigned __portid, unsigned __value );
unsigned char _Cdecl inportb( int __portid );
void _Cdecl outportb( int __portid, unsigned char __value );
#endif /* !_PORT_DEFS */
int _Cdecl inport( int __portid );
void _Cdecl outport( int __portid, int __value );
void _Cdecl delline( void );
int _Cdecl gettext( int __left, int __top,
int __right, int __bottom,
void *__destin);
void _Cdecl gettextinfo (struct text_info *__r );
void _Cdecl highvideo( void );
void _Cdecl insline( void );
void _Cdecl lowvideo( void );
int _Cdecl movetext( int __left, int __top,
int __right, int __bottom,
int __destleft, int __desttop );
void _Cdecl normvideo( void );
int _Cdecl puttext( int __left, int __top,
int __right, int __bottom,
void *__source );
void _Cdecl textattr( int __newattr );
void _Cdecl textbackground( int __newcolor );
void _Cdecl textcolor( int __newcolor );
void _Cdecl textmode( int __newmode );
void _Cdecl window( int __left, int __top, int __right, int __bottom);
void _Cdecl _setcursortype( int __cur_t );
char * _Cdecl cgets( char *__str );
int _Cdecl cprintf( const char *__format, ... );
int _Cdecl cputs( const char *__str );
int _Cdecl cscanf( const char *__format, ... );
char * _Cdecl getpass( const char *__prompt );
int _Cdecl ungetch( int __ch );
#ifndef _PORT_DEFS
#define _PORT_DEFS
/* These are in-line functions. These prototypes just clean up
some syntax checks and code generation.
*/
unsigned char _Cdecl __inportb__( int __portid );
unsigned int _Cdecl __inportw__( int __portid );
void _Cdecl __outportb__( int __portid, unsigned char __value );
void _Cdecl __outportw__( int __portid, unsigned int __value );
#define inportb __inportb__
#define inportw __inportw__
#define outportb __outportb__
#define outportw __outportw__
#define inp( portid ) __inportb__( portid )
#define outp( portid,v ) (__outportb__( portid,v ), (int)_AL)
#define inpw( portid ) __inportw__( portid )
#define outpw( portid,v ) (__outportw__( portid,v ), (unsigned)_AX)
#endif /* _PORT_DEFS */
#ifdef __cplusplus
}
#endif
#endif /* __CONIO_H */
/*========================================================================================== <--conio.h Ends-->*/
/* process.h
Symbols and structures for process management.
Copyright (c) 1987, 1991 by Borland International
All Rights Reserved.
*/
#if !defined( __PROCESS_H )
#define __PROCESS_H
#if !defined( __DEFS_H )
#include <_defs.h>
#endif
/* Modes available as first argument to the spawnxx functions. */
#define P_WAIT 0 /* child runs separately, parent waits until exit */
#define P_NOWAIT 1 /* both concurrent -- not implemented */
#define P_OVERLAY 2 /* child replaces parent, parent no longer exists */
#define P_NOWAITO 3 /* ASYNCH, toss RC */
#define P_DETACH 4 /* DETACHED, toss RC */
#define WAIT_CHILD 0
#define WAIT_GRANDCHILD 1
/* MSDOS does not have any abstract identifier for a process, but the
process Program Segment Prefix location provides a similar token.
*/
extern unsigned _Cdecl _psp; /* provided unconditionally in dos.h */
#define getpid() (_psp)
#ifdef __cplusplus
extern "C" {
#endif
void _Cdecl abort(void);
void _Cdecl _cexit(void);
void _Cdecl _c_exit(void);
int _Cdecl execl(char *__path, char *__arg0, ...);
int _Cdecl execle(char *__path, char *__arg0, ...);
int _Cdecl execlp(char *__path, char *__arg0, ...);
int _Cdecl execlpe(char *__path, char *__arg0, ...);
int _Cdecl execv(char *__path, char *__argv[]);
int _Cdecl execve(char *__path, char *__argv[], char **__env);
int _Cdecl execvp(char *__path, char *__argv[]);
int _Cdecl execvpe(char *__path, char *__argv[], char **__env);
void _Cdecl exit(int __status);
void _Cdecl _exit(int __status);
int _Cdecl spawnl(int __mode, char *__path, char *__arg0, ...);
int _Cdecl spawnle(int __mode, char *__path, char *__arg0, ...);
int _Cdecl spawnlp(int __mode, char *__path, char *__arg0, ...);
int _Cdecl spawnlpe(int __mode, char *__path, char *__arg0, ...);
int _Cdecl spawnv(int __mode, char *__path, char *__argv[]);
int _Cdecl spawnve(int __mode, char *__path, char *__argv[], char **__env);
int _Cdecl spawnvp(int __mode, char *__path, char *__argv[]);
int _Cdecl spawnvpe(int __mode, char *__path, char *__argv[], char **__env);
int _Cdecl system(const char *__command);
#ifdef __cplusplus
}
#endif
#endif /* __PROCESS_H */
/*========================================================================================== <--process.h Ends-->*/
/* dos.h
Defines structs, unions, macros, and functions for dealing
with MSDOS and the Intel iAPX86 microprocessor family.
Copyright (c) 1987, 1991 by Borland International
All Rights Reserved.
*/
#ifndef __DOS_H
#define __DOS_H
#if !defined( __DEFS_H )
#include <_defs.h>
#endif
extern int _Cdecl errno;
extern int _Cdecl _doserrno;
/* Variables */
extern int const _Cdecl _8087;
extern int _Cdecl _argc;
extern char **_Cdecl _argv;
extern char **_Cdecl environ;
extern unsigned _Cdecl _psp;
extern unsigned _Cdecl _heaplen;
extern unsigned char _Cdecl _osmajor;
extern unsigned char _Cdecl _osminor;
extern unsigned _Cdecl _stklen;
extern unsigned _Cdecl _fpstklen;
extern unsigned _Cdecl _version;
extern unsigned _Cdecl _osversion; /* MSC name for _version */
#define FA_NORMAL 0x00 /* Normal file, no attributes */
#define FA_RDONLY 0x01 /* Read only attribute */
#define FA_HIDDEN 0x02 /* Hidden file */
#define FA_SYSTEM 0x04 /* System file */
#define FA_LABEL 0x08 /* Volume label */
#define FA_DIREC 0x10 /* Directory */
#define FA_ARCH 0x20 /* Archive */
/* MSC names for file attributes */
#define _A_NORMAL 0x00 /* Normal file, no attributes */
#define _A_RDONLY 0x01 /* Read only attribute */
#define _A_HIDDEN 0x02 /* Hidden file */