Category : C Source Code
Archive   : NIH.ZIP
Filename : NIL.CXX

 
Output of file : NIL.CXX contained in archive : NIH.ZIP
/* Nil.c -- implementation of the nil object

THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
"UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.

Author:
K. E. Gorlen
Bg. 12A, Rm. 2017
Computer Systems Laboratory
Division of Computer Research and Technology
National Institutes of Health
Bethesda, Maryland 20892
Phone: (301) 496-5363
uucp: uunet!ncifcrf.gov!nih-csl!keith
Internet: keith%[email protected]
September, 1985

Function:

Declarations and member functions for the nil object.

$Log: Nil.c,v $
* Revision 1.3 88/02/04 12:59:38 keith
* Make Class class_CLASSNAME const.
*
* Revision 1.2 88/01/16 23:39:55 keith
* Remove pre-RCS modification history
*
*/

#include "Object.hxx"

extern const Class class_Nil;

class Nil : public Object {
public:
Nil() {}
#ifdef OBJECTIO
Nil(fileDescTy&,Nil&) {}
Nil(istream&,Nil&) {}
#endif //OBJECTIO
virtual int compare(const Object&); // compare objects
virtual Object* copy(); // copy returns nil
virtual Object* deepCopy(); // copy returns nil
virtual unsigned hash(); // calculate object hash
virtual const Class* isA();
virtual bool isEqual(const Object&); // equality test
#ifdef OBJECTIO
virtual void printOn(ostream& strm);
#endif //OBJECTIO
virtual Object* shallowCopy(); // copy returns nil
#ifdef OBJECTIO
virtual void storer(ostream&); // shouldNotImplement
virtual void storer(fileDescTy&); // shouldNotImplement
#endif //OBJECTIO
};

#define THIS Nil
#define BASE Object
DEFINE_CLASS(Nil,Object,1,"$Header: Nil.c,v 1.3 88/02/04 12:59:38 keith Exp $",NULL,NULL);
static const Nil nil_object; // the nil object

/*
extern const Object* const nil = (Object*)&nil_object; // pointer to the nil object
*/

extern const Object* nil = (Object*)&nil_object; // pointer to the nil object

bool Nil::isEqual(const Object& ob) { return (&ob==nil); }

unsigned Nil::hash() { return 0; }

int Nil::compare(const Object& ob)
{
assertArgSpecies(ob,class_Nil,"compare");
return 0;
}

Object* Nil::copy() { return nil; }

Object* Nil::shallowCopy() { return nil; }

Object* Nil::deepCopy() { return nil; }

#ifdef OBJECTIO
void Nil::printOn(ostream& strm) { strm << "NIL"; }

void Nil::storer(ostream&)
/*
The Nil object is always implicitly stored as object number zero; all
references to nil are stored as @0.
*/
{
shouldNotImplement("storer");
}

void Nil::storer(fileDescTy&)
{
shouldNotImplement("storer");
}
#endif //OBJECTIO


  3 Responses to “Category : C Source Code
Archive   : NIH.ZIP
Filename : NIL.CXX

  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/