annotate R/scratch/stdio.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 # Dynport: stdio
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 # Description: Standard I/O C library
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 # Dynport-Maintainer: dadler@uni-goettingen.de
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 # -----------------------------------------------------------------------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 .sysname <- Sys.info()[["sysname"]]
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 if (.sysname == "Windows") {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 .libNameC <- "msvcrt"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 } else {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 .libNameC <- "c"
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 dynbind(.libNameC,"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 fopen(ZZ)p;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 fread(piip)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 fwrite(piip)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 fseek(pli)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 fclose(p)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 memcpy(ppi)p;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 memset(pii)p;
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 SEEK_SET = 0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 SEEK_CUR = 1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 SEEK_END = 2