summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-07 19:33:50 +0000
committerChris Lattner <sabre@nondot.org>2002-11-07 19:33:50 +0000
commita41a195374d0a4aa3665943b33ec99e0568051ce (patch)
tree7bb8cdac150cb7b256fe8c7ece70170f9c1ea057 /llvm/lib/ExecutionEngine/Interpreter
parenta2b4c6cc492bfadc3cd8ebc4f167e28bc81d0268 (diff)
downloadbcm5719-llvm-a41a195374d0a4aa3665943b33ec99e0568051ce.tar.gz
bcm5719-llvm-a41a195374d0a4aa3665943b33ec99e0568051ce.zip
Implement freopen for burg
llvm-svn: 4606
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index b8f7786f6a8..cb85a234749 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -531,11 +531,20 @@ GenericValue lle_X_fgets(FunctionType *M, const vector<GenericValue> &Args) {
return GV;
}
+// FILE *freopen(const char *path, const char *mode, FILE *stream);
+GenericValue lle_X_freopen(FunctionType *M, const vector<GenericValue> &Args) {
+ assert(Args.size() == 3);
+ GenericValue GV;
+ GV.PointerVal = (PointerTy)freopen((char*)Args[0].PointerVal,
+ (char*)Args[1].PointerVal,
+ getFILE(Args[2].PointerVal));
+ return GV;
+}
+
// int fflush(FILE *stream);
GenericValue lle_X_fflush(FunctionType *M, const vector<GenericValue> &Args) {
assert(Args.size() == 1);
GenericValue GV;
-
GV.IntVal = fflush(getFILE(Args[0].PointerVal));
return GV;
}
@@ -544,7 +553,6 @@ GenericValue lle_X_fflush(FunctionType *M, const vector<GenericValue> &Args) {
GenericValue lle_X_getc(FunctionType *M, const vector<GenericValue> &Args) {
assert(Args.size() == 1);
GenericValue GV;
-
GV.IntVal = getc(getFILE(Args[0].PointerVal));
return GV;
}
@@ -632,4 +640,5 @@ void Interpreter::initializeExternalMethods() {
FuncNames["lle_X_fputc"] = lle_X_fputc;
FuncNames["lle_X_ungetc"] = lle_X_ungetc;
FuncNames["lle_X_fprintf"] = lle_X_fprintf;
+ FuncNames["lle_X_freopen"] = lle_X_freopen;
}
OpenPOWER on IntegriCloud