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::IntegerTyID:
45 switch (cast<IntegerType>(Ty)->getBitWidth()) {
53 case Type::FloatTyID: return 'F';
54 case Type::DoubleTyID: return 'D';
55 case Type::PointerTyID: return 'P';
56 case Type::FunctionTyID:return 'M';
57 case Type::StructTyID: return 'T';
58 case Type::ArrayTyID: return 'A';
59 case Type::OpaqueTyID: return 'O';
64 static ExFunc lookupFunction(const Function *F) {
65 // Function not found, look it up... start by figuring out what the
66 // composite function name should be.
67 std::string ExtName = "lle_";
68 const FunctionType *FT = F->getFunctionType();
69 for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i)
70 ExtName += getTypeID(FT->getContainedType(i));
71 ExtName += "_" + F->getName();
73 ExFunc FnPtr = FuncNames[ExtName];
76 (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName);
78 FnPtr = FuncNames["lle_X_"+F->getName()];
79 if (FnPtr == 0) // Try calling a generic function... if it exists...
80 FnPtr = (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(
81 ("lle_X_"+F->getName()).c_str());
83 Functions.insert(std::make_pair(F, FnPtr)); // Cache for later
87 GenericValue Interpreter::callExternalFunction(Function *F,
88 const std::vector<GenericValue> &ArgVals) {
89 TheInterpreter = this;
91 // Do a lookup to see if the function is in our cache... this should just be a
92 // deferred annotation!
93 std::map<const Function *, ExFunc>::iterator FI = Functions.find(F);
94 ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second;
96 cerr << "Tried to execute an unknown external function: "
97 << F->getType()->getDescription() << " " << F->getName() << "\n";
98 if (F->getName() == "__main")
99 return GenericValue();
103 // TODO: FIXME when types are not const!
104 GenericValue Result = Fn(const_cast<FunctionType*>(F->getFunctionType()),
110 //===----------------------------------------------------------------------===//
111 // Functions "exported" to the running application...
113 extern "C" { // Don't add C++ manglings to llvm mangling :)
115 // void putchar(sbyte)
116 GenericValue lle_VB_putchar(FunctionType *M, const vector<GenericValue> &Args) {
117 cout << Args[0].Int8Val;
118 return GenericValue();
122 GenericValue lle_ii_putchar(FunctionType *M, const vector<GenericValue> &Args) {
123 cout << ((char)Args[0].Int32Val) << std::flush;
127 // void putchar(ubyte)
128 GenericValue lle_Vb_putchar(FunctionType *M, const vector<GenericValue> &Args) {
129 cout << Args[0].Int8Val << std::flush;
133 // void atexit(Function*)
134 GenericValue lle_X_atexit(FunctionType *M, const vector<GenericValue> &Args) {
135 assert(Args.size() == 1);
136 TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0]));
143 GenericValue lle_X_exit(FunctionType *M, const vector<GenericValue> &Args) {
144 TheInterpreter->exitCalled(Args[0]);
145 return GenericValue();
149 GenericValue lle_X_abort(FunctionType *M, const vector<GenericValue> &Args) {
151 return GenericValue();
154 // void *malloc(uint)
155 GenericValue lle_X_malloc(FunctionType *M, const vector<GenericValue> &Args) {
156 assert(Args.size() == 1 && "Malloc expects one argument!");
157 return PTOGV(malloc(Args[0].Int32Val));
160 // void *calloc(uint, uint)
161 GenericValue lle_X_calloc(FunctionType *M, const vector<GenericValue> &Args) {
162 assert(Args.size() == 2 && "calloc expects two arguments!");
163 return PTOGV(calloc(Args[0].Int32Val, Args[1].Int32Val));
167 GenericValue lle_X_free(FunctionType *M, const vector<GenericValue> &Args) {
168 assert(Args.size() == 1);
169 free(GVTOP(Args[0]));
170 return GenericValue();
174 GenericValue lle_X_atoi(FunctionType *M, const vector<GenericValue> &Args) {
175 assert(Args.size() == 1);
177 GV.Int32Val = atoi((char*)GVTOP(Args[0]));
181 // double pow(double, double)
182 GenericValue lle_X_pow(FunctionType *M, const vector<GenericValue> &Args) {
183 assert(Args.size() == 2);
185 GV.DoubleVal = pow(Args[0].DoubleVal, Args[1].DoubleVal);
189 // double exp(double)
190 GenericValue lle_X_exp(FunctionType *M, const vector<GenericValue> &Args) {
191 assert(Args.size() == 1);
193 GV.DoubleVal = exp(Args[0].DoubleVal);
197 // double sqrt(double)
198 GenericValue lle_X_sqrt(FunctionType *M, const vector<GenericValue> &Args) {
199 assert(Args.size() == 1);
201 GV.DoubleVal = sqrt(Args[0].DoubleVal);
205 // double log(double)
206 GenericValue lle_X_log(FunctionType *M, const vector<GenericValue> &Args) {
207 assert(Args.size() == 1);
209 GV.DoubleVal = log(Args[0].DoubleVal);
213 // double floor(double)
214 GenericValue lle_X_floor(FunctionType *M, const vector<GenericValue> &Args) {
215 assert(Args.size() == 1);
217 GV.DoubleVal = floor(Args[0].DoubleVal);
224 GenericValue lle_X_drand48(FunctionType *M, const vector<GenericValue> &Args) {
225 assert(Args.size() == 0);
227 GV.DoubleVal = drand48();
232 GenericValue lle_X_lrand48(FunctionType *M, const vector<GenericValue> &Args) {
233 assert(Args.size() == 0);
235 GV.Int32Val = lrand48();
239 // void srand48(long)
240 GenericValue lle_X_srand48(FunctionType *M, const vector<GenericValue> &Args) {
241 assert(Args.size() == 1);
242 srand48(Args[0].Int32Val);
243 return GenericValue();
249 GenericValue lle_X_rand(FunctionType *M, const vector<GenericValue> &Args) {
250 assert(Args.size() == 0);
252 GV.Int32Val = rand();
257 GenericValue lle_X_srand(FunctionType *M, const vector<GenericValue> &Args) {
258 assert(Args.size() == 1);
259 srand(Args[0].Int32Val);
260 return GenericValue();
263 // int puts(const char*)
264 GenericValue lle_X_puts(FunctionType *M, const vector<GenericValue> &Args) {
265 assert(Args.size() == 1);
267 GV.Int32Val = puts((char*)GVTOP(Args[0]));
271 // int sprintf(sbyte *, sbyte *, ...) - a very rough implementation to make
273 GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
274 char *OutputBuffer = (char *)GVTOP(Args[0]);
275 const char *FmtStr = (const char *)GVTOP(Args[1]);
278 // printf should return # chars printed. This is completely incorrect, but
279 // close enough for now.
280 GenericValue GV; GV.Int32Val = strlen(FmtStr);
283 case 0: return GV; // Null terminator...
284 default: // Normal nonspecial character
285 sprintf(OutputBuffer++, "%c", *FmtStr++);
287 case '\\': { // Handle escape codes
288 sprintf(OutputBuffer, "%c%c", *FmtStr, *(FmtStr+1));
289 FmtStr += 2; OutputBuffer += 2;
292 case '%': { // Handle format specifiers
293 char FmtBuf[100] = "", Buffer[1000] = "";
296 char Last = *FB++ = *FmtStr++;
297 unsigned HowLong = 0;
298 while (Last != 'c' && Last != 'd' && Last != 'i' && Last != 'u' &&
299 Last != 'o' && Last != 'x' && Last != 'X' && Last != 'e' &&
300 Last != 'E' && Last != 'g' && Last != 'G' && Last != 'f' &&
301 Last != 'p' && Last != 's' && Last != '%') {
302 if (Last == 'l' || Last == 'L') HowLong++; // Keep track of l's
303 Last = *FB++ = *FmtStr++;
309 sprintf(Buffer, FmtBuf); break;
311 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
317 TheInterpreter->getTargetData()->getPointerSizeInBits() == 64 &&
318 sizeof(long) < sizeof(int64_t)) {
319 // Make sure we use %lld with a 64 bit argument because we might be
320 // compiling LLI on a 32 bit compiler.
321 unsigned Size = strlen(FmtBuf);
322 FmtBuf[Size] = FmtBuf[Size-1];
324 FmtBuf[Size-1] = 'l';
326 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int64Val);
328 sprintf(Buffer, FmtBuf, Args[ArgNo++].Int32Val); break;
329 case 'e': case 'E': case 'g': case 'G': case 'f':
330 sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
332 sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
334 sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
335 default: cerr << "<unknown printf code '" << *FmtStr << "'!>";
338 strcpy(OutputBuffer, Buffer);
339 OutputBuffer += strlen(Buffer);
346 // int printf(sbyte *, ...) - a very rough implementation to make output useful.
347 GenericValue lle_X_printf(FunctionType *M, const vector<GenericValue> &Args) {
349 vector<GenericValue> NewArgs;
350 NewArgs.push_back(PTOGV(Buffer));
351 NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
352 GenericValue GV = lle_X_sprintf(M, NewArgs);
357 static void ByteswapSCANFResults(const char *Fmt, void *Arg0, void *Arg1,
358 void *Arg2, void *Arg3, void *Arg4, void *Arg5,
359 void *Arg6, void *Arg7, void *Arg8) {
360 void *Args[] = { Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, 0 };
362 // Loop over the format string, munging read values as appropriate (performs
363 // byteswaps as necessary).
367 // Read any flag characters that may be present...
368 bool Suppress = false;
371 bool LongLong = false; // long long or long double
375 case '*': Suppress = true; break;
376 case 'a': /*Allocate = true;*/ break; // We don't need to track this
377 case 'h': Half = true; break;
378 case 'l': Long = true; break;
380 case 'L': LongLong = true; break;
382 if (Fmt[-1] > '9' || Fmt[-1] < '0') // Ignore field width specs
388 // Read the conversion character
389 if (!Suppress && Fmt[-1] != '%') { // Nothing to do?
394 case 'i': case 'o': case 'u': case 'x': case 'X': case 'n': case 'p':
396 if (Long || LongLong) {
397 Size = 8; Ty = Type::Int64Ty;
399 Size = 4; Ty = Type::Int16Ty;
401 Size = 4; Ty = Type::Int32Ty;
405 case 'e': case 'g': case 'E':
407 if (Long || LongLong) {
408 Size = 8; Ty = Type::DoubleTy;
410 Size = 4; Ty = Type::FloatTy;
414 case 's': case 'c': case '[': // No byteswap needed
424 void *Arg = Args[ArgNo++];
425 memcpy(&GV, Arg, Size);
426 TheInterpreter->StoreValueToMemory(GV, (GenericValue*)Arg, Ty);
433 // int sscanf(const char *format, ...);
434 GenericValue lle_X_sscanf(FunctionType *M, const vector<GenericValue> &args) {
435 assert(args.size() < 10 && "Only handle up to 10 args to sscanf right now!");
438 for (unsigned i = 0; i < args.size(); ++i)
439 Args[i] = (char*)GVTOP(args[i]);
442 GV.Int32Val = sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
443 Args[5], Args[6], Args[7], Args[8], Args[9]);
444 ByteswapSCANFResults(Args[1], Args[2], Args[3], Args[4],
445 Args[5], Args[6], Args[7], Args[8], Args[9], 0);
449 // int scanf(const char *format, ...);
450 GenericValue lle_X_scanf(FunctionType *M, const vector<GenericValue> &args) {
451 assert(args.size() < 10 && "Only handle up to 10 args to scanf right now!");
454 for (unsigned i = 0; i < args.size(); ++i)
455 Args[i] = (char*)GVTOP(args[i]);
458 GV.Int32Val = scanf( Args[0], Args[1], Args[2], Args[3], Args[4],
459 Args[5], Args[6], Args[7], Args[8], Args[9]);
460 ByteswapSCANFResults(Args[0], Args[1], Args[2], Args[3], Args[4],
461 Args[5], Args[6], Args[7], Args[8], Args[9]);
466 // int clock(void) - Profiling implementation
467 GenericValue lle_i_clock(FunctionType *M, const vector<GenericValue> &Args) {
468 extern unsigned int clock(void);
469 GenericValue GV; GV.Int32Val = clock();
474 //===----------------------------------------------------------------------===//
475 // String Functions...
476 //===----------------------------------------------------------------------===//
478 // int strcmp(const char *S1, const char *S2);
479 GenericValue lle_X_strcmp(FunctionType *M, const vector<GenericValue> &Args) {
480 assert(Args.size() == 2);
482 Ret.Int32Val = strcmp((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]));
486 // char *strcat(char *Dest, const char *src);
487 GenericValue lle_X_strcat(FunctionType *M, const vector<GenericValue> &Args) {
488 assert(Args.size() == 2);
489 return PTOGV(strcat((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
492 // char *strcpy(char *Dest, const char *src);
493 GenericValue lle_X_strcpy(FunctionType *M, const vector<GenericValue> &Args) {
494 assert(Args.size() == 2);
495 return PTOGV(strcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
498 static GenericValue size_t_to_GV (size_t n) {
500 if (sizeof (size_t) == sizeof (uint64_t)) {
503 assert (sizeof (size_t) == sizeof (unsigned int));
509 static size_t GV_to_size_t (GenericValue GV) {
511 if (sizeof (size_t) == sizeof (uint64_t)) {
512 count = (size_t)GV.Int64Val;
514 assert (sizeof (size_t) == sizeof (unsigned int));
515 count = (size_t)GV.Int32Val;
520 // size_t strlen(const char *src);
521 GenericValue lle_X_strlen(FunctionType *M, const vector<GenericValue> &Args) {
522 assert(Args.size() == 1);
523 size_t strlenResult = strlen ((char *) GVTOP (Args[0]));
524 return size_t_to_GV (strlenResult);
527 // char *strdup(const char *src);
528 GenericValue lle_X_strdup(FunctionType *M, const vector<GenericValue> &Args) {
529 assert(Args.size() == 1);
530 return PTOGV(strdup((char*)GVTOP(Args[0])));
533 // char *__strdup(const char *src);
534 GenericValue lle_X___strdup(FunctionType *M, const vector<GenericValue> &Args) {
535 assert(Args.size() == 1);
536 return PTOGV(strdup((char*)GVTOP(Args[0])));
539 // void *memset(void *S, int C, size_t N)
540 GenericValue lle_X_memset(FunctionType *M, const vector<GenericValue> &Args) {
541 assert(Args.size() == 3);
542 size_t count = GV_to_size_t (Args[2]);
543 return PTOGV(memset(GVTOP(Args[0]), Args[1].Int32Val, count));
546 // void *memcpy(void *Dest, void *src, size_t Size);
547 GenericValue lle_X_memcpy(FunctionType *M, const vector<GenericValue> &Args) {
548 assert(Args.size() == 3);
549 size_t count = GV_to_size_t (Args[2]);
550 return PTOGV(memcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]), count));
553 //===----------------------------------------------------------------------===//
555 //===----------------------------------------------------------------------===//
557 // getFILE - Turn a pointer in the host address space into a legit pointer in
558 // the interpreter address space. This is an identity transformation.
559 #define getFILE(ptr) ((FILE*)ptr)
561 // FILE *fopen(const char *filename, const char *mode);
562 GenericValue lle_X_fopen(FunctionType *M, const vector<GenericValue> &Args) {
563 assert(Args.size() == 2);
564 return PTOGV(fopen((const char *)GVTOP(Args[0]),
565 (const char *)GVTOP(Args[1])));
568 // int fclose(FILE *F);
569 GenericValue lle_X_fclose(FunctionType *M, const vector<GenericValue> &Args) {
570 assert(Args.size() == 1);
572 GV.Int32Val = fclose(getFILE(GVTOP(Args[0])));
576 // int feof(FILE *stream);
577 GenericValue lle_X_feof(FunctionType *M, const vector<GenericValue> &Args) {
578 assert(Args.size() == 1);
581 GV.Int32Val = feof(getFILE(GVTOP(Args[0])));
585 // size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
586 GenericValue lle_X_fread(FunctionType *M, const vector<GenericValue> &Args) {
587 assert(Args.size() == 4);
590 result = fread((void*)GVTOP(Args[0]), GV_to_size_t (Args[1]),
591 GV_to_size_t (Args[2]), getFILE(GVTOP(Args[3])));
592 return size_t_to_GV (result);
595 // size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
596 GenericValue lle_X_fwrite(FunctionType *M, const vector<GenericValue> &Args) {
597 assert(Args.size() == 4);
600 result = fwrite((void*)GVTOP(Args[0]), GV_to_size_t (Args[1]),
601 GV_to_size_t (Args[2]), getFILE(GVTOP(Args[3])));
602 return size_t_to_GV (result);
605 // char *fgets(char *s, int n, FILE *stream);
606 GenericValue lle_X_fgets(FunctionType *M, const vector<GenericValue> &Args) {
607 assert(Args.size() == 3);
608 return GVTOP(fgets((char*)GVTOP(Args[0]), Args[1].Int32Val,
609 getFILE(GVTOP(Args[2]))));
612 // FILE *freopen(const char *path, const char *mode, FILE *stream);
613 GenericValue lle_X_freopen(FunctionType *M, const vector<GenericValue> &Args) {
614 assert(Args.size() == 3);
615 return PTOGV(freopen((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]),
616 getFILE(GVTOP(Args[2]))));
619 // int fflush(FILE *stream);
620 GenericValue lle_X_fflush(FunctionType *M, const vector<GenericValue> &Args) {
621 assert(Args.size() == 1);
623 GV.Int32Val = fflush(getFILE(GVTOP(Args[0])));
627 // int getc(FILE *stream);
628 GenericValue lle_X_getc(FunctionType *M, const vector<GenericValue> &Args) {
629 assert(Args.size() == 1);
631 GV.Int32Val = getc(getFILE(GVTOP(Args[0])));
635 // int _IO_getc(FILE *stream);
636 GenericValue lle_X__IO_getc(FunctionType *F, const vector<GenericValue> &Args) {
637 return lle_X_getc(F, Args);
640 // int fputc(int C, FILE *stream);
641 GenericValue lle_X_fputc(FunctionType *M, const vector<GenericValue> &Args) {
642 assert(Args.size() == 2);
644 GV.Int32Val = fputc(Args[0].Int32Val, getFILE(GVTOP(Args[1])));
648 // int ungetc(int C, FILE *stream);
649 GenericValue lle_X_ungetc(FunctionType *M, const vector<GenericValue> &Args) {
650 assert(Args.size() == 2);
652 GV.Int32Val = ungetc(Args[0].Int32Val, getFILE(GVTOP(Args[1])));
656 // int ferror (FILE *stream);
657 GenericValue lle_X_ferror(FunctionType *M, const vector<GenericValue> &Args) {
658 assert(Args.size() == 1);
660 GV.Int32Val = ferror (getFILE(GVTOP(Args[0])));
664 // int fprintf(FILE *,sbyte *, ...) - a very rough implementation to make output
666 GenericValue lle_X_fprintf(FunctionType *M, const vector<GenericValue> &Args) {
667 assert(Args.size() >= 2);
669 vector<GenericValue> NewArgs;
670 NewArgs.push_back(PTOGV(Buffer));
671 NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
672 GenericValue GV = lle_X_sprintf(M, NewArgs);
674 fputs(Buffer, getFILE(GVTOP(Args[0])));
681 void Interpreter::initializeExternalFunctions() {
682 FuncNames["lle_Vb_putchar"] = lle_Vb_putchar;
683 FuncNames["lle_ii_putchar"] = lle_ii_putchar;
684 FuncNames["lle_VB_putchar"] = lle_VB_putchar;
685 FuncNames["lle_X_exit"] = lle_X_exit;
686 FuncNames["lle_X_abort"] = lle_X_abort;
687 FuncNames["lle_X_malloc"] = lle_X_malloc;
688 FuncNames["lle_X_calloc"] = lle_X_calloc;
689 FuncNames["lle_X_free"] = lle_X_free;
690 FuncNames["lle_X_atoi"] = lle_X_atoi;
691 FuncNames["lle_X_pow"] = lle_X_pow;
692 FuncNames["lle_X_exp"] = lle_X_exp;
693 FuncNames["lle_X_log"] = lle_X_log;
694 FuncNames["lle_X_floor"] = lle_X_floor;
695 FuncNames["lle_X_srand"] = lle_X_srand;
696 FuncNames["lle_X_rand"] = lle_X_rand;
698 FuncNames["lle_X_drand48"] = lle_X_drand48;
699 FuncNames["lle_X_srand48"] = lle_X_srand48;
700 FuncNames["lle_X_lrand48"] = lle_X_lrand48;
702 FuncNames["lle_X_sqrt"] = lle_X_sqrt;
703 FuncNames["lle_X_puts"] = lle_X_puts;
704 FuncNames["lle_X_printf"] = lle_X_printf;
705 FuncNames["lle_X_sprintf"] = lle_X_sprintf;
706 FuncNames["lle_X_sscanf"] = lle_X_sscanf;
707 FuncNames["lle_X_scanf"] = lle_X_scanf;
708 FuncNames["lle_i_clock"] = lle_i_clock;
710 FuncNames["lle_X_strcmp"] = lle_X_strcmp;
711 FuncNames["lle_X_strcat"] = lle_X_strcat;
712 FuncNames["lle_X_strcpy"] = lle_X_strcpy;
713 FuncNames["lle_X_strlen"] = lle_X_strlen;
714 FuncNames["lle_X___strdup"] = lle_X___strdup;
715 FuncNames["lle_X_memset"] = lle_X_memset;
716 FuncNames["lle_X_memcpy"] = lle_X_memcpy;
718 FuncNames["lle_X_fopen"] = lle_X_fopen;
719 FuncNames["lle_X_fclose"] = lle_X_fclose;
720 FuncNames["lle_X_feof"] = lle_X_feof;
721 FuncNames["lle_X_fread"] = lle_X_fread;
722 FuncNames["lle_X_fwrite"] = lle_X_fwrite;
723 FuncNames["lle_X_fgets"] = lle_X_fgets;
724 FuncNames["lle_X_fflush"] = lle_X_fflush;
725 FuncNames["lle_X_fgetc"] = lle_X_getc;
726 FuncNames["lle_X_getc"] = lle_X_getc;
727 FuncNames["lle_X__IO_getc"] = lle_X__IO_getc;
728 FuncNames["lle_X_fputc"] = lle_X_fputc;
729 FuncNames["lle_X_ungetc"] = lle_X_ungetc;
730 FuncNames["lle_X_fprintf"] = lle_X_fprintf;
731 FuncNames["lle_X_freopen"] = lle_X_freopen;