[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glue example: the C++ source



*** 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
//.............................................................................