[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glue example: the C++ source
- To: self-interest@myself.stanford.edu (Self mailing list)
- Subject: glue example: the C++ source
- From: hernan@cc.gatech.edu (Hernan Astudillo R.)
- Date: Fri, 12 Feb 93 19:04:38 EST
- Resent-date: Fri, 12 Feb 93 16:06:04 PST
- Resent-from: Urs Hoelzle <urs@otis>
- Resent-message-id: <9302130006.AA01143@otis.Stanford.Edu>
- Resent-to: real-self-interest
*** FILE greeting.cc ***
//.............................................................................
#include <stream.h>
#include <String.h>
//.............................................................................
//-- notice that we must define the type seal for our class
#define Greeting_seal "Greeting_seal"
//.............................................................................
class Greeting {
private:
String str_;
public:
Greeting( char* str )
: str_( str )
{
cerr << "Greeting: new(" << str << ")" << endl;
};
void sayIt( int times )
{
for( int i=1; i<=times; i++){
cerr << "Greeting: " << str_ << endl;
};
};
/* the destructor will be generated automagically */
}; //Greeting
//.............................................................................
//*** Self glue ***
// if you are using some InterViews class, you will have to uncomment all the
// #-lines in this paragraph, to avoid Self/IV name clash of boolean definition
//? #include <InterViews/leave-scope.h>
//? #define bool glueBool
//? #define false _FALSE
//? #define true _TRUE
//...include Self glue code...
#include <_glueDefs.c.incl>
//...undefs to restore non-CPP meaning...
//? #undef bool
//? #undef false
//? #undef true
//? #include <InterViews/enter-scope.h>
//.............................................................................
#include "greetingGlue.primMaker.h"
#define WHAT_GLUE C_DECLS
/* no declarations are needed in this case */
#undef WHAT_GLUE
//.............................................................................
#define WHAT_GLUE FUNCTIONS
/* place the glue functions */
greetingClass_glue
#undef WHAT_GLUE
//.............................................................................