From a5c0bfe09aad45e30805ef8a3c9358e96a39a3b5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 6 Nov 2002 22:59:28 +0000 Subject: [PATCH] Implement fputc and ungetc to allow burg to run in lli git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4584 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Interpreter/ExternalFunctions.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index bde32bd2691..c0230c32f79 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -549,6 +549,22 @@ GenericValue lle_X_getc(FunctionType *M, const vector &Args) { return GV; } +// int fputc(int C, FILE *stream); +GenericValue lle_X_fputc(FunctionType *M, const vector &Args) { + assert(Args.size() == 2); + GenericValue GV; + GV.IntVal = fputc(Args[0].IntVal, getFILE(Args[1].PointerVal)); + return GV; +} + +// int ungetc(int C, FILE *stream); +GenericValue lle_X_ungetc(FunctionType *M, const vector &Args) { + assert(Args.size() == 2); + GenericValue GV; + GV.IntVal = ungetc(Args[0].IntVal, getFILE(Args[1].PointerVal)); + return GV; +} + } // End extern "C" @@ -596,5 +612,8 @@ void Interpreter::initializeExternalMethods() { FuncNames["lle_X_fwrite"] = lle_X_fwrite; FuncNames["lle_X_fgets"] = lle_X_fgets; FuncNames["lle_X_fflush"] = lle_X_fflush; + FuncNames["lle_X_fgetc"] = lle_X_getc; FuncNames["lle_X_getc"] = lle_X_getc; + FuncNames["lle_X_fputc"] = lle_X_fputc; + FuncNames["lle_X_ungetc"] = lle_X_ungetc; } -- 2.34.1