annotate R/scratch/stdio.R @ 43:1086ca649715

- fixed use after free issue with string handling (keeping strings as copy until after call)
author Tassilo Philipp
date Wed, 15 Apr 2020 21:58:13 +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 # 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