ifile.c (7e1b7636c894be9d1130c284089ce1ea0786ecec) ifile.c (b2ea244070ff84eab79e04befb7aa30c982fc84d)
1/*
2 * Copyright (C) 1984-2017 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */

--- 10 unchanged lines hidden (view full) ---

19 * inserted after the current file.
20 */
21
22#include "less.h"
23
24extern IFILE curr_ifile;
25
26struct ifile {
1/*
2 * Copyright (C) 1984-2017 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */

--- 10 unchanged lines hidden (view full) ---

19 * inserted after the current file.
20 */
21
22#include "less.h"
23
24extern IFILE curr_ifile;
25
26struct ifile {
27 struct ifile *h_next; /* Links for command line list */
27 struct ifile *h_next; /* Links for command line list */
28 struct ifile *h_prev;
28 struct ifile *h_prev;
29 char *h_filename; /* Name of the file */
30 void *h_filestate; /* File state (used in ch.c) */
31 int h_index; /* Index within command line list */
32 int h_hold; /* Hold count */
33 char h_opened; /* Has this ifile been opened? */
34 struct scrpos h_scrpos; /* Saved position within the file */
29 char *h_filename; /* Name of the file */
30 void *h_filestate; /* File state (used in ch.c) */
31 int h_index; /* Index within command line list */
32 int h_hold; /* Hold count */
33 char h_opened; /* Has this ifile been opened? */
34 struct scrpos h_scrpos; /* Saved position within the file */
35 void *h_altpipe; /* Alt pipe */
36 char *h_altfilename; /* Alt filename */
35};
36
37/*
38 * Convert an IFILE (external representation)
39 * to a struct file (internal representation), and vice versa.
40 */
41#define int_ifile(h) ((struct ifile *)(h))
42#define ext_ifile(h) ((IFILE)(h))

--- 280 unchanged lines hidden (view full) ---

323 public void
324set_filestate(ifile, filestate)
325 IFILE ifile;
326 void *filestate;
327{
328 int_ifile(ifile)->h_filestate = filestate;
329}
330
37};
38
39/*
40 * Convert an IFILE (external representation)
41 * to a struct file (internal representation), and vice versa.
42 */
43#define int_ifile(h) ((struct ifile *)(h))
44#define ext_ifile(h) ((IFILE)(h))

--- 280 unchanged lines hidden (view full) ---

325 public void
326set_filestate(ifile, filestate)
327 IFILE ifile;
328 void *filestate;
329{
330 int_ifile(ifile)->h_filestate = filestate;
331}
332
333 public void
334set_altpipe(ifile, p)
335 IFILE ifile;
336 void *p;
337{
338 int_ifile(ifile)->h_altpipe = p;
339}
340
341 public void *
342get_altpipe(ifile)
343 IFILE ifile;
344{
345 return (int_ifile(ifile)->h_altpipe);
346}
347
348 public void
349set_altfilename(ifile, altfilename)
350 IFILE ifile;
351 char *altfilename;
352{
353 struct ifile *p = int_ifile(ifile);
354 if (p->h_altfilename != NULL)
355 free(p->h_altfilename);
356 p->h_altfilename = altfilename;
357}
358
359 public char *
360get_altfilename(ifile)
361 IFILE ifile;
362{
363 return (int_ifile(ifile)->h_altfilename);
364}
365
331#if 0
332 public void
333if_dump()
334{
335 struct ifile *p;
336
337 for (p = anchor.h_next; p != &anchor; p = p->h_next)
338 {
339 printf("%x: %d. <%s> pos %d,%x\n",
340 p, p->h_index, p->h_filename,
341 p->h_scrpos.ln, p->h_scrpos.pos);
342 ch_dump(p->h_filestate);
343 }
344}
345#endif
366#if 0
367 public void
368if_dump()
369{
370 struct ifile *p;
371
372 for (p = anchor.h_next; p != &anchor; p = p->h_next)
373 {
374 printf("%x: %d. <%s> pos %d,%x\n",
375 p, p->h_index, p->h_filename,
376 p->h_scrpos.ln, p->h_scrpos.pos);
377 ch_dump(p->h_filestate);
378 }
379}
380#endif