Lines Matching refs:f

73   FILE **f = tofilep(L);  in tofile()  local
74 if (*f == NULL) in tofile()
76 return *f; in tofile()
143 FILE *f = *tofilep(L); in io_gc() local
145 if (f != NULL) in io_gc()
152 FILE *f = *tofilep(L); in io_tostring() local
153 if (f == NULL) in io_tostring()
156 lua_pushfstring(L, "file (%p)", f); in io_tostring()
191 FILE *f; in getiofile() local
193 f = *(FILE **)lua_touserdata(L, -1); in getiofile()
194 if (f == NULL) in getiofile()
196 return f; in getiofile()
200 static int g_iofile (lua_State *L, int f, const char *mode) { in g_iofile() argument
213 lua_rawseti(L, LUA_ENVIRONINDEX, f); in g_iofile()
216 lua_rawgeti(L, LUA_ENVIRONINDEX, f); in g_iofile()
273 static int read_number (lua_State *L, FILE *f) { in read_number() argument
275 if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { in read_number()
286 static int test_eof (lua_State *L, FILE *f) { in test_eof() argument
287 int c = getc(f); in test_eof()
288 ungetc(c, f); in test_eof()
294 static int read_line (lua_State *L, FILE *f) { in read_line() argument
300 if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ in read_line()
316 static int read_chars (lua_State *L, FILE *f, size_t n) { in read_chars() argument
325 nr = fread(p, sizeof(char), rlen, f); in read_chars()
334 static int g_read (lua_State *L, FILE *f, int first) { in g_read() argument
338 clearerr(f); in g_read()
340 success = read_line(L, f); in g_read()
349 success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); in g_read()
356 success = read_number(L, f); in g_read()
359 success = read_line(L, f); in g_read()
362 read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ in g_read()
371 if (ferror(f)) in g_read()
392 FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); in io_readline() local
394 if (f == NULL) /* file is already closed? */ in io_readline()
396 sucess = read_line(L, f); in io_readline()
397 if (ferror(f)) in io_readline()
413 static int g_write (lua_State *L, FILE *f, int arg) { in g_write() argument
420 fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; in g_write()
425 status = status && (fwrite(s, sizeof(char), l, f) == l); in g_write()
445 FILE *f = tofile(L); in f_seek() local
448 op = fseek(f, offset, mode[op]); in f_seek()
452 lua_pushinteger(L, ftell(f)); in f_seek()
461 FILE *f = tofile(L); in f_setvbuf() local
464 int res = setvbuf(f, NULL, mode[op], sz); in f_setvbuf()
518 static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { in createstdfile() argument
519 *newfile(L) = f; in createstdfile()