/[global]/global/libutil/linetable.c
ViewVC logotype

Diff of /global/libutil/linetable.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by h-iwamoto, Wed Oct 6 14:41:09 2004 UTC revision 1.6 by shigio, Tue Oct 19 14:46:50 2004 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2002 Tama Communications Corporation   * Copyright (c) 2002, 2004 Tama Communications Corporation
3   *   *
4   * This file is part of GNU GLOBAL.   * This file is part of GNU GLOBAL.
5   *   *
# Line 145  linetable_put(offset, lineno) Line 145  linetable_put(offset, lineno)
145   * linetable_get: get a line from table.   * linetable_get: get a line from table.
146   *   *
147   *      i)      lineno  line number of the line   *      i)      lineno  line number of the line
148     *      o)      offset  offset of the line
149     *                      if offset == NULL, nothing returned.
150   *      r)              line pointer   *      r)              line pointer
151   */   */
152  char *  char *
153  linetable_get(lineno)  linetable_get(lineno, offset)
154          int lineno;          int lineno;
155            int *offset;
156  {  {
157            int addr;
158    
159          if (lineno-- <= 0)          if (lineno-- <= 0)
160                  return NULL;                  return NULL;
161          if (lineno > active_lines)          if (lineno > active_lines)
162                  return NULL;                  return NULL;
163          return filebuf + linetable[lineno];          addr = linetable[lineno];
164            if (offset)
165                    *offset = addr;
166            return filebuf + addr;
167  }  }
168  /*  /*
169   * linetable_close: close line table.   * linetable_close: close line table.
# Line 180  linetable_print(op, lineno) Line 188  linetable_print(op, lineno)
188          FILE *op;          FILE *op;
189          int lineno;          int lineno;
190  {  {
191          char *s = linetable_get(lineno);          char *s = linetable_get(lineno, NULL);
192          if (s == NULL)          if (s == NULL)
193                  return;                  return;
194          while (*s != '\n')          while (*s != '\n')

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26