mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Implement freopen for burg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ab2dea5687
commit
a4479cd946
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user