Lines Matching refs:lf
717 LoadF *lf = (LoadF *)ud; in getF() local
719 if (lf->n > 0) { /* are there pre-read characters to be read? */ in getF()
720 *size = lf->n; /* return them (chars already in buffer) */ in getF()
721 lf->n = 0; /* no more pre-read characters */ in getF()
727 if (feof(lf->f)) return NULL; in getF()
728 *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ in getF()
730 return lf->buff; in getF()
780 LoadF lf; in luaL_loadfilex() local
786 lf.f = stdin; in luaL_loadfilex()
790 lf.f = fopen(filename, "r"); in luaL_loadfilex()
791 if (lf.f == NULL) return errfile(L, "open", fnameindex); in luaL_loadfilex()
793 lf.n = 0; in luaL_loadfilex()
794 if (skipcomment(lf.f, &c)) /* read initial portion */ in luaL_loadfilex()
795 lf.buff[lf.n++] = '\n'; /* add newline to correct line numbers */ in luaL_loadfilex()
797 lf.n = 0; /* remove possible newline */ in luaL_loadfilex()
799 lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ in luaL_loadfilex()
800 if (lf.f == NULL) return errfile(L, "reopen", fnameindex); in luaL_loadfilex()
801 skipcomment(lf.f, &c); /* re-read initial portion */ in luaL_loadfilex()
805 lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ in luaL_loadfilex()
806 status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); in luaL_loadfilex()
807 readstatus = ferror(lf.f); in luaL_loadfilex()
808 if (filename) fclose(lf.f); /* close file (even in case of errors) */ in luaL_loadfilex()