OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [c64/] [testfiles/] [ArrayTest1.cpp] - Blame information for rev 41

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 41 robfinch
 
2
extern int printf(char *, ...);
3
 
4
int AnArray[10][20][30][40][50];
5
 
6
typedef struct {
7
  char *ptr;
8
  int len;
9
} MyStruct;
10
 
11
MyStruct structArray[15][25][5][6];
12
 
13
class ATest
14
{
15
public:
16
  int avar;
17
  static int masterKey;
18
  virtual int MyFunc();
19
  int MyFunc(int a, int b);
20
  int (*fncptr)();
21
  int MyOtherFunc();
22
  int avarb;
23
  int Func3(int a,int b,int c);
24
  int avarc;
25
};
26
 
27
class ATest2 : public ATest
28
{
29
        int urvar;
30
        int anothor_var;
31
        int MyFunc();
32
};
33
 
34
int ATest::MyFunc()
35
{
36
  if (this != 0) {
37
    prolog {
38
      asm { hi there };
39
    }
40
    printf("master=%d",masterKey);
41
    printf("Hello World!");
42
    printf("%d", avarc);
43
    Func3(avarc);
44
  }
45
}
46
 
47
int ATest2::MyFunc()
48
{
49
  if (this != 0) {
50
    printf("master=%d",masterKey);
51
    printf("ATest2 Hello World!");
52
    printf("%d", avarc);
53
  }
54
}
55
 
56
int MyFunc(int a, int b)
57
{
58
  printf("a=%d",a);
59
  printf("b=%d",b);
60
}
61
 
62
int ATest::Func3(int b, int c, int d)
63
{
64
  printf("%d", b);
65
  printf("%d", avar);
66
}
67
 
68
 
69
int main()
70
{
71
        ATest testvar;
72
        ATest *p;
73
        ATest2 tv2;
74
  int ii,jj,kk,mm,nn;
75
  int gg;
76
 
77
  for (ii = 0; ii < 10; ii++)
78
  for (jj = 0; jj < 20; jj++)
79
  for (kk = 0; kk < 30; kk++)
80
  for (mm = 0; mm < 40; mm++)
81
  for (nn = 0; nn < 50; nn++)
82
      printf("%d", AnArray[ii][jj][kk][mm][nn]);
83
 
84
  for (ii = 0; ii < 15; ii++)
85
  for (jj = 0; jj < 25; jj++)
86
  for (kk = 0; kk < 5; kk++)
87
  for (mm = 0; mm < 6; mm++)
88
    printf("ptr:%p", structArray[ii][jj][kk][mm].ptr);
89
 
90
/*
91
  for (ii = 0; ii < 10; ii++) {
92
  for (jj = 0; jj < 20; jj++) {
93
     gg = AnArray[ii][jj];
94
      printf("%d", gg);
95
  }
96
  }
97
*/
98
        printf("%d",testvar.avar);
99
        testvar.MyFunc();
100
  testvar.MyFunc(20 , 30);
101
        testvar.MyOtherFunc();
102
        testvar.Func3(10 , 15 , 25);
103
        (*testvar.fncptr)();
104
        printf("%d",testvar.avarb);
105
        p->MyFunc();
106
        printf("%d",tv2.avar);
107
}
108
 
109
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.