stubgen.so is now include in the build process

This commit is contained in:
ocoursiere
2003-09-21 22:46:55 +00:00
parent e5aeed15d2
commit a08b796230
36 changed files with 12514 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
/**********************************************************************
* FILE: MJRString.H
* AUTHOR: Michael J. Radwin
* DATE: 01/28/95
* DESCRIPTION: The public interface for the String class
* MODIFIED: 02/27/95
* CREDITS: some code borrowed from Deitel, "How to Program C++"
**********************************************************************/
#ifndef __MJRString_H__
#define __MJRString_H__
#include <iostream.h>
class MJRString {
friend ostream & operator<<(ostream&, const MJRString &s);
friend istream & operator>>(istream&, MJRString &s);
public:
MJRString(const char* s = "");
MJRString(const MJRString &copy);
MJRString(double value);
MJRString(int value);
~MJRString();
// assignment
const MJRString & operator=(const MJRString &right);
const MJRString & operator=(const char *right);
const MJRString & operator+=(const MJRString &right);
const MJRString & operator+=(const char *right);
// comparisons
int operator! () const;
int operator==(const MJRString &right) const;
int operator==(const char *right) const;
int operator!=(const MJRString &right) const;
int operator!=(const char *right) const;
int operator< (const MJRString &right) const;
int operator< (const char *right) const;
int operator> (const MJRString &right) const;
int operator> (const char *right) const;
int operator<=(const MJRString &right) const;
int operator<=(const char *right) const;
int operator>=(const MJRString &right) const;
int operator>=(const char *right) const;
// auxiliary
MJRString operator+(const MJRString &right) const;
MJRString operator+(const char *right) const;
char & operator[](int subscript);
char operator[](int subscript) const; // safe for const
MJRString operator()(int index, int subLength) const;
int length() const;
protected:
char *pStr_;
int length_;
} ;
#endif

View File

@@ -0,0 +1,12 @@
#ifndef _Point_H
#define _Point_H
class Point {
public:
Point(int x, int y);
void addTo(Point other);
int xValue, yValue;
};
#endif /* _Point_H */

View File

@@ -0,0 +1,82 @@
/****************************************************************
* NAME: Michael J. Radwin
* ACCT: mradwin
* FILE: Rational.H
* DATE: Sat Mar 4 01:47:16 EST 1995
* $Id: Rational.H,v 1.1 2003-09-21 22:46:55 ocoursiere Exp $
****************************************************************/
class Rational {
friend ostream & operator<<(ostream &output, const Rational &r);
friend Rational pow(const Rational &r, int exp);
friend Rational operator+(int n, const Rational &r);
friend Rational operator-(int n, const Rational &r);
friend Rational operator*(int n, const Rational &r);
friend Rational operator/(int n, const Rational &r);
friend int operator==(int n, const Rational &r);
friend int operator!=(int n, const Rational &r);
friend int operator< (int n, const Rational &r);
friend int operator> (int n, const Rational &r);
friend int operator<=(int n, const Rational &r);
friend int operator>=(int n, const Rational &r);
public:
Rational(int num, int den = 1);
Rational(const Rational &r);
~Rational();
Rational operator+(const Rational &r) const;
Rational operator-(const Rational &r) const;
Rational operator*(const Rational &r) const;
Rational operator/(const Rational &r) const;
const Rational & operator= (const Rational &r);
const Rational & operator+=(const Rational &r);
const Rational & operator-=(const Rational &r);
const Rational & operator*=(const Rational &r);
const Rational & operator/=(const Rational &r);
Rational operator+(int r) const;
Rational operator-(int r) const;
Rational operator*(int r) const;
Rational operator/(int r) const;
const Rational & operator= (int r);
const Rational & operator+=(int r);
const Rational & operator-=(int r);
const Rational & operator*=(int r);
const Rational & operator/=(int r);
Rational operator-() const;
int operator! () const;
int operator==(const Rational &r) const;
int operator==(int r) const;
int operator!=(const Rational &r) const;
int operator!=(int r) const;
int operator< (const Rational &r) const;
int operator< (int r) const;
int operator> (const Rational &r) const;
int operator> (int r) const;
int operator<=(const Rational &r) const;
int operator<=(int r) const;
int operator>=(const Rational &r) const;
int operator>=(int r) const;
private:
Rational() {}
static int compute_gcd(int a, int b);
static int gcd(int bigger, int smaller);
int n, d;
};
// global prototypes
ostream & operator<<(ostream &output, const Rational &r);
Rational pow(const Rational &r, int exp);
Rational operator+(int n, const Rational &r);
Rational operator-(int n, const Rational &r);
Rational operator*(int n, const Rational &r);
Rational operator/(int n, const Rational &r);
int operator==(int n, const Rational &r);
int operator!=(int n, const Rational &r);
int operator< (int n, const Rational &r);
int operator> (int n, const Rational &r);
int operator<=(int n, const Rational &r);
int operator>=(int n, const Rational &r);

View File

@@ -0,0 +1,14 @@
#ifndef TABLE_HEADER
#define TABLE_HEADER
#define NELEMS 500 /* maximum number of symbols */
#define IGNORE_KIND 0 /* a variable or forward declaration */
#define FUNC_KIND 1 /* a method declaration */
#define CLASS_KIND 2 /* a class declaration */
#define INLINED_KIND 3 /* a method w/body in a class decl. */
#define SKEL_KIND 4 /* a method found in a code file */
#define DONE_FUNC_KIND 11 /* a fn that we've finished expanded */
#define DONE_CLASS_KIND 12 /* a class that we've finished expanded */
#endif

View File

@@ -0,0 +1,139 @@
#ifndef __Heap__
#define __Heap__
/*****************************************************************************/
/* AUTHOR: Michael J. Radwin */
/* DATE: 2/14/94 */
/* DESCRIPTION: This file contains the code for a generic Heap class. */
/* You will need to fill in all of the methods of the CHeap */
/* methods for any other classes you need. */
/* MODIFIED: 12/14/94 */
/*****************************************************************************/
template <class T>
class CHeapNode {
public:
CHeapNode();
virtual ~CHeapNode();
virtual void SetParent(CHeapNode<T> * Lparent) = 0;
virtual void SetChild(CHeapNode<T> * LoldChild, CHeapNode<T> * LnewChild) = 0;
virtual void SetKey(T key) = 0;
virtual CHeapNode<T> * Insert(T key) = 0;
virtual CHeapNode<T> * Remove() = 0;
virtual T GetKey() = 0;
virtual T UpHeap(T key) = 0;
virtual T DownHeap() = 0;
virtual int Empty() = 0;
virtual CHeapNode<T> * NextNode(CHeapNode<T> * node) = 0;
virtual CHeapNode<T> * PrevNode(CHeapNode<T> * node) = 0;
} ;
template <class T>
class CHeapSuperNode : public CHeapNode<T> {
friend class CHeapInternalNode;
friend class CHeapLeafNode;
friend class CHeap;
public:
CHeapSuperNode(CHeapNode<T> * LnewNode);
virtual ~CHeapSuperNode();
virtual void SetParent(CHeapNode<T> * Lparent) { exit(-1); } ;
virtual void SetChild(CHeapNode<T> * LoldChild, CHeapNode<T> * LnewChild) { Lroot_ = LnewChild; };
virtual void SetKey(T key) { exit(-1); };
virtual CHeapNode<T> * Insert(T key) { return(Lroot_->Insert(key)); };
virtual CHeapNode<T> * Remove();
virtual T GetKey() { return (T) NULL; };
virtual T UpHeap(T key) { return key; };
virtual T DownHeap();
virtual int Empty() { return Lroot_->Empty(); };
virtual CHeapNode<T> * NextNode(CHeapNode<T> * node) { return Lroot_->NextNode(this); };
virtual CHeapNode<T> * PrevNode(CHeapNode<T> * node) { return Lroot_->PrevNode(this); };
protected:
CHeapNode<T> * Lroot_; /* pointer to root of tree */
} ;
template <class T>
class CHeapInternalNode : public CHeapNode<T> {
public:
CHeapInternalNode(T key,
CHeapNode<T> * LleftChild,
CHeapNode<T> * LrightChild
);
virtual ~CHeapInternalNode();
virtual void SetParent(CHeapNode<T> * Lparent) { Lparent_ = Lparent; } ;
virtual void SetChild(CHeapNode<T> * LoldChild, CHeapNode<T> * LnewChild);
virtual void SetKey(T key) { key_ = key; };
virtual CHeapNode<T> * Insert(T key);
virtual CHeapNode<T> * Remove();
virtual T GetKey() { return key_; };
virtual T UpHeap(T key);
virtual T DownHeap();
virtual int Empty() { return 0; };
virtual CHeapNode<T> * NextNode(CHeapNode<T> * node);
virtual CHeapNode<T> * PrevNode(CHeapNode<T> * node);
protected:
T key_; /* this is my key value */
CHeapNode<T> * Lparent_; /* my parent */
CHeapNode<T> * LleftChild_; /* my left child */
CHeapNode<T> * LrightChild_; /* my right child */
T DownHeapLeft();
T DownHeapRight();
} ;
template <class T>
class CHeapLeafNode : public CHeapNode<T> {
public:
CHeapLeafNode();
virtual ~CHeapLeafNode();
virtual void SetParent(CHeapNode<T> * Lparent) { Lparent_ = Lparent; } ;
virtual void SetChild(CHeapNode<T> * LoldChild, CHeapNode<T> * LnewChild) { exit(1); };
virtual void SetKey(T key) { exit(-1); };
virtual CHeapNode<T> * Insert(T key);
virtual CHeapNode<T> * Remove() { return NULL; };
virtual T GetKey() { return (T) NULL; }
virtual T UpHeap(T key) { return (T) NULL; };
virtual T DownHeap() { return (T) NULL; };
virtual int Empty() { return 1; };
virtual CHeapNode<T> * NextNode(CHeapNode<T> * node) { return Lparent_; };
virtual CHeapNode<T> * PrevNode(CHeapNode<T> * node) { return Lparent_; };
protected:
CHeapNode<T> * Lparent_; /* my parent */
} ;
/*************************************************************************/
/* Class : CHeap */
/* Descr : The CHeap class is a generic Heap class which can be used */
/* with the c++ template mechanism. */
/*************************************************************************/
template <class T>
class CHeap {
public:
CHeap();
~CHeap();
void Insert(T key);
void Delete(T &key);
int Empty() { return Lheap_->Empty(); };
int Search(T) { return 0; };
protected:
CHeapSuperNode<T> * Lheap_; /* pointer to heap supernode */
CHeapNode<T> * LlastNode_;
} ;
#endif

View File

@@ -0,0 +1,46 @@
#include <stdio.h>
#include "pathname.c"
void main()
{
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/usr/lib", dirname("/usr/lib"), basename("/usr/lib"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/usr/lib/", dirname("/usr/lib/"), basename("/usr/lib/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/usr/", dirname("/usr/"), basename("/usr/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/usr///", dirname("/usr///"), basename("/usr///"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"///usr////", dirname("///usr////"), basename("///usr////"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"///usr////aaa//", dirname("///usr////aaa//"), basename("///usr////aaa//"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr/lib/foo", dirname("usr/lib/foo"), basename("usr/lib/foo"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr/lib/foo/", dirname("usr/lib/foo/"), basename("usr/lib/foo/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr/", dirname("usr/"), basename("usr/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr///", dirname("usr///"), basename("usr///"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr////", dirname("usr////"), basename("usr////"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr////aaa//", dirname("usr////aaa//"), basename("usr////aaa//"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/", dirname("/"), basename("/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"////", dirname("////"), basename("////"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"usr", dirname("usr"), basename("usr"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
".", dirname("."), basename("."));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"..", dirname(".."), basename(".."));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/foo/bar/baaz/quux/", dirname("/foo/bar/baaz/quux/"), basename("/foo/bar/baaz/quux/"));
printf("input: '%s'\t\tdir: '%s' base: '%s'\n",
"/a//b", dirname("/a//b"), basename("/a//b"));
}

View File

@@ -0,0 +1,117 @@
/* stubgen sample test file */
#include <string.h>
class Bar { public: Bar(int i) {} };
class sdfs { int i; };
#define macro(x) MultiLineMacro(x)
#define MultiLineMacro(x) bar(x); \
quux(x);
#define BUFSIZE 255
#define i3 3
#if defined(__EXTENSIONS__) || ((__STDC__ == 0 && \
!defined(_POSIX_C_SOURCE)) || defined(_XOPEN_SOURCE))
extern int foo;
int j = foo;
#endif
int arry[] = {
0, 1, 2, 3, 4
};
class fwd_decl_clazz;
typedef struct oldschool {
int iOldSchool;
double dOldSchool;
#define BAR(x) \
bar(x); \
quux(x);
int i2; char c2;
} oldschool_t;
typedef int stubelem_t;
/* template <class K, class V> */
class Foo : public Bar, sdfs {
protected:
char buffer[BUFSIZE + 1];
int dumfunc(int a[BUFSIZE+i3]);
public:
void boundary_condition() {};
Foo(int a);
Foo(double d) : Bar(23), a_(d) { int a = 34; }
int * const quux(int a);
int i2(); char c2(...);
int iOldSchool2; /*
here's a comment
that
#define foo bar() \
sd
might be hard
to parse
*/
virtual void pure_virtual() = 0;
void not_pure_virtual();
void elipsis(int iElip, char cElip, float fElip, ...);
class Quux {
char c_;
char *pc_;
char charfunc(char c1, char c2, char c3, char c4, char c5);
char& cool_func(char, short s, int, long l, long[]);
void funcA(int a, int b, int c = 33);
void* funcB(int a, int b = 2, int c = 23) const;
void * funcC(int a = 0, int b = 2, int c = 23) { return 0; }
char *& funcD(char * w, int a = 0, int b = 2, int c = 23);
void proto(int, char);
Quux(int z = 0);
~Quux();
int test;
void test0() {};
Bar test2(const int &i) const;
long long test3() const throw(int, Foo::Quux, float);
void test4() {}
void test5(int a) {};
struct NestMe {
public:
NestMe(int foo, int bar, int hi_there);
int getVal(stubelem_t *whee) throw(int, Foo::Quux, float);
int getFoo() throw(int, float) { return 1; }
};
int getBar() throw(int, float);
};
virtual double toto(double &d = 1.0, int i = 4);
/* the next line won't be expanded because it's inlined. */
const int getValue() { return a_; }
private:
int a_;
};
class WidgetLens {
public:
WidgetLens();
};
class WidgetCsg : public WidgetLens {
protected:
public:
virtual ~WidgetCsg() {}
WidgetCsg();
};