annotate R/cocoa/src/package.m @ 21:40a2c4198016

- working jdc (but with memleaks, currently) - added example
author cslag
date Wed, 30 Mar 2016 23:40:52 +0200
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /** ===========================================================================
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 ** R-Package: cocoa
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 ** File: coca/src/package.m
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 ** Description: R package registry and initialization of NSAutoreleasePool
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 **
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 ** Copyright (C) 2009 Daniel Adler
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 **/
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 #include <Rinternals.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 #include <R_ext/Rdynload.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 #include <stdio.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 #import <Foundation/NSAutoreleasePool.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 #import <AppKit/NSApplication.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 NSAutoreleasePool* pool;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 void R_init_cocoa(DllInfo* info)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 [[NSAutoreleasePool alloc] init];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 NSApplicationLoad();
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 // [NSApplication sharedApplication];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 // [NSApp run];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 printf("init\n");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 void R_unload_cocoa(DllInfo* info)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 [pool drain];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29