source: golgotha/src/i4/test/dll_test/test.hh @ 608

Last change on this file since 608 was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef TEST_HH
10#define TEST_HH
11
12#include <stdio.h>
13
14class CStart
15// Startup code test
16{
17public:
18  CStart(char *name)
19  {
20    printf("%s loaded successfully\n",name);
21  }
22};
23
24class CBase
25// Base class for virtual functions & object members testing
26{
27protected:
28  virtual char *Type() = 0;
29public:
30  char *name;
31
32  CBase(char *_name) : name(_name) {}
33
34  void print()
35  {
36    printf("I'm [%s]:[%s].\n", Type(), name);
37  }
38
39  virtual void Action(char *command) = 0;
40};
41
42class CFoundry;
43extern CFoundry *Foundry;
44class CFoundry
45{
46private:
47  friend class CBaseFoundry;
48  CFoundry *next, *prev;
49
50  CFoundry(int dummy)
51  {
52    next = this;
53    prev = this;
54  }
55
56public:
57  CFoundry()
58  {
59    prev = Foundry;
60    next = Foundry->next;
61    Foundry->next->prev = this;
62    Foundry->next = this;
63    printf("Foundry registered.\n");
64  }
65
66  ~CFoundry()
67  {
68    next->prev = prev;
69    prev->next = next;
70    printf("Foundry unlinked.\n");
71  }
72
73  virtual char *Type() = 0;
74  virtual CBase *Make(char *name) = 0;
75};
76
77typedef void (*test_func)(int a, int b);
78
79extern CBase *Make(char *type, char *name);
80
81#endif
Note: See TracBrowser for help on using the repository browser.