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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-cdtest/] [cdtest-foo.cc] - Blame information for rev 205

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
// Class Foo
2
#pragma implementation
3
 
4
 
5
// We don't use header files, since we only want to see, whether the
6
// compiler is installed properly.
7
//
8
#if (__GNUG__ == 2)
9
typedef __SIZE_TYPE__ size_t;
10
#else
11
typedef unsigned int size_t;
12
#endif
13
 
14
extern "C" {
15
    char *strncpy (char* dest, const char* src, size_t len);
16
    int printf (const char*, ...);
17
};
18
 
19
#include "cdtest-foo.h"
20
 
21
int Foo::foos = 0;
22
 
23
void Foo::init_foo ()
24
{
25
    printf ("BROKENLY calling Foo::init_foo from __init_start; size_of(Foo) = %ld\n", (long) sizeof(Foo));
26
    foos = FOOLISH_NUMBER;
27
}
28
 
29
 
30
Foo::Foo ()
31
{
32
    i = ++foos;
33
    strncpy (message, "default-foo", len);
34
#ifdef WITH_ADDR
35
    printf ("Constructing Foo(%d) \"default-foo\" at %08x\n", i, this);
36
#else
37
    printf ("Constructing Foo(%d) \"default-foo\"\n", i);
38
#endif
39
}
40
 
41
Foo::Foo (const char* msg)
42
{
43
    i = ++foos;
44
    strncpy( message, msg, len);
45
#ifdef WITH_ADDR
46
    printf ( "Constructing Foo(%d) \"%s\" at %08x\n", i, message, this);
47
#else
48
    printf ( "Constructing Foo(%d) \"%s\"\n", i, message);
49
#endif
50
}
51
 
52
 
53
Foo::Foo (const Foo& foo)
54
{
55
    i = ++foos;
56
#ifdef WITH_ADDR
57
    printf ("Initializing Foo(%d) \"%s\" at %08x with Foo(%d) %08x\n",
58
            i, foo.message, this, foo.i, &foo);
59
#else
60
   printf ("Initializing Foo(%d) \"%s\" with Foo(%d)\n",i, foo.message, foo.i);
61
#endif
62
    for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k];
63
}
64
 
65
 
66
Foo& Foo::operator= (const Foo& foo)
67
{
68
#ifdef WITH_ADDR
69
    printf ("Copying Foo(%d) \"%s\" at %08x to Foo(%d) %08x\n",
70
            foo.i, foo.message, &foo, i, this);
71
#else
72
   printf ("Copying Foo(%d) \"%s\" to Foo(%d)\n", foo.i, foo.message, i);
73
#endif
74
    for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k];
75
    return *this;
76
}
77
 
78
 
79
Foo::~Foo ()
80
{
81
    foos--;
82
#ifdef WITH_ADDR
83
    printf ("Destructing Foo(%d) \"%s\" at %08x (remaining foos: %d)\n",
84
            i, message, this, foos);
85
#else
86
    printf ("Destructing Foo(%d) \"%s\" (remaining foos: %d)\n",
87
            i, message, foos);
88
#endif
89
}

powered by: WebSVN 2.1.0

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