version 1.1.1.1, 1996/09/21 05:39:42 |
version 1.1.1.2, 2003/04/13 18:21:21 |
|
|
/* |
/* |
* Copyright (c) 1984,1985,1989,1994,1995 Mark Nudelman |
* Copyright (C) 1984-2002 Mark Nudelman |
* All rights reserved. |
|
* |
* |
* Redistribution and use in source and binary forms, with or without |
* You may distribute under the terms of either the GNU General Public |
* modification, are permitted provided that the following conditions |
* License or the Less License, as specified in the README file. |
* are met: |
|
* 1. Redistributions of source code must retain the above copyright |
|
* notice, this list of conditions and the following disclaimer. |
|
* 2. Redistributions in binary form must reproduce the above copyright |
|
* notice in the documentation and/or other materials provided with |
|
* the distribution. |
|
* |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
* For more information about less, or for information on how to |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* contact the author, see the README file. |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
*/ |
|
|
|
|
|
|
char *h_filename; /* Name of the file */ |
char *h_filename; /* Name of the file */ |
void *h_filestate; /* File state (used in ch.c) */ |
void *h_filestate; /* File state (used in ch.c) */ |
int h_index; /* Index within command line list */ |
int h_index; /* Index within command line list */ |
int h_opened; /* Only need one bit */ |
int h_hold; /* Hold count */ |
|
char h_opened; /* Has this ifile been opened? */ |
struct scrpos h_scrpos; /* Saved position within the file */ |
struct scrpos h_scrpos; /* Saved position within the file */ |
}; |
}; |
|
|
|
|
/* |
/* |
* Anchor for linked list. |
* Anchor for linked list. |
*/ |
*/ |
static struct ifile anchor = { &anchor, &anchor, 0 }; |
static struct ifile anchor = { &anchor, &anchor, NULL, NULL, 0, 0, '\0', |
|
{ NULL_POSITION, 0 } }; |
static int ifiles = 0; |
static int ifiles = 0; |
|
|
static void |
static void |
|
|
p->h_index += incr; |
p->h_index += incr; |
} |
} |
|
|
|
/* |
|
* Link an ifile into the ifile list. |
|
*/ |
static void |
static void |
link_ifile(p, prev) |
link_ifile(p, prev) |
struct ifile *p; |
struct ifile *p; |
|
|
ifiles++; |
ifiles++; |
} |
} |
|
|
|
/* |
|
* Unlink an ifile from the ifile list. |
|
*/ |
static void |
static void |
unlink_ifile(p) |
unlink_ifile(p) |
struct ifile *p; |
struct ifile *p; |
|
|
p->h_filename = save(filename); |
p->h_filename = save(filename); |
p->h_scrpos.pos = NULL_POSITION; |
p->h_scrpos.pos = NULL_POSITION; |
p->h_opened = 0; |
p->h_opened = 0; |
|
p->h_hold = 0; |
|
p->h_filestate = NULL; |
link_ifile(p, prev); |
link_ifile(p, prev); |
return (p); |
return (p); |
} |
} |
|
|
* If the ifile we're deleting is the currently open ifile, |
* If the ifile we're deleting is the currently open ifile, |
* move off it. |
* move off it. |
*/ |
*/ |
|
unmark(h); |
if (h == curr_ifile) |
if (h == curr_ifile) |
curr_ifile = getoff_ifile(curr_ifile); |
curr_ifile = getoff_ifile(curr_ifile); |
p = int_ifile(h); |
p = int_ifile(h); |
|
|
IFILE ifile; |
IFILE ifile; |
{ |
{ |
return (int_ifile(ifile)->h_opened); |
return (int_ifile(ifile)->h_opened); |
|
} |
|
|
|
public void |
|
hold_ifile(ifile, incr) |
|
IFILE ifile; |
|
int incr; |
|
{ |
|
int_ifile(ifile)->h_hold += incr; |
|
} |
|
|
|
public int |
|
held_ifile(ifile) |
|
IFILE ifile; |
|
{ |
|
return (int_ifile(ifile)->h_hold); |
} |
} |
|
|
public void * |
public void * |