annotate R/scratch/dynport_dyp.R @ 54:918dab7a6606

- added callback support (comes with some bigger refactoring) - allow CPython's Py{CObject,Capsule} to be used as 'p'ointers
author Tassilo Philipp
date Tue, 02 Feb 2021 20:42:02 +0100
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 # 1. install functions
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 # 2. install function variables
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 # 3. install enums
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 # 4. install defines
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 begin.info <- function()
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 begin.funs <- function()
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 parse.funs <- function(line)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21
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 parse <- function(path)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 file <- file(path)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 eof <- FALSE
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 while(!eof)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 line <- readLines(file, 1)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 parse("rdyncall/scratch/test.dyp")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 currentSection <- ""
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 if ( substr(line, 1, 1) == "!" ) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 paste("end.", currentSection)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 do.call( paste("end.", currentSection, sep="") )
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 type <- substr(line,2)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 handler <- paste("begin.",type,sep="")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 envs <- find(handler)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 if (length(envs) == 1)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 do.call(handler)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50