diff --git a/src/register/Makefile b/src/register/Makefile index 471f367ea2..43c395754f 100644 --- a/src/register/Makefile +++ b/src/register/Makefile @@ -6,7 +6,7 @@ INCLPATH = -I/usr/include \ -I./../include \ -I./../lib/ComboBox-1.33 \ -I./../lib/XmHTML-1.1.0/src \ - -I./../lib/Xbae-4.6.2-linas + -I./../../lib/Xbae-4.6.2-linas # libhtmlw eliminated due to license restrictions # and general brokenness @@ -24,7 +24,7 @@ LIBXMHTML= ../lib/XmHTML-1.1.0/src/libXmHTML.a LIBXBAE = ../lib/Xbae-4.6.2-linas/libXbae.a LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a ###################################################################### -SRCS = cell.c price.c single.c +SRCS = cell.c price.c single.c table.c OBJS = ${SRCS:.c=.o} ###################################################################### diff --git a/src/register/table.c b/src/register/table.c new file mode 100644 index 0000000000..5d4e47da41 --- /dev/null +++ b/src/register/table.c @@ -0,0 +1,66 @@ + +#include + +#include + +#include "table.h" + +Table * +xaccMallocTable (int numentries) +{ + Table *table; + table = (Table *) malloc (sizeof (Table)); + table->header = NULL; + table->cursor = NULL; + table->entries = NULL; + xaccInitTable (table, numentries); + return table; +} + +/* ==================================================== */ + +void +xaccInitTable (Table * table, int numentries) +{ + int num_phys_rows; + int num_phys_cols; + int i,j; + + /* delete old entries */ + if (table->entries) { + } + + table->numEntries = numentries; + + /* compute number of physical rows */ + num_phys_rows = 0; + if (table->header) { + num_phys_rows += table->header->numRows; + } + if (table->cursor) { + num_phys_rows += numentries* table->cursor->numRows; + num_phys_cols = table->cursor->numCols; + } + table->num_phys_rows = num_phys_rows; + table->num_phys_cols = num_phys_cols; + + /* create an empty table */ + table->entries = (char ***) malloc (num_phys_rows * sizeof (char **)); + for (i=0; ientries[i] = (char **) malloc (num_phys_cols * sizeof (char *)); + for (j=0; jentries[i][j] = strdup (""); + } + } +} + +/* ==================================================== */ + +void +xaccRefreshTable (Table * table) +{ + + XtVaSetValues (table->reg, XmNcells, table->entries, NULL); +} + +/* ================== end of file ======================= */ diff --git a/src/register/table.h b/src/register/table.h index d6ae201fc7..09a880cfe5 100644 --- a/src/register/table.h +++ b/src/register/table.h @@ -25,7 +25,7 @@ typedef struct _Table { /* private data, cahces, etc. */ int num_phys_rows; int num_phys_cols; -} CellArray; +} Table; Table * xaccMallocTable (int numentries); @@ -38,63 +38,4 @@ void xaccRefreshTable (Table *); void xaccSetCursor (Table *, CellArray *); #endif __XACC_TABLE_H__ - -Table * -xaccMallocTable (int numentries) -{ - Table *table; - table = (Table *) malloc (sizeof (Table)); - table->header = NULL; - table->cursor = NULL; - table->entries = NULL; - xaccInitTable (table, numentries); - return table; -} - -/* ==================================================== */ - -void -xaccInitTable (Table * table, int numentries) -{ - int num_phys_rows; - int num_phys_cols; - int i,j; - - /* delete old entries */ - if (table->entries) { - } - - table->numEntries = numentries; - - /* compute number of physical rows */ - num_phys_rows = 0; - if (header) { - num_phys_rows += header->numRows; - } - if (cursor) { - num_phys_rows += numentries* cursor->numRows; - num_phys_cols = cursor->numCols; - } - table->num_phys_rows = num_phys_rows; - table->num_phys_cols = num_phys_cols; - - /* create an empty table */ - table->entries = (char ***) malloc (num_phys_rows * sizeof (char **)); - for (i=0; ientries[i] = (char **) malloc (num_phys_cols * sizeof (char *)); - for (j=0; jentries[i][j] = strdup (""); - } - } -} - -/* ==================================================== */ - -void -xaccRefreshTable (Table * table) -{ - - XtVaSetValues (table->reg, XmNcells, table->entires, NULL); -} - /* ================== end of file ======================= */