Rewrite expression code.
[pspp-builds.git] / src / tab.c
index 8afb8f0be0e3793d85675de5dc6fd5d87867e6b2..e3c069ac3260b9e2976ab3cb96aa27023ce07611 100644 (file)
--- a/src/tab.c
+++ b/src/tab.c
@@ -156,7 +156,7 @@ tab_realloc (struct tab_table *t, int nc, int nr)
       int mr1 = min (nr, t->nr);
       int mc1 = min (nc, t->nc);
       
-      struct len_string *new_cc;
+      struct fixed_string *new_cc;
       unsigned char *new_ct;
       int r;
 
@@ -210,6 +210,12 @@ void
 tab_headers (struct tab_table *table, int l, int r, int t, int b)
 {
   assert (table != NULL);
+  assert (l < table->nc);
+  assert (r < table->nc);
+  assert (t < table->nr);
+  assert (b < table->nr);
+
+
   table->l = l;
   table->r = r;
   table->t = t;
@@ -404,7 +410,7 @@ tab_box (struct tab_table *t, int f_h, int f_v, int i_h, int i_v,
    the resultant string into S in TABLE's pool. */
 static void
 text_format (struct tab_table *table, int opt, const char *text, va_list args,
-            struct len_string *s)
+            struct fixed_string *s)
 {
   int len;
   
@@ -720,7 +726,7 @@ tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
   opt |= TAB_JOIN;
   
   {
-    struct len_string *cc = &table->cc[x1 + y1 * table->cf];
+    struct fixed_string *cc = &table->cc[x1 + y1 * table->cf];
     unsigned char *ct = &table->ct[x1 + y1 * table->cf];
     const int ofs = table->cf - (x2 - x1);
 
@@ -745,7 +751,7 @@ tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
 /* Sets cell (C,R) in TABLE, with options OPT, to contents STRING. */
 void
 tab_raw (struct tab_table *table, int c, int r, unsigned opt,
-        struct len_string *string)
+        struct fixed_string *string)
 {
   assert (table != NULL && string != NULL);
   
@@ -862,11 +868,12 @@ tab_flags (struct tab_table *t, unsigned flags)
 void
 tab_submit (struct tab_table *t)
 {
-  struct som_table s;
+  struct som_entity s;
 
   assert (t != NULL);
   s.class = &tab_table_class;
   s.ext = t;
+  s.type = SOM_TABLE;
   som_submit (&s);
   tab_destroy (t);
 }
@@ -921,9 +928,11 @@ int tab_hit;
 
 /* Set the current table to TABLE. */
 static void
-tabi_table (struct som_table *table)
+tabi_table (struct som_entity *table)
 {
   assert (table != NULL);
+  assert (table->type == SOM_TABLE);
+
   t = table->ext;
   tab_offset (t, 0, 0);