1 //===-- ExternalFunctions.cpp - Implement External Functions --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains both code to deal with invoking "external" functions, but
11 // also contains code that implements "exported" external functions.
13 // External functions in the interpreter are implemented by
14 // using the system's dynamic loader to look up the address of the function
15 // we want to invoke. If a function is found, then one of the
16 // many lle_* wrapper functions in this file will translate its arguments from
17 // GenericValues to the types the function is actually expecting, before the
18 // function is called.
20 //===----------------------------------------------------------------------===//
22 #include "Interpreter.h"
23 #include "llvm/DerivedTypes.h"
24 #include "llvm/Module.h"
25 #include "llvm/Support/Streams.h"
26 #include "llvm/System/DynamicLibrary.h"
27 #include "llvm/Target/TargetData.h"
35 typedef GenericValue (*ExFunc)(FunctionType *, const vector<GenericValue> &);
36 static std::map<const Function *, ExFunc> Functions;
37 static std::map<std::string, ExFunc> FuncNames;
39 static Interpreter *TheInterpreter;
41 static char getTypeID(const Type *Ty) {
42 switch (Ty->getTypeID()) {
43 case Type::VoidTyID: return 'V';
44 case Type::BoolTyID: return 'o';
45 case Type::Int8TyID: return 'B';
46 case Type::Int16TyID: return 'S';
47 case Type::Int32TyID: return 'I';
48 case Type::Int64TyID: return 'L';
49 case Type::FloatTyID: return 'F';
50 case Type::DoubleTyID: return 'D';
51 case Type::PointerTyID: return 'P';
52 case Type::FunctionTyID:return 'M';
53 case Type::StructTyID: return 'T';
54 case Type::ArrayTyID: return 'A';
55 case Type::OpaqueTyID: return 'O';
60 static ExFunc lookupFunction(const Function *F) {
61 // Function not found, look it up... start by figuring out what the
62 // composite function name should be.
63 std::string ExtName = "lle_";
64 const FunctionType *FT = F->getFunctionType();
65 for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i)
66 ExtName += getTypeID(FT->getContainedType(i));
67 ExtName += "_" + F->getName();
69 ExFunc FnPtr = FuncNames[ExtName];
72 (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName);
74 FnPtr = FuncNames["lle_X_"+F->getName()];
75 if (FnPtr == 0) // Try calling a generic function... if it exists...
76 FnPtr = (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(
77 ("lle_X_"+F->getName()).c_str());
79 Functions.insert(std::make_pair(F, FnPtr)); // Cache for later
83 GenericValue Interpreter::callExternalFunction(Function *F,
84 const std::vector<GenericValue> &ArgVals) {
85 TheInterpreter = this;
87 // Do a lookup to see if the function is in our cache... this should just be a
88 // deferred annotation!
89 std::map<const Function *, ExFunc>::iterator FI = Functions.find(F);
90 ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second;
92 cerr << "Tried to execute an unknown external function: "
93 << F->getType()->getDescription() << " " << F->getName() << "\n";
94 if (F->getName() == "__main")
95 return GenericValue();
99 // TODO: FIXME when types are not const!
100 GenericValue Result = Fn(const_cast<FunctionType*>(F->getFunctionType()),
106 //===----------------------------------------------------------------------===//
107 // Functions "exported" to the running application...
109 extern "C" { // Don't add C++ manglings to llvm mangling :)
111 // void putchar(sbyte)
112 GenericValue lle_VB_putchar(FunctionType *M, const vector<GenericValue> &Args) {
113 cout << Args[0].Int8Val;
114 return GenericValue();
118 GenericValue lle_ii_putchar(FunctionType *M, const vector<GenericValue> &Args) {
119 cout << ((char)Args[0].Int32Val) << std::flush;
123 // void putchar(ubyte)
124 GenericValue lle_Vb_putchar(FunctionType *M, const vector<GenericValue> &Args) {
125 cout << Args[0].Int8Val << std::flush;
129 // void atexit(Function*)
130 GenericValue lle_X_atexit(FunctionType *M, const vector<GenericValue> &Args) {
131 assert(Args.size() == 1);
132 TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0]));
139 GenericValue lle_X_exit(FunctionType *M, const vector<GenericValue> &Args) {
140 TheInterpreter->exitCalled(Args[0]);
141 return GenericValue();
145 GenericValue lle_X_abort(FunctionType *M, const vector<GenericValue> &Args) {
147 return GenericValue();
150 // void *malloc(uint)
151 GenericValue lle_X_malloc(FunctionType *M, const vector<GenericValue> &Args) {
152 assert(Args.size() == 1 && "Malloc expects one argument!");
153 return PTOGV(malloc(Args[0].Int32Val));
156 // void *calloc(uint, uint)
157 GenericValue lle_X_calloc(FunctionType *M, const vector<GenericValue> &Args) {
158 assert(Args.size() == 2 && "calloc expects two arguments!");
159 return PTOGV(calloc(Args[0].Int32Val, Args[1].Int32Val));
163 GenericValue lle_X_free(FunctionType *M, const vector<GenericValue> &Args) {
164 assert(Args.size() == 1);
165 free(GVTOP(Args[0]));
166 return GenericValue();
170 GenericValue lle_X_atoi(FunctionType *M, const vector<GenericValue> &Args) {
171 assert(Args.size() == 1);
173 GV.Int32Val = atoi((char*)GVTOP(Args[0]));
177 // double pow(double, double)
178 GenericValue lle_X_pow(FunctionType *M, const vector<GenericValue> &Args) {
179 assert(Args.size() == 2);
181 GV.DoubleVal = pow(Args[0].DoubleVal, Args[1].DoubleVal);
185 // double exp(double)
186 GenericValue lle_X_exp(FunctionType *M, const vector<GenericValue> &Args) {
187 assert(Args.size() == 1);
189 GV.DoubleVal = exp(Args[0].DoubleVal);
193 // double sqrt(double)
194 GenericValue lle_X_sqrt(FunctionType *M, const vector<GenericValue> &Args) {
195 assert(Args.size() == 1);
197 GV.DoubleVal = sqrt(Args[0].DoubleVal);
201 // double log(double)
202 GenericValue lle_X_log(FunctionType *M, const vector<GenericValue> &Args) {
203 assert(Args.size() == 1);
205 GV.DoubleVal = log(Args[0].DoubleVal);
209 // double floor(double)
210 GenericValue lle_X_floor(FunctionType *M, const vector<GenericValue> &Args) {
211 assert(Args.size() == 1);
213 GV.DoubleVal = floor(Args[0].DoubleVal);
220 GenericValue lle_X_drand48(FunctionType *M, const vector<GenericValue> &Args) {
221 assert(Args.size() == 0);
223 GV.DoubleVal = drand48();
228 GenericValue lle_X_lrand48(FunctionType *M, const vector<GenericValue> &Args) {
229 assert(Args.size() == 0);
231 GV.Int32Val = lrand48();
235 // void srand48(long)
236 GenericValue lle_X_srand48(FunctionType *M, const vector<GenericValue> &Args) {
237 assert(Args.size() == 1);
238 srand48(Args[0].Int32Val);
239 return GenericValue();
245 GenericValue lle_X_rand(FunctionType *M, const vector<GenericValue> &Args) {
246 assert(Args.size() == 0);
248 GV.Int32Val = rand();
253 GenericValue lle_X_srand(FunctionType *M, const vector<GenericValue> &Args) {
254 assert(Args.size() == 1);
255 srand(Args[0].Int32Val);
256 return GenericValue();
259 // int puts(const char*)
260 GenericValue lle_X_puts(FunctionType *M, const vector<GenericValue> &Args) {
261 assert(Args.size() == 1);
263 GV.Int32Val = puts((char*)GVTOP(Args[0]));
267 // int sprintf(sbyte *, sbyte *, ...) - a very rough implementation to make
269 GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
270 char *OutputBuffer = (char *)GVTOP(Args[0]);
271 const char *FmtStr = (const char *)GVTOP(Args[1]);
274 // printf should return # chars printed. This is completely incorrect, but
275 // close enough for now.
276 GenericValue GV; GV.Int32Val = strlen(FmtStr);
279 case 0: return GV; // Null terminator...
280 default: // Normal nonspecial character
281 sprintf(OutputBuffer++, "%c", *FmtStr++);
283 case '\\': { // Handle escape codes
284 sprintf(OutputBuffer, "%c%c", *FmtStr, *(FmtStr+1));
285 FmtStr += 2; OutputBuffer += 2;
288 case '%': { // Handle format specifiers
289 char FmtBuf[100] = "", Buffer[1000] = "";
292 char Last = *FB++ = *FmtStr++;
293 unsigned HowLong = 0;
294 while (Last != 'c' && Last != 'd' && Last != 'i' && Last != 'u' &&
295 Last != 'o' && Last != 'x' && Last != 'X' && Last != 'e' &&
296 Last != 'E' && Last != 'g' && Last != 'G' && Last != 'f' &&
297 Last != 'p' && Last != 's' && Last != '%') {
298 if (Last == 'l' || Last == 'L') HowLong++; // Keep track of l's
299 Last = *FB++ = *FmtStr++;
305 sprintf(Buffer, FmtBuf); break;
307 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
313 TheInterpreter->getTargetData()->getPointerSizeInBits() == 64 &&
314 sizeof(long) < sizeof(int64_t)) {
315 // Make sure we use %lld with a 64 bit argument because we might be
316 // compiling LLI on a 32 bit compiler.
317 unsigned Size = strlen(FmtBuf);
318 FmtBuf[Size] = FmtBuf[Size-1];
320 FmtBuf[Size-1] = 'l';
322 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int64Val);
324 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
325 case 'e': case 'E': case 'g': case 'G': case 'f':
326 sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
328 sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
330 sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
331 default: cerr << "<unknown printf code '" << *FmtStr << "'!>";
334 strcpy(OutputBuffer, Buffer);
335 OutputBuffer += strlen(Buffer);
342 // int printf(sbyte *, ...) - a very rough implementation to make output useful.
343 GenericValue lle_X_printf(FunctionType *M, const vector<GenericValue> &Args) {
345 vector<GenericValue> NewArgs;
346 NewArgs.push_back(PTOGV(Buffer));
347 NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
348 GenericValue GV = lle_X_sprintf(M, NewArgs);
353 static void ByteswapSCANFResults(const char *Fmt, void *Arg0, void *Arg1,
354 void *Arg2, void *Arg3, void *Arg4, void *Arg5,
355 void *Arg6, void *Arg7, void *Arg8) {
356 void *Args[] = { Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, 0 };
358 // Loop over the format string, munging read values as appropriate (performs
359 // byteswaps as necessary).
363 // Read any flag characters that may be present...
364 bool Suppress = false;
367 bool LongLong = false; // long long or long double
371 case '*': Suppress = true; break;
372 case 'a': /*Allocate = true;*/ break; // We don't need to track this
373 case 'h': Half = true; break;
374 case 'l': Long = true; break;
376 case 'L': LongLong = true; break;
378 if (Fmt[-1] > '9' || Fmt[-1] < '0') // Ignore field width specs
384 // Read the conversion character
385 if (!Suppress && Fmt[-1] != '%') { // Nothing to do?
390 case 'i': case 'o': case 'u': case 'x': case 'X': case 'n': case 'p':
392 if (Long || LongLong) {
393 Size = 8; Ty = Type::Int64Ty;
395 Size = 4; Ty = Type::Int16Ty;
397 Size = 4; Ty = Type::Int32Ty;
401 case 'e': case 'g': case 'E':
403 if (Long || LongLong) {
404 Size = 8; Ty = Type::DoubleTy;
406 Size = 4; Ty = Type::FloatTy;
410 case 's': case 'c': case '[': // No byteswap needed
420 void *Arg = Args[ArgNo++];
421 memcpy(&GV, Arg, Size);
422 TheInterpreter->StoreValueToMemory(GV, (GenericValue*)Arg, Ty);
429 // int sscanf(const char *format, ...);
430 GenericValue lle_X_sscanf(FunctionType *M, const vector<GenericValue> &args) {
431 assert(args.size() < 10 && "Only handle up to 10 args to sscanf right now!");
434 for (unsigned i = 0; i < args.size(); ++i)
435 Args[i] = (char*)GVTOP(args[i]);
438 GV.Int32Val = sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
439 Args[5], Args[6], Args[7], Args[8], Args[9]);
440 ByteswapSCANFResults(Args[1], Args[2], Args[3], Args[4],
441 Args[5], Args[6], Args[7], Args[8], Args[9], 0);
445 // int scanf(const char *format, ...);
446 GenericValue lle_X_scanf(FunctionType *M, const vector<GenericValue> &args) {
447 assert(args.size() < 10 && "Only handle up to 10 args to scanf right now!");
450 for (unsigned i = 0; i < args.size(); ++i)
451 Args[i] = (char*)GVTOP(args[i]);
454 GV.Int32Val = scanf( Args[0], Args[1], Args[2], Args[3], Args[4],
455 Args[5], Args[6], Args[7], Args[8], Args[9]);
456 ByteswapSCANFResults(Args[0], Args[1], Args[2], Args[3], Args[4],
457 Args[5], Args[6], Args[7], Args[8], Args[9]);
462 // int clock(void) - Profiling implementation
463 GenericValue lle_i_clock(FunctionType *M, const vector<GenericValue> &Args) {
464 extern unsigned int clock(void);
465 GenericValue GV; GV.Int32Val = clock();
470 //===----------------------------------------------------------------------===//
471 // String Functions...
472 //===----------------------------------------------------------------------===//
474 // int strcmp(const char *S1, const char *S2);
475 GenericValue lle_X_strcmp(FunctionType *M, const vector<GenericValue> &Args) {
476 assert(Args.size() == 2);
478 Ret.Int32Val = strcmp((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]));
482 // char *strcat(char *Dest, const char *src);
483 GenericValue lle_X_strcat(FunctionType *M, const vector<GenericValue> &Args) {
484 assert(Args.size() == 2);
485 return PTOGV(strcat((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
488 // char *strcpy(char *Dest, const char *src);
489 GenericValue lle_X_strcpy(FunctionType *M, const vector<GenericValue> &Args) {
490 assert(Args.size() == 2);
491 return PTOGV(strcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
494 static GenericValue size_t_to_GV (size_t n) {
496 if (sizeof (size_t) == sizeof (uint64_t)) {
499 assert (sizeof (size_t) == sizeof (unsigned int));
505 static size_t GV_to_size_t (GenericValue GV) {
507 if (sizeof (size_t) == sizeof (uint64_t)) {
508 count = (size_t)GV.Int64Val;
510 assert (sizeof (size_t) == sizeof (unsigned int));
511 count = (size_t)GV.Int32Val;
516 // size_t strlen(const char *src);
517 GenericValue lle_X_strlen(FunctionType *M, const vector<GenericValue> &Args) {
518 assert(Args.size() == 1);
519 size_t strlenResult = strlen ((char *) GVTOP (Args[0]));
520 return size_t_to_GV (strlenResult);
523 // char *strdup(const char *src);
524 GenericValue lle_X_strdup(FunctionType *M, const vector<GenericValue> &Args) {
525 assert(Args.size() == 1);
526 return PTOGV(strdup((char*)GVTOP(Args[0])));
529 // char *__strdup(const char *src);
530 GenericValue lle_X___strdup(FunctionType *M, const vector<GenericValue> &Args) {
531 assert(Args.size() == 1);
532 return PTOGV(strdup((char*)GVTOP(Args[0])));
535 // void *memset(void *S, int C, size_t N)
536 GenericValue lle_X_memset(FunctionType *M, const vector<GenericValue> &Args) {
537 assert(Args.size() == 3);
538 size_t count = GV_to_size_t (Args[2]);
539 return PTOGV(memset(GVTOP(Args[0]), Args[1].Int32Val, count));
542 // void *memcpy(void *Dest, void *src, size_t Size);
543 GenericValue lle_X_memcpy(FunctionType *M, const vector<GenericValue> &Args) {
544 assert(Args.size() == 3);
545 size_t count = GV_to_size_t (Args[2]);
546 return PTOGV(memcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]), count));
549 //===----------------------------------------------------------------------===//
551 //===----------------------------------------------------------------------===//
553 // getFILE - Turn a pointer in the host address space into a legit pointer in
554 // the interpreter address space. This is an identity transformation.
555 #define getFILE(ptr) ((FILE*)ptr)
557 // FILE *fopen(const char *filename, const char *mode);
558 GenericValue lle_X_fopen(FunctionType *M, const vector<GenericValue> &Args) {
559 assert(Args.size() == 2);
560 return PTOGV(fopen((const char *)GVTOP(Args[0]),
561 (const char *)GVTOP(Args[1])));
564 // int fclose(FILE *F);
565 GenericValue lle_X_fclose(FunctionType *M, const vector<GenericValue> &Args) {
566 assert(Args.size() == 1);
568 GV.Int32Val = fclose(getFILE(GVTOP(Args[0])));
572 // int feof(FILE *stream);
573 GenericValue lle_X_feof(FunctionType *M, const vector<GenericValue> &Args) {
574 assert(Args.size() == 1);
577 GV.Int32Val = feof(getFILE(GVTOP(Args[0])));
581 // size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
582 GenericValue lle_X_fread(FunctionType *M, const vector<GenericValue> &Args) {
583 assert(Args.size() == 4);
586 result = fread((void*)GVTOP(Args[0]), GV_to_size_t (Args[1]),
587 GV_to_size_t (Args[2]), getFILE(GVTOP(Args[3])));
588 return size_t_to_GV (result);
591 // size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
592 GenericValue lle_X_fwrite(FunctionType *M, const vector<GenericValue> &Args) {
593 assert(Args.size() == 4);
596 result = fwrite((void*)GVTOP(Args[0]), GV_to_size_t (Args[1]),
597 GV_to_size_t (Args[2]), getFILE(GVTOP(Args[3])));
598 return size_t_to_GV (result);
601 // char *fgets(char *s, int n, FILE *stream);
602 GenericValue lle_X_fgets(FunctionType *M, const vector<GenericValue> &Args) {
603 assert(Args.size() == 3);
604 return GVTOP(fgets((char*)GVTOP(Args[0]), Args[1].Int32Val,
605 getFILE(GVTOP(Args[2]))));
608 // FILE *freopen(const char *path, const char *mode, FILE *stream);
609 GenericValue lle_X_freopen(FunctionType *M, const vector<GenericValue> &Args) {
610 assert(Args.size() == 3);
611 return PTOGV(freopen((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]),
612 getFILE(GVTOP(Args[2]))));
615 // int fflush(FILE *stream);
616 GenericValue lle_X_fflush(FunctionType *M, const vector<GenericValue> &Args) {
617 assert(Args.size() == 1);
619 GV.Int32Val = fflush(getFILE(GVTOP(Args[0])));
623 // int getc(FILE *stream);
624 GenericValue lle_X_getc(FunctionType *M, const vector<GenericValue> &Args) {
625 assert(Args.size() == 1);
627 GV.Int32Val = getc(getFILE(GVTOP(Args[0])));
631 // int _IO_getc(FILE *stream);
632 GenericValue lle_X__IO_getc(FunctionType *F, const vector<GenericValue> &Args) {
633 return lle_X_getc(F, Args);
636 // int fputc(int C, FILE *stream);
637 GenericValue lle_X_fputc(FunctionType *M, const vector<GenericValue> &Args) {
638 assert(Args.size() == 2);
640 GV.Int32Val = fputc(Args[0].Int32Val, getFILE(GVTOP(Args[1])));
644 // int ungetc(int C, FILE *stream);
645 GenericValue lle_X_ungetc(FunctionType *M, const vector<GenericValue> &Args) {
646 assert(Args.size() == 2);
648 GV.Int32Val = ungetc(Args[0].Int32Val, getFILE(GVTOP(Args[1])));
652 // int ferror (FILE *stream);
653 GenericValue lle_X_ferror(FunctionType *M, const vector<GenericValue> &Args) {
654 assert(Args.size() == 1);
656 GV.Int32Val = ferror (getFILE(GVTOP(Args[0])));
660 // int fprintf(FILE *,sbyte *, ...) - a very rough implementation to make output
662 GenericValue lle_X_fprintf(FunctionType *M, const vector<GenericValue> &Args) {
663 assert(Args.size() >= 2);
665 vector<GenericValue> NewArgs;
666 NewArgs.push_back(PTOGV(Buffer));
667 NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
668 GenericValue GV = lle_X_sprintf(M, NewArgs);
670 fputs(Buffer, getFILE(GVTOP(Args[0])));
677 void Interpreter::initializeExternalFunctions() {
678 FuncNames["lle_Vb_putchar"] = lle_Vb_putchar;
679 FuncNames["lle_ii_putchar"] = lle_ii_putchar;
680 FuncNames["lle_VB_putchar"] = lle_VB_putchar;
681 FuncNames["lle_X_exit"] = lle_X_exit;
682 FuncNames["lle_X_abort"] = lle_X_abort;
683 FuncNames["lle_X_malloc"] = lle_X_malloc;
684 FuncNames["lle_X_calloc"] = lle_X_calloc;
685 FuncNames["lle_X_free"] = lle_X_free;
686 FuncNames["lle_X_atoi"] = lle_X_atoi;
687 FuncNames["lle_X_pow"] = lle_X_pow;
688 FuncNames["lle_X_exp"] = lle_X_exp;
689 FuncNames["lle_X_log"] = lle_X_log;
690 FuncNames["lle_X_floor"] = lle_X_floor;
691 FuncNames["lle_X_srand"] = lle_X_srand;
692 FuncNames["lle_X_rand"] = lle_X_rand;
694 FuncNames["lle_X_drand48"] = lle_X_drand48;
695 FuncNames["lle_X_srand48"] = lle_X_srand48;
696 FuncNames["lle_X_lrand48"] = lle_X_lrand48;
698 FuncNames["lle_X_sqrt"] = lle_X_sqrt;
699 FuncNames["lle_X_puts"] = lle_X_puts;
700 FuncNames["lle_X_printf"] = lle_X_printf;
701 FuncNames["lle_X_sprintf"] = lle_X_sprintf;
702 FuncNames["lle_X_sscanf"] = lle_X_sscanf;
703 FuncNames["lle_X_scanf"] = lle_X_scanf;
704 FuncNames["lle_i_clock"] = lle_i_clock;
706 FuncNames["lle_X_strcmp"] = lle_X_strcmp;
707 FuncNames["lle_X_strcat"] = lle_X_strcat;
708 FuncNames["lle_X_strcpy"] = lle_X_strcpy;
709 FuncNames["lle_X_strlen"] = lle_X_strlen;
710 FuncNames["lle_X___strdup"] = lle_X___strdup;
711 FuncNames["lle_X_memset"] = lle_X_memset;
712 FuncNames["lle_X_memcpy"] = lle_X_memcpy;
714 FuncNames["lle_X_fopen"] = lle_X_fopen;
715 FuncNames["lle_X_fclose"] = lle_X_fclose;
716 FuncNames["lle_X_feof"] = lle_X_feof;
717 FuncNames["lle_X_fread"] = lle_X_fread;
718 FuncNames["lle_X_fwrite"] = lle_X_fwrite;
719 FuncNames["lle_X_fgets"] = lle_X_fgets;
720 FuncNames["lle_X_fflush"] = lle_X_fflush;
721 FuncNames["lle_X_fgetc"] = lle_X_getc;
722 FuncNames["lle_X_getc"] = lle_X_getc;
723 FuncNames["lle_X__IO_getc"] = lle_X__IO_getc;
724 FuncNames["lle_X_fputc"] = lle_X_fputc;
725 FuncNames["lle_X_ungetc"] = lle_X_ungetc;
726 FuncNames["lle_X_fprintf"] = lle_X_fprintf;
727 FuncNames["lle_X_freopen"] = lle_X_freopen;