#include <stdinc.h>int get_atable(instr,ncol,colnr,coldat,ndat)stream instr;int ncol; int colnr; real *coldat;int ndat; int get_ftable(instr,ncol,colpos,colfmt,coldat,ndat)stream instr; int ncol; int colpos; string *colfmt;real *coldat; int ndat; int get_line (instr, line)stream instr;char *line; int parse(linenr, line, dat, ndat)int linenr;char *line;double *dat;int ndat; int strinsert(a, b, n)char *a;char *b;int n; int iscomment(line)char *line;
get_atable parses the table in free format. colnr an array of length ncol of the column numbers to read (1 being the first column), If any of the colnr is 0, it is interpreted as referring to the line number in the original input file (including/excluding comment and empty lines), 1 being the first line, and the corresponding entry in coldat is set as such. Columns are separated by whitespace or commas.
get_ftable parses the table in fixed format. colpos is an array with positions in the rows to start reading (1 being the first position), colfmt an array of pointers to the format string used to parse a real number (note real normally requires %lf). If any of the colpos is 0, it is interpreted as referring to the line number in the original input file (including comment lines), 1 being the first line, and the corresponding entry in coldat is set as such.
The get_line(3) gets the next line from a stream instr, stored into line. It returns the length of the string read, 0 if end of file.
parse parses the character string in line into the double array dat, which has at most ndat entries. Parsing means that %n refers to column n in the character string (n must be larger than 0. Also %0 may be referenced, meaning the current line number, to be entered in the argument linenr.
strinsert inserts the string b into a, replacing n characters of a.
iscomment returns 1 if the line appears to be a comment (starts with ’;’, ’#’, ’!’ or a blank/newline)
src/kernel/tab table.c gettab.c
xx-sep-88 V1.0 written PJT 6-aug-92 documented get_Xtable functions PJT 1-sep-95 added iscomment() PJT 12-jul-03 fixed reading large table buffereing PJT
Table of Contents