14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
*
* You should have received a copy of the GNU Lesser General Public License
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#define Class IntuitionClass
#include <proto/exec.h>
#undef Class
#import "OFInitializationFailedException.h"
#import "macros.h"
#ifdef OF_AMIGAOS4
extern struct Library *DOSBase;
extern struct DOSIFace *IDOS;
#endif
struct Library *LocaleBase;
#ifdef OF_AMIGAOS4
struct LocaleIFace *ILocale;
#endif
OF_CONSTRUCTOR()
{
#ifdef OF_AMIGAOS4
if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL)
@throw [OFInitializationFailedException exception];
if ((IDOS = (struct DOSIFace *)
GetInterface(DOSBase, "main", 1, NULL)) == NULL)
@throw [OFInitializationFailedException exception];
#endif
if ((LocaleBase = OpenLibrary("locale.library", 38)) == NULL)
@throw [OFInitializationFailedException exception];
#ifdef OF_AMIGAOS4
if ((ILocale = (struct LocaleIFace *)
GetInterface(LocaleBase, "main", 1, NULL)) == NULL)
@throw [OFInitializationFailedException exception];
#endif
}
OF_DESTRUCTOR()
{
#ifdef OF_AMIGAOS4
if (ILocale != NULL)
DropInterface((struct Interface *)ILocale);
#endif
if (LocaleBase != NULL)
CloseLibrary(LocaleBase);
|
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
*
* You should have received a copy of the GNU Lesser General Public License
* version 3.0 along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#import "macros.h"
#define Class IntuitionClass
#include <proto/exec.h>
#undef Class
#ifdef OF_MORPHOS
# include <devices/timer.h>
# include <ppcinline/timer.h>
#endif
#import "OFInitializationFailedException.h"
#ifdef OF_AMIGAOS4
extern struct Library *DOSBase;
extern struct DOSIFace *IDOS;
#endif
struct Library *LocaleBase;
#ifdef OF_AMIGAOS4
struct LocaleIFace *ILocale;
#endif
#ifdef OF_MORPHOS
struct Device *TimerBase;
static struct timerequest timeRequest;
#endif
OF_CONSTRUCTOR()
{
#ifdef OF_AMIGAOS4
if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL)
@throw [OFInitializationFailedException exception];
if ((IDOS = (struct DOSIFace *)
GetInterface(DOSBase, "main", 1, NULL)) == NULL)
@throw [OFInitializationFailedException exception];
#endif
if ((LocaleBase = OpenLibrary("locale.library", 38)) == NULL)
@throw [OFInitializationFailedException exception];
#ifdef OF_AMIGAOS4
if ((ILocale = (struct LocaleIFace *)
GetInterface(LocaleBase, "main", 1, NULL)) == NULL)
@throw [OFInitializationFailedException exception];
#endif
#ifdef OF_MORPHOS
if (OpenDevice("timer.device", UNIT_MICROHZ,
&timeRequest.tr_node, 0) != 0)
@throw [OFInitializationFailedException exception];
TimerBase = timeRequest.tr_node.io_Device;
#endif
}
OF_DESTRUCTOR()
{
#ifdef OF_MORPHOS
if (TimerBase != NULL)
CloseDevice(&timeRequest.tr_node);
#endif
#ifdef OF_AMIGAOS4
if (ILocale != NULL)
DropInterface((struct Interface *)ILocale);
#endif
if (LocaleBase != NULL)
CloseLibrary(LocaleBase);
|