Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : FORMATAS.H

 
Output of file : FORMATAS.H contained in archive : PCCAPP.ZIP
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989, 1990, 1991
* The University of Illinois Board of Trustees.
* All Rights Reserved.
* CONFIDENTIAL INFORMATION. Distribution restricted under license agreement.
*
* Author: Vincent F. Russo ([email protected])
* Contributing Author: Gary M. Johnston ([email protected])
* Contributing Author: Bjorn A. Helgaas ([email protected])
* Contributing Author: Lee Lup Yuen ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*/
/*
* FormatAssists.h: used in OutputStream
*/

#ifndef FormatAssists_h
#define FormatAssists_h
#ifdef __GNUG__
#pragma once
#pragma interface
#endif

class OutputStream;
class ProxiableObjectRef;
class ProxiableObjectStar;

union formatArgs {
/*
* An assist class for formatted printing to an OutputStream, or formatted
* input from an InputStream. For example, OutputStream::formattedWrite
* takes arguments of type formatArgs. formatArgs will be constructed
* differently according to the type of the argument.
*/
void const * p;
long l;
double d;

formatArgs();
// Construct formatArgs different according to type encountered (eg.
// make a formatArg out of a ProxiableObjectRef, ProxiableObjectStar,
// void const *, etc.).
formatArgs( ProxiableObjectRef & const );
formatArgs( ProxiableObjectStar & const );
formatArgs( void const * );
formatArgs( int );
formatArgs( unsigned int );
formatArgs( long );
formatArgs( unsigned long );
formatArgs( double );
};

#include "ProxiableObjectStar.h"
inline
formatArgs::formatArgs()
{
p = 0;
}

inline
formatArgs::formatArgs( ProxiableObjectRef & const pos )
{
p = pos._pointer;
}

inline
formatArgs::formatArgs( ProxiableObjectStar & const pos )
{
p = (ProxiableObject *)pos;
}

inline
formatArgs::formatArgs( void const * pp )
{
p = pp;
}

inline
formatArgs::formatArgs( int ii )
{
l = ii;
}

inline
formatArgs::formatArgs( unsigned int ui )
{
l = ui;
}

inline
formatArgs::formatArgs( long ll )
{
l = ll;
}

inline
formatArgs::formatArgs( unsigned long ul )
{
l = ul;
}

inline
formatArgs::formatArgs( double dd )
{
d = dd;
}


/*
* The following classes (asHex, asAddress, etc) are defined for
* convenience in using OutputStreams. They allow use to say,
* for instance:
*
* stream << "The number is " << asHex( n ) << eor;
* stream << "In binary, its " << asBits( n ) << eor;
*
* The classes don't do anything themselves; they merely cause the
* right version of
*
* OutputStream & operator <<
*
* to be selected. (See OutputStream.cc for the definitions of these
* functions.)
*/

// "<< asAddress (x)" outputs x in hex (eg. @0x00001234).
// "<< asHex (x)" outputs x in hex (eg. 0x00001234).
// "<< asOctal (x)" outputs x in octal (eg. 01234).
// "<< asBits (x)" outputs x in binary (eg. 0b1011).

class asAddress {
friend OutputStream & operator << ( OutputStream &, asAddress & );
protected:
const void * const addr;
public:
asAddress( const void * const );
};

inline asAddress::asAddress( const void * const a ) : addr( a ) {}


class asHex {
friend OutputStream & operator << ( OutputStream &, asHex & );
protected:
const unsigned int val;
public:
asHex( const unsigned int );
};

inline asHex::asHex( const unsigned int i ) : val(i) {}


class asOctal {
friend OutputStream & operator << ( OutputStream &, asOctal & );
protected:
const unsigned int val;
public:
asOctal( const unsigned int );
};

inline asOctal::asOctal( const unsigned int i ) : val(i) {}


class asBits {
friend OutputStream & operator << ( OutputStream &, asBits & );
protected:
const unsigned int val;
public:
asBits( const unsigned int );
};

inline asBits::asBits( const unsigned int i ) : val(i) {}


class Flush {
int dumyToShutUpCfront;
};

extern Flush eor; // this is defined in FormatAssists.cc

// Tell the compiler to allow things statements like
// "OutputStream << asHex (x);".
OutputStream & operator << ( OutputStream & os, asHex & );
OutputStream & operator << ( OutputStream & os, asAddress & );
OutputStream & operator << ( OutputStream & os, asOctal & );
OutputStream & operator << ( OutputStream & os, asBits & );
OutputStream & operator << ( OutputStream & os, Flush & );


#endif /* FormatAssists_h */


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : FORMATAS.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/