diff --git a/log/include/log_action.h b/log/include/log_action.h
index 7d05b299b6cd650c783f2e361538ed5c69e0c10f..d497c141cd588020bf0ebfca5d3d5ca56579aea9 100644
--- a/log/include/log_action.h
+++ b/log/include/log_action.h
@@ -211,22 +211,17 @@ typedef struct log_action_t
 	unsigned char *actproc;
 
 	int pagechanged[log_maxpages];
-	log_grec *gbase[log_maxpages];
-	log_srec *sbase[log_maxpages];
-	log_hwrec *hwbase[log_maxpages];
-	log_vwrec *vwbase[log_maxpages];
-	log_lrec *lbase[log_maxpages];
-	log_brec *bbase[log_maxpages];
+	log_page *pages[log_maxpages]; /* TODO use a variable size array or a list */
+	size_t numpages; /**< number of pages */
 	log_nrec *nbase;
+	long curpage;  /**< current page number */
+	long showpage; /**< currenctly displayed page number */
+
 
 	log_sigrec *signaltab;
 	short maxsignal;
 	short lastsignal;
 
-	long numpages; /**< number of pages */
-	long curpage;  /**< current page number */
-	long showpage; /**< currenctly displayed page number */
-
 	short scale;
 	short hscale;
 	long xoff;	   /**< screen_x = grid_x * scale - xoff */
diff --git a/log/include/page.h b/log/include/page.h
index 494d29be5cc3168e37f6304d2b9e2e11a277e56e..aef6a42b67b6231f4a330e65ce452a87fec9a49e 100644
--- a/log/include/page.h
+++ b/log/include/page.h
@@ -1,6 +1,11 @@
 #ifndef PAGE_H
 #define PAGE_H
 
+#include "logdef.h"
+#include "gate.h"
+#include "wire.h"
+#include "label.h"
+
 typedef struct log_regrec {
   short pagenum;
   short x1, y1, x2, y2;
@@ -9,6 +14,17 @@ typedef struct log_regrec {
   struct log_regrec *next;
 } log_regrec;   /* Sensitive region */
 
+typedef struct log_page {
+	log_grec *gbase; /* base gate of the page */
+	log_srec *sbase; /* base solderpoint of the page */
+	log_hwrec *hwbase; /* base horizontal wire of the page */
+	log_vwrec *vwbase; /* base vertical wire of the page */
+	log_lrec *lbase; /* base label of page */
+	log_brec *bbase; /* base box of page */
+	log_regrec *pageregions;
+	int pagechanged;
+} log_page;
+
 void chpage(short pg);
 
 void chpageplace(short pg, short x1, short y1, short x2, short y2);
@@ -23,4 +39,12 @@ int anychanged();
 
 void newpage(short pg);
 
+/* new functions */
+
+log_page *page_alloc();
+
+void page_free(log_page **page);
+
+int page_is_empty(log_page *page);
+
 #endif
diff --git a/log/src/ana/globals.c b/log/src/ana/globals.c
index fa03ebcb20bf30817c37d2757d9ddf2aab15c4d4..a769f22d118152595f961936f4c80b2401fa57f8 100644
--- a/log/src/ana/globals.c
+++ b/log/src/ana/globals.c
@@ -199,7 +199,7 @@ int Erase;
     Act.action = ANALOG_ACT_SET;
   FORLIM = AnaLogglobals->numpages;
   for (Pages = 0; Pages < FORLIM; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -247,7 +247,7 @@ long purpose;
   Numpages = AnaLogglobals->numpages;
   Pages = 1;
   while (Pages <= Numpages) {
-    GCount = AnaLogglobals->gbase[Pages - 1];
+    GCount = AnaLogglobals->pages[Pages - 1]->gbase;
     while (GCount != NULL) {
       WITH = GCount;
       if (WITH->kind->simtype->simtype == 32) {
@@ -505,7 +505,7 @@ log_grec *Inst;
   if (Showpage <= 0)
     return AnaResult;
   Found = false;
-  GCount = AnaLogglobals->gbase[Showpage - 1];
+  GCount = AnaLogglobals->pages[Showpage - 1]->gbase;
   while (GCount != NULL && !Found) {
     if (GCount == Inst) {
       Found = true;
@@ -790,7 +790,7 @@ int ResetVal;
   Numpages = AnaLogglobals->numpages;
   Erased = (ResetVal && Value == AnaNotyet);
   for (Pages = 0; Pages < Numpages; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
diff --git a/log/src/ana/iscope.c b/log/src/ana/iscope.c
index 257b44c2163e1a4464bd3fa28d4dcd0be3f126e7..af92625ef2e71d4efcf4d2a0300c08d204b4082c 100644
--- a/log/src/ana/iscope.c
+++ b/log/src/ana/iscope.c
@@ -281,7 +281,7 @@ Analog_32_action *act;
     Free(Newnode);
   }
   Intptr->Ilist = NULL;
-  Gcount = AnaLogglobals->gbase[act->page - 1];
+  Gcount = AnaLogglobals->pages[act->page - 1]->gbase;
   while (Gcount != NULL) {   /*Make new list*/
     WITH = Gcount;
     if (WITH->kind->simtype->simtype == 32 && Gcount != act->inst) {
diff --git a/log/src/ana/main.c b/log/src/ana/main.c
index 317dd4bc56b0f2ae31fe713209f4ea128673d94a..2f6c0094ecb877881c084bf54214f2c64fe8d678 100644
--- a/log/src/ana/main.c
+++ b/log/src/ana/main.c
@@ -1356,7 +1356,7 @@ void Analog_Reset()
   Numpages = AnaLogglobals->numpages;
   Pages = 1;
   while (Pages <= Numpages) {
-    GCount = AnaLogglobals->gbase[Pages - 1];
+    GCount = AnaLogglobals->pages[Pages - 1]->gbase;
     while (GCount != NULL) {
       WITH = GCount;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1395,7 +1395,7 @@ void Analog_Refresh()
   Showpage = AnaLogglobals->showpage;
   if (Showpage <= 0)
     return;
-  GCount = AnaLogglobals->gbase[Showpage - 1];
+  GCount = AnaLogglobals->pages[Showpage - 1]->gbase;
   while (GCount != NULL) {
     WITH = GCount;
     if (WITH->kind->simtype->simtype == 32) {
@@ -1493,7 +1493,7 @@ static void Nodelist_refcnt(int *Inuse, int *Ok)
   *Ok = true;
   Numpages = AnaLogglobals->numpages;
   for (Pages = 0; Pages < Numpages; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1545,7 +1545,7 @@ static void Single_Find(int display)
   Numpages = AnaLogglobals->numpages;
   FirstFound = true;
   for (Pages = 0; Pages < Numpages; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1650,7 +1650,7 @@ static void Dimcheck()
   Numpages = AnaLogglobals->numpages;
   FORLIM = Numpages;
   for (Pages = 0; Pages < FORLIM; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1678,7 +1678,7 @@ static void UnDim()
   Numpages = AnaLogglobals->numpages;
   FORLIM = Numpages;
   for (Pages = 0; Pages < FORLIM; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1834,7 +1834,7 @@ static void Analog_Guess()
   Numpages = AnaLogglobals->numpages;
   Pages = 1;
   while (Pages <= Numpages) {
-    Count = AnaLogglobals->gbase[Pages - 1];
+    Count = AnaLogglobals->pages[Pages - 1]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -1850,7 +1850,7 @@ static void Analog_Guess()
   }
   Pages = 1;
   while (Pages <= Numpages) {
-    Count = AnaLogglobals->gbase[Pages - 1];
+    Count = AnaLogglobals->pages[Pages - 1]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
@@ -2220,7 +2220,7 @@ static void Evaluate()
   Timeout = false;
   while (Pages <= Numpages && !Timeout) {
     if (AnaLastgate == NULL)
-      AnaLastgate = AnaLogglobals->gbase[Pages - 1];
+      AnaLastgate = AnaLogglobals->pages[Pages - 1]->gbase;
     Count = AnaLastgate;
     while (Count != NULL && !Timeout) {
       WITH = Count;
@@ -2526,7 +2526,7 @@ static void Memory()
     Timeout = false;
     while (Pages <= Numpages && !Timeout) {
       if (AnaLastgate == NULL)
-	AnaLastgate = AnaLogglobals->gbase[Pages - 1];
+	AnaLastgate = AnaLogglobals->pages[Pages - 1]->gbase;
       Count = AnaLastgate;
       while (Count != NULL && !Timeout) {
 	WITH = Count;
@@ -2580,7 +2580,7 @@ static void Memory()
     Timeout = false;
     while (Pages <= Numpages && !Timeout) {
       if (AnaLastgate == NULL)
-	AnaLastgate = AnaLogglobals->gbase[Pages - 1];
+	AnaLastgate = AnaLogglobals->pages[Pages - 1]->gbase;
       Count = AnaLastgate;
       while (Count != NULL && !Timeout) {
 	WITH = Count;
@@ -2639,7 +2639,7 @@ void Analog_Tstep()
   AnaAccum = AnaLogglobals->time;
   FORLIM = AnaLogglobals->numpages;
   for (Pages = 0; Pages < FORLIM; Pages++) {
-    Count = AnaLogglobals->gbase[Pages];
+    Count = AnaLogglobals->pages[Pages]->gbase;
     while (Count != NULL) {
       WITH = Count;
       if (WITH->kind->simtype->simtype == 32) {
diff --git a/log/src/ana/mmeter.c b/log/src/ana/mmeter.c
index e6e24e0559bb55a1ebc4511a7215be1dd86e6007..3ab97899883befe59e92ad066e60d3844e2d7f14 100644
--- a/log/src/ana/mmeter.c
+++ b/log/src/ana/mmeter.c
@@ -300,7 +300,7 @@ Analog_32_action *act;
     Free(Newnode);
   }
   Intptr->Ilist = NULL;
-  Gcount = AnaLogglobals->gbase[act->page - 1];
+  Gcount = AnaLogglobals->pages[act->page - 1]->gbase;
   while (Gcount != NULL) {   /*Make new list*/
     WITH = Gcount;
     if (WITH->kind->simtype->simtype == 32 && Gcount != act->inst) {
diff --git a/log/src/gate.c b/log/src/gate.c
index b59985f9b89f46673b35eb240d93f913880be162..76c4aabee0737cbb8b879dd650fa309473969962 100644
--- a/log/src/gate.c
+++ b/log/src/gate.c
@@ -121,8 +121,8 @@ void eragate(log_grec *gate)
 
 void linkgate(log_grec **gate)
 {
-	(*gate)->next = gg.gbase[gg.curpage - 1];
-	gg.gbase[gg.curpage - 1] = *gate;
+	(*gate)->next = gg.pages[gg.curpage - 1]->gbase;
+	gg.pages[gg.curpage - 1]->gbase = *gate;
 	chpageplace((int)gg.curpage, (*gate)->x - (*gate)->kind->bbmax,
 			(*gate)->y - (*gate)->kind->bbmax, (*gate)->x + (*gate)->kind->bbmax,
 			(*gate)->y + (*gate)->kind->bbmax);
@@ -240,11 +240,11 @@ void unlkgate(log_grec **gate)
 {
 	log_grec *g1;
 
-	g1 = gg.gbase[gg.curpage - 1];
+	g1 = gg.pages[gg.curpage - 1]->gbase;
 	while (g1 != NULL && g1->next != *gate)
 		g1 = g1->next;
 	if (g1 == NULL)
-		gg.gbase[gg.curpage - 1] = (*gate)->next;
+		gg.pages[gg.curpage - 1]->gbase = (*gate)->next;
 	else
 		g1->next = (*gate)->next;
 	chpageplace((int)gg.curpage, (*gate)->x - (*gate)->kind->bbmax,
@@ -307,7 +307,7 @@ void closergate(short x, short y)
 	if (gg.textinvisible)
 		gg.nearlabel = NULL;
 	else {
-		gg.nearlabel = gg.lbase[gg.curpage - 1];
+		gg.nearlabel = gg.pages[gg.curpage - 1]->lbase;
 		while (gg.nearlabel != NULL &&
 				(x < gg.nearlabel->x ||
 				 x > gg.nearlabel->x + m_strwidth(logfont_lfont,
@@ -322,7 +322,7 @@ void closergate(short x, short y)
 		return;
 	}
 	if (!gg.textinvisible) {
-		gg.nearbox = gg.bbase[gg.curpage - 1];
+		gg.nearbox = gg.pages[gg.curpage - 1]->bbase;
 		while (gg.nearbox != NULL &&
 				((x != gg.nearbox->x1 && x != gg.nearbox->x2 &&
 				  y != gg.nearbox->y1 &&
@@ -336,7 +336,7 @@ void closergate(short x, short y)
 		gg.neargate = NULL;
 		return;
 	}
-	gg.neargate = gg.gbase[gg.curpage - 1];
+	gg.neargate = gg.pages[gg.curpage - 1]->gbase;
 	while (gg.neargate != NULL && !insidegate(gg.neargate, x, y))
 		gg.neargate = gg.neargate->next;
 }
@@ -360,21 +360,21 @@ void chggate(log_grec *gate, int i, log_nrec *oldnode, log_nrec *n)
 			switchnode(&gate->pin[j - 1], n);
 			x = gate->pinpos[j - 1].x;
 			y = gate->pinpos[j - 1].y;
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL)
 			{
 				if (hw->x1 <= x && x <= hw->x2 && hw->y == y && hw->node == oldnode)
 					chghw(hw, oldnode, n);
 				hw = hw->next;
 			}
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL)
 			{
 				if (vw->y1 <= y && y <= vw->y2 && vw->x == x && vw->node == oldnode)
 					chgvw(vw, oldnode, n);
 				vw = vw->next;
 			}
-			g1 = gg.gbase[gg.curpage - 1];
+			g1 = gg.pages[gg.curpage - 1]->gbase;
 			while (g1 != NULL)
 			{
 				if (g1 != gate && P_imax2((long)abs(g1->x - x), (long)abs(g1->y - y)) <=
@@ -402,7 +402,7 @@ void chggate(log_grec *gate, int i, log_nrec *oldnode, log_nrec *n)
 	for (pg = 1; pg <= FORLIM; pg++)
 	{
 		gg.curpage = pg;
-		g1 = gg.gbase[gg.curpage - 1];
+		g1 = gg.pages[gg.curpage - 1]->gbase;
 		while (g1 != NULL)
 		{
 			if (g1->kind->simtype == simtype_common && g1->sig == gate->sig &&
@@ -428,7 +428,7 @@ void chggatepin(log_grec *gate, short i, log_nrec **oldnode, log_nrec **savenode
 				gate, i, *oldnode);
 	x = gate->pinpos[i - 1].x;
 	y = gate->pinpos[i - 1].y;
-	hw = gg.hwbase[gg.curpage - 1];
+	hw = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw != NULL)
 	{
 		if (hw->x1 <= x && x <= hw->x2 && hw->y == y && hw->node == *oldnode)
@@ -439,7 +439,7 @@ void chggatepin(log_grec *gate, short i, log_nrec **oldnode, log_nrec **savenode
 		}
 		hw = hw->next;
 	}
-	vw = gg.vwbase[gg.curpage - 1];
+	vw = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw != NULL)
 	{
 		if (vw->y1 <= y && y <= vw->y2 && vw->x == x && vw->node == *oldnode)
@@ -450,7 +450,7 @@ void chggatepin(log_grec *gate, short i, log_nrec **oldnode, log_nrec **savenode
 		}
 		vw = vw->next;
 	}
-	g1 = gg.gbase[gg.curpage - 1];
+	g1 = gg.pages[gg.curpage - 1]->gbase;
 	while (g1 != NULL)
 	{
 		if (g1 != gate &&
@@ -615,21 +615,21 @@ int connectgate(log_grec *gate)
 		xp = gate->pinpos[i].x;
 		yp = gate->pinpos[i].y;
 		n1 = NULL;
-		hw = gg.hwbase[gg.curpage - 1];
+		hw = gg.pages[gg.curpage - 1]->hwbase;
 		while (hw != NULL && n1 == NULL)
 		{
 			if (hw->x1 <= xp && xp <= hw->x2 && yp == hw->y)
 				n1 = &hw->node;
 			hw = hw->next;
 		}
-		vw = gg.vwbase[gg.curpage - 1];
+		vw = gg.pages[gg.curpage - 1]->vwbase;
 		while (vw != NULL && n1 == NULL)
 		{
 			if (vw->y1 <= yp && yp <= vw->y2 && xp == vw->x)
 				n1 = &vw->node;
 			vw = vw->next;
 		}
-		g1 = gg.gbase[gg.curpage - 1];
+		g1 = gg.pages[gg.curpage - 1]->gbase;
 		while (g1 != NULL && n1 == NULL)
 		{
 			if (g1 != gate && P_imax2((long)abs(g1->x - xp), (long)abs(g1->y - yp)) <=
@@ -708,7 +708,7 @@ void addgate2(short x, short y, short gtype, short sig, log_gattrrec *attrs)
 		do
 		{
 			i++;
-			g1 = gg.gbase[gg.curpage - 1];
+			g1 = gg.pages[gg.curpage - 1]->gbase;
 			flag = false;
 			while (g1 != NULL && !flag)
 			{
@@ -758,7 +758,7 @@ void uaddgate(short x, short y, short gtype)
 	{
 		xx = (x + gg.xoff) / gg.scale;
 		yy = (y + gg.yoff) / gg.scale;
-		g = gg.gbase[gg.curpage - 1];
+		g = gg.pages[gg.curpage - 1]->gbase;
 		while (g != NULL && P_imax2((long)abs(g->x - xx), (long)abs(g->y - yy)) >
 				g->kind->bbmax + k->bbmax)
 			g = g->next;
diff --git a/log/src/label.c b/log/src/label.c
index 3f3644e096a0b189550b259c80bc366d949fc5f2..c64c5d8ce7f764ba3b94ee63db78f1b62bb188b9 100644
--- a/log/src/label.c
+++ b/log/src/label.c
@@ -354,8 +354,8 @@ void xorlabel(short x, short y, log_lrec *l)
 
 void linklabel(log_lrec *l)
 {
-	l->next = gg.lbase[gg.curpage - 1];
-	gg.lbase[gg.curpage - 1] = l;
+	l->next = gg.pages[gg.curpage - 1]->lbase;
+	gg.pages[gg.curpage - 1]->lbase = l;
 	stamp(&gg.labelstamp);
 }
 
@@ -378,11 +378,11 @@ void unlinklabel(log_lrec *l)
 {
 	log_lrec *l1;
 
-	l1 = gg.lbase[gg.curpage - 1];
+	l1 = gg.pages[gg.curpage - 1]->lbase;
 	while (l1 != NULL && l1->next != l)
 		l1 = l1->next;
 	if (l1 == NULL)
-		gg.lbase[gg.curpage - 1] = l->next;
+		gg.pages[gg.curpage - 1]->lbase = l->next;
 	else
 		l1->next = l->next;
 	chpageplace((int)gg.curpage, l->x, l->y, l->x + l->w, l->y + 2);
diff --git a/log/src/log.c b/log/src/log.c
index d491bf56c80dae2b8ef6cdb50aa3ec7787b92d1e..4548fc158ffe33db30e071f95ecc60018ae1c341 100644
--- a/log/src/log.c
+++ b/log/src/log.c
@@ -630,7 +630,7 @@ static void testprobe(short xx, short yy)
 	{
 		if (gg.incircuit)
 		{
-			g = gg.gbase[gg.curpage - 1];
+			g = gg.pages[gg.curpage - 1]->gbase;
 			while (g != NULL && gg.probegate == NULL)
 			{
 				k = g->kind;
@@ -656,7 +656,7 @@ static void testprobe(short xx, short yy)
 				}
 				g = g->next;
 			}
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL && gg.probenode == NULL)
 			{
 				if (hw->x1 <= x && x <= hw->x2 && hw->y == y)
@@ -666,7 +666,7 @@ static void testprobe(short xx, short yy)
 				}
 				hw = hw->next;
 			}
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL && gg.probenode == NULL)
 			{
 				if (vw->y1 <= y && y <= vw->y2 && vw->x == x)
@@ -1869,7 +1869,7 @@ void pass()
 		if (gg.glowmode && gg.showpage > 0 && !gg.invisible && !gg.showconflicts)
 		{
 			flag = false;
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL)
 			{
 				WITH1 = hw;
@@ -1884,7 +1884,7 @@ void pass()
 				}
 				hw = WITH1->next;
 			}
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL)
 			{
 				WITH2 = vw;
@@ -1901,7 +1901,7 @@ void pass()
 			}
 			if (glowsolder)
 			{
-				s = gg.sbase[gg.curpage - 1];
+				s = gg.pages[gg.curpage - 1]->sbase;
 				while (s != NULL)
 				{
 					WITH3 = s;
@@ -2159,8 +2159,8 @@ void copyattrs(log_gattrrec **gattr, log_gattrrec *oldattr, short numattrs, log_
 
 static void linkbox(log_brec *b)
 {
-	b->next = gg.bbase[gg.curpage - 1];
-	gg.bbase[gg.curpage - 1] = b;
+	b->next = gg.pages[gg.curpage - 1]->bbase;
+	gg.pages[gg.curpage - 1]->bbase = b;
 	stamp(&gg.boxstamp);
 }
 
@@ -2181,11 +2181,11 @@ static void unlinkbox(log_brec *b)
 {
 	log_brec *b1;
 
-	b1 = gg.bbase[gg.curpage - 1];
+	b1 = gg.pages[gg.curpage - 1]->bbase;
 	while (b1 != NULL && b1->next != b)
 		b1 = b1->next;
 	if (b1 == NULL)
-		gg.bbase[gg.curpage - 1] = b->next;
+		gg.pages[gg.curpage - 1]->bbase = b->next;
 	else
 		b1->next = b->next;
 	chpageplace((int)gg.curpage, b->x1, b->y1, b->x2, b->y2);
@@ -2306,7 +2306,7 @@ static void purgesignaltab()
 	FORLIM = gg.numpages;
 	for (pg = 0; pg < FORLIM; pg++)
 	{
-		g = gg.gbase[pg];
+		g = gg.pages[pg]->gbase;
 		while (g != NULL)
 		{
 			if (g->sig != 0)
@@ -2397,21 +2397,21 @@ void garbagecoll()
 
 	for (pg = 0; pg < gg.numpages; pg++)
 	{
-		hw = gg.hwbase[pg];
+		hw = gg.pages[pg]->hwbase;
 		while (hw != NULL)
 		{
 			hw->node->ref++;
 			hw = hw->next;
 		}
 
-		vw = gg.vwbase[pg];
+		vw = gg.pages[pg]->vwbase;
 		while (vw != NULL)
 		{
 			vw->node->ref++;
 			vw = vw->next;
 		}
 
-		g = gg.gbase[pg];
+		g = gg.pages[pg]->gbase;
 		while (g != NULL)
 		{
 			FORLIM1 = g->kind->numpins;
@@ -3106,7 +3106,7 @@ static void doimmedfunction()
 		}
 		else if (!strcmp(gg.funcarg, "-"))
 		{
-			if (gg.curpage > 1)
+			if (gg.curpage > 0)
 				newpage((int)(gg.curpage - 1));
 		}
 		else if (strlen(gg.funcarg) == 1 && gg.funcarg[0] >= '1' &&
@@ -3302,7 +3302,7 @@ void confirmsimtype(log_nrec *n)
 	FORLIM = gg.numpages;
 	for (pg = 0; pg < FORLIM; pg++)
 	{
-		g = gg.gbase[pg];
+		g = gg.pages[pg]->gbase;
 		while (g != NULL && !found)
 		{
 			FORLIM1 = g->kind->numpins;
@@ -3386,7 +3386,7 @@ void addblobs(blobrec **blbase, short x1, short y1, short x2, short y2)
 	blobrec *blp;
 	log_srec *s;
 
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL)
 	{
 		if (P_ibetween((long)x1, (long)s->x, (long)x2) &&
@@ -3415,10 +3415,10 @@ void doblobs(blobrec *blp)
 		{
 			x = blp->x;
 			y = blp->y;
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL && (hw->y != y || hw->x1 > x || hw->x2 < x))
 				hw = hw->next;
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL && (vw->x != x || vw->y1 > y || vw->y2 < y))
 				vw = vw->next;
 			if (hw != NULL && vw != NULL && hw->node != vw->node)
@@ -3611,7 +3611,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 	sortshints(&x1, &x2);
 	sortshints(&y1, &y2);
 	bases->pgnum = gg.curpage;
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		g1 = g->next;
@@ -3632,7 +3632,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 		}
 		g = g1;
 	}
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL)
 	{
 		if (tap)
@@ -3652,7 +3652,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 		}
 		s = s->next;
 	}
-	hw = gg.hwbase[gg.curpage - 1];
+	hw = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw != NULL)
 	{
 		hw1 = hw->next;
@@ -3698,7 +3698,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 		}
 		hw = hw1;
 	}
-	vw = gg.vwbase[gg.curpage - 1];
+	vw = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw != NULL)
 	{
 		vw1 = vw->next;
@@ -3744,7 +3744,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 		}
 		vw = vw1;
 	}
-	l = gg.lbase[gg.curpage - 1];
+	l = gg.pages[gg.curpage - 1]->lbase;
 	while (l != NULL)
 	{
 		l1 = l->next;
@@ -3774,7 +3774,7 @@ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int
 		}
 		l = l1;
 	}
-	b = gg.bbase[gg.curpage - 1];
+	b = gg.pages[gg.curpage - 1]->bbase;
 	while (b != NULL)
 	{
 		b1 = b->next;
@@ -3923,7 +3923,7 @@ static int pagembb(short pg, short *x1, short *y1, short *x2, short *y2)
 	*y1 = log_maxshint;
 	*x2 = -log_maxshint;
 	*y2 = -log_maxshint;
-	g = gg.gbase[pg - 1];
+	g = gg.pages[pg - 1]->gbase;
 	while (g != NULL)
 	{
 		max = g->kind->bbmax;
@@ -3937,7 +3937,7 @@ static int pagembb(short pg, short *x1, short *y1, short *x2, short *y2)
 			*y2 = g->y + max;
 		g = g->next;
 	}
-	hw = gg.hwbase[pg - 1];
+	hw = gg.pages[pg - 1]->hwbase;
 	while (hw != NULL)
 	{
 		if (hw->x1 < *x1)
@@ -3950,7 +3950,7 @@ static int pagembb(short pg, short *x1, short *y1, short *x2, short *y2)
 			*y2 = hw->y;
 		hw = hw->next;
 	}
-	vw = gg.vwbase[pg - 1];
+	vw = gg.pages[pg - 1]->vwbase;
 	while (vw != NULL)
 	{
 		if (vw->x < *x1)
@@ -3963,7 +3963,7 @@ static int pagembb(short pg, short *x1, short *y1, short *x2, short *y2)
 			*y2 = vw->y2;
 		vw = vw->next;
 	}
-	l = gg.lbase[pg - 1];
+	l = gg.pages[pg - 1]->lbase;
 	while (l != NULL)
 	{
 		if (l->x < *x1)
@@ -3977,7 +3977,7 @@ static int pagembb(short pg, short *x1, short *y1, short *x2, short *y2)
 			*y2 = l->y + 2;
 		l = l->next;
 	}
-	b = gg.bbase[pg - 1];
+	b = gg.pages[pg - 1]->bbase;
 	while (b != NULL)
 	{
 		if (b->x1 < *x1)
@@ -4329,8 +4329,8 @@ static void pastebuf(baseptrs *bases, short x, short y)
 	while (l != NULL)
 	{
 		l1 = (log_lrec *)Malloc(sizeof(log_lrec));
-		l1->next = gg.lbase[gg.curpage - 1];
-		gg.lbase[gg.curpage - 1] = l1;
+		l1->next = gg.pages[gg.curpage - 1]->lbase;
+		gg.pages[gg.curpage - 1]->lbase = l1;
 		l1->x = l->x + x;
 		l1->y = l->y + y;
 		strcpy(l1->name, l->name);
@@ -4353,8 +4353,8 @@ static void pastebuf(baseptrs *bases, short x, short y)
 	while (b != NULL)
 	{
 		b1 = (log_brec *)Malloc(sizeof(log_brec));
-		b1->next = gg.bbase[gg.curpage - 1];
-		gg.bbase[gg.curpage - 1] = b1;
+		b1->next = gg.pages[gg.curpage - 1]->bbase;
+		gg.pages[gg.curpage - 1]->bbase = b1;
 		b1->x1 = b->x1 + x;
 		b1->y1 = b->y1 + y;
 		b1->x2 = b->x2 + x;
@@ -4947,7 +4947,7 @@ static void moveobject()
 		vc = gg.nearvw->wcolr;
 	}
 	blbase = NULL;
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL)
 	{
 		if ((gg.nearhw != NULL && (s->hwire == gg.nearhw || s->hwire2 == gg.nearhw)) ||
@@ -5082,7 +5082,7 @@ static void moveobject()
 		{
 			if (blp->hw != NULL)
 			{
-				hw1 = gg.hwbase[gg.curpage - 1];
+				hw1 = gg.pages[gg.curpage - 1]->hwbase;
 				while (hw1 != NULL &&
 						(hw1->node != blp->hw->node ||
 						 !P_ibetween((long)hw1->x1, (long)vx, (long)hw1->x2) ||
@@ -5101,7 +5101,7 @@ static void moveobject()
 			}
 			else if (blp->vw != NULL)
 			{
-				vw1 = gg.vwbase[gg.curpage - 1];
+				vw1 = gg.pages[gg.curpage - 1]->vwbase;
 				while (vw1 != NULL &&
 						(vw1->node != blp->vw->node ||
 						 !P_ibetween((long)vw1->y1, (long)hy, (long)vw1->y2) ||
@@ -5235,7 +5235,7 @@ static void openhoriz()
 			if (gg.incircuit && *gg.func == '\0')
 			{
 				chpage((int)gg.curpage);
-				vw = gg.vwbase[gg.curpage - 1];
+				vw = gg.pages[gg.curpage - 1]->vwbase;
 				flag = false;
 				while (vw != NULL)
 				{
@@ -5248,14 +5248,14 @@ static void openhoriz()
 
 				if (!flag)
 				{
-					g = gg.gbase[gg.curpage - 1];
+					g = gg.pages[gg.curpage - 1]->gbase;
 					while (g != NULL)
 					{
 						if (gg.posy <= g->y && g->y <= y1 && g->x >= gg.posx)
 							shiftgate(g, x1 - gg.posx, 0);
 						g = g->next;
 					}
-					s = gg.sbase[gg.curpage - 1];
+					s = gg.pages[gg.curpage - 1]->sbase;
 
 					while (s != NULL)
 					{
@@ -5264,7 +5264,7 @@ static void openhoriz()
 							s->x += x1 - gg.posx;
 						s = s->next;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5277,7 +5277,7 @@ static void openhoriz()
 						}
 						hw = hw->next;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5285,7 +5285,7 @@ static void openhoriz()
 							vw->x += x1 - gg.posx;
 						vw = vw->next;
 					}
-					b = gg.bbase[gg.curpage - 1];
+					b = gg.pages[gg.curpage - 1]->bbase;
 
 					while (b != NULL)
 					{
@@ -5298,7 +5298,7 @@ static void openhoriz()
 						}
 						b = b->next;
 					}
-					l = gg.lbase[gg.curpage - 1];
+					l = gg.pages[gg.curpage - 1]->lbase;
 
 					while (l != NULL)
 					{
@@ -5404,7 +5404,7 @@ static void openvert()
 			if (gg.incircuit && *gg.func == '\0')
 			{
 				chpage((int)gg.curpage);
-				hw = gg.hwbase[gg.curpage - 1];
+				hw = gg.pages[gg.curpage - 1]->hwbase;
 				flag = false;
 
 				while (hw != NULL)
@@ -5418,14 +5418,14 @@ static void openvert()
 
 				if (!flag)
 				{
-					g = gg.gbase[gg.curpage - 1];
+					g = gg.pages[gg.curpage - 1]->gbase;
 					while (g != NULL)
 					{
 						if (gg.posx <= g->x && g->x <= x1 && g->y >= gg.posy)
 							shiftgate(g, 0, y1 - gg.posy);
 						g = g->next;
 					}
-					s = gg.sbase[gg.curpage - 1];
+					s = gg.pages[gg.curpage - 1]->sbase;
 
 					while (s != NULL)
 					{
@@ -5434,7 +5434,7 @@ static void openvert()
 							s->y += y1 - gg.posy;
 						s = s->next;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5447,7 +5447,7 @@ static void openvert()
 						}
 						vw = vw->next;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5456,7 +5456,7 @@ static void openvert()
 						hw = hw->next;
 					}
 
-					b = gg.bbase[gg.curpage - 1];
+					b = gg.pages[gg.curpage - 1]->bbase;
 					while (b != NULL)
 					{
 						if (gg.posx <= b->x1 && b->x2 <= x1)
@@ -5468,7 +5468,7 @@ static void openvert()
 						}
 						b = b->next;
 					}
-					l = gg.lbase[gg.curpage - 1];
+					l = gg.pages[gg.curpage - 1]->lbase;
 					while (l != NULL)
 					{
 						if (gg.posx <= l->x && l->x <= x1 && l->y >= gg.posy)
@@ -5572,7 +5572,7 @@ static void closehoriz()
 			if (gg.incircuit && *gg.func == '\0')
 			{
 				chpage((int)gg.curpage);
-				vw = gg.vwbase[gg.curpage - 1];
+				vw = gg.pages[gg.curpage - 1]->vwbase;
 				flag = false;
 				while (vw != NULL)
 				{
@@ -5585,7 +5585,7 @@ static void closehoriz()
 
 				if (!flag)
 				{
-					g = gg.gbase[gg.curpage - 1];
+					g = gg.pages[gg.curpage - 1]->gbase;
 					while (g != NULL)
 					{
 						g1 = g->next;
@@ -5598,7 +5598,7 @@ static void closehoriz()
 						}
 						g = g1;
 					}
-					s = gg.sbase[gg.curpage - 1];
+					s = gg.pages[gg.curpage - 1]->sbase;
 
 					while (s != NULL)
 					{
@@ -5611,7 +5611,7 @@ static void closehoriz()
 						}
 						s = s1;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5622,7 +5622,7 @@ static void closehoriz()
 						}
 						hw = hw1;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5632,7 +5632,7 @@ static void closehoriz()
 							delvwire(vw);
 						vw = vw1;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5661,7 +5661,7 @@ static void closehoriz()
 						}
 						hw = hw->next;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5669,7 +5669,7 @@ static void closehoriz()
 							vw->x += gg.posx - x1;
 						vw = vw->next;
 					}
-					b = gg.bbase[gg.curpage - 1];
+					b = gg.pages[gg.curpage - 1]->bbase;
 
 					while (b != NULL)
 					{
@@ -5704,7 +5704,7 @@ static void closehoriz()
 						}
 						b = b1;
 					}
-					l = gg.lbase[gg.curpage - 1];
+					l = gg.pages[gg.curpage - 1]->lbase;
 
 					while (l != NULL)
 					{
@@ -5816,7 +5816,7 @@ static void closevert()
 			if (gg.incircuit && *gg.func == '\0')
 			{
 				chpage((int)gg.curpage);
-				hw = gg.hwbase[gg.curpage - 1];
+				hw = gg.pages[gg.curpage - 1]->hwbase;
 				flag = false;
 				while (hw != NULL)
 				{
@@ -5829,7 +5829,7 @@ static void closevert()
 
 				if (!flag)
 				{
-					g = gg.gbase[gg.curpage - 1];
+					g = gg.pages[gg.curpage - 1]->gbase;
 					while (g != NULL)
 					{
 						g1 = g->next;
@@ -5842,7 +5842,7 @@ static void closevert()
 						}
 						g = g1;
 					}
-					s = gg.sbase[gg.curpage - 1];
+					s = gg.pages[gg.curpage - 1]->sbase;
 
 					while (s != NULL)
 					{
@@ -5855,7 +5855,7 @@ static void closevert()
 						}
 						s = s1;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5867,7 +5867,7 @@ static void closevert()
 						}
 						vw = vw1;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5877,7 +5877,7 @@ static void closevert()
 							delhwire(hw);
 						hw = hw1;
 					}
-					vw = gg.vwbase[gg.curpage - 1];
+					vw = gg.pages[gg.curpage - 1]->vwbase;
 
 					while (vw != NULL)
 					{
@@ -5906,7 +5906,7 @@ static void closevert()
 						}
 						vw = vw->next;
 					}
-					hw = gg.hwbase[gg.curpage - 1];
+					hw = gg.pages[gg.curpage - 1]->hwbase;
 
 					while (hw != NULL)
 					{
@@ -5914,7 +5914,7 @@ static void closevert()
 							hw->y += gg.posy - y1;
 						hw = hw->next;
 					}
-					b = gg.bbase[gg.curpage - 1];
+					b = gg.pages[gg.curpage - 1]->bbase;
 
 					while (b != NULL)
 					{
@@ -5949,7 +5949,7 @@ static void closevert()
 						}
 						b = b1;
 					}
-					l = gg.lbase[gg.curpage - 1];
+					l = gg.pages[gg.curpage - 1]->lbase;
 
 					while (l != NULL)
 					{
@@ -6001,13 +6001,13 @@ static void centercommand()
 	{
 		dx = (origin + across / 2) / log_scale0 - (x2 + x1) / 2;
 		dy = (origin + baseline / 2) / log_scale0 - (y2 + y1) / 2;
-		g = gg.gbase[gg.curpage - 1];
+		g = gg.pages[gg.curpage - 1]->gbase;
 		while (g != NULL)
 		{
 			shiftgate(g, dx, dy);
 			g = g->next;
 		}
-		hw = gg.hwbase[gg.curpage - 1];
+		hw = gg.pages[gg.curpage - 1]->hwbase;
 
 		while (hw != NULL)
 		{
@@ -6016,7 +6016,7 @@ static void centercommand()
 			hw->y += dy;
 			hw = hw->next;
 		}
-		vw = gg.vwbase[gg.curpage - 1];
+		vw = gg.pages[gg.curpage - 1]->vwbase;
 
 		while (vw != NULL)
 		{
@@ -6025,7 +6025,7 @@ static void centercommand()
 			vw->y2 += dy;
 			vw = vw->next;
 		}
-		s = gg.sbase[gg.curpage - 1];
+		s = gg.pages[gg.curpage - 1]->sbase;
 
 		while (s != NULL)
 		{
@@ -6033,7 +6033,7 @@ static void centercommand()
 			s->y += dy;
 			s = s->next;
 		}
-		l = gg.lbase[gg.curpage - 1];
+		l = gg.pages[gg.curpage - 1]->lbase;
 
 		while (l != NULL)
 		{
@@ -6041,7 +6041,7 @@ static void centercommand()
 			l->y += dy;
 			l = l->next;
 		}
-		b = gg.bbase[gg.curpage - 1];
+		b = gg.pages[gg.curpage - 1]->bbase;
 
 		while (b != NULL)
 		{
@@ -6313,7 +6313,7 @@ static short readlibrary_at(char *n_, short where, int loadit)
 					FORLIM1 = gg.numpages;
 					for (j = 0; j < FORLIM1; j++)
 					{
-						g = gg.gbase[j];
+						g = gg.pages[j]->gbase;
 						while (g != NULL)
 						{
 							flag = (flag || (g->g & (log_kindoffset - 1)) == i);
@@ -8996,7 +8996,7 @@ static void setgattr(log_grec *g, short num, char *value_)
 		while (pg > 1 && g1 != NULL)
 		{
 			pg--;
-			g1 = gg.gbase[pg - 1];
+			g1 = gg.pages[pg - 1]->gbase;
 			while (g1 != NULL && g1 != g)
 				g1 = g1->next;
 		}
@@ -9523,7 +9523,7 @@ static void addlabel(log_lrec **l, char *s)
 	{
 		fixxy(&x, &y);
 		conflict = false;
-		l1 = gg.lbase[gg.curpage - 1];
+		l1 = gg.pages[gg.curpage - 1]->lbase;
 		while (l1 != NULL)
 		{
 			if (l1->y * gg.scale - gg.yoff == y &&
@@ -11708,21 +11708,21 @@ static void savepage(short pgnum, char *filename_)
 			n1 = n1->next;
 		}
 
-		hw = gg.hwbase[pgnum - 1];
+		hw = gg.pages[pgnum - 1]->hwbase;
 		while (hw != NULL)
 		{
 			hw->node->flag = true;
 			hw = hw->next;
 		}
 
-		vw = gg.vwbase[pgnum - 1];
+		vw = gg.pages[pgnum - 1]->vwbase;
 		while (vw != NULL)
 		{
 			vw->node->flag = true;
 			vw = vw->next;
 		}
 
-		g = gg.gbase[pgnum - 1];
+		g = gg.pages[pgnum - 1]->gbase;
 		while (g != NULL)
 		{
 			FORLIM = g->kind->numpins;
@@ -11769,7 +11769,7 @@ static void savepage(short pgnum, char *filename_)
 		for (i = 0; i < FORLIM; i++)
 			gg.signaltab[i].f = false;
 
-		g = gg.gbase[pgnum - 1];
+		g = gg.pages[pgnum - 1]->gbase;
 		while (g != NULL)
 		{
 			if (g->sig > 0 && g->sig <= gg.lastsignal && gg.signaltab[g->sig -1].np != NULL &&
@@ -11793,7 +11793,7 @@ static void savepage(short pgnum, char *filename_)
 						countnode(gg.signaltab[i].np, &V), gg.signaltab[i].name);
 		}
 		V.numhw = 0;
-		hw = gg.hwbase[pgnum - 1];
+		hw = gg.pages[pgnum - 1]->hwbase;
 		V.firsthwire = NULL;
 		while (hw != NULL)
 		{
@@ -11803,7 +11803,7 @@ static void savepage(short pgnum, char *filename_)
 			hw = hw->next;
 		}
 		numvw = 0;
-		vw = gg.vwbase[pgnum - 1];
+		vw = gg.pages[pgnum - 1]->vwbase;
 		V.firstvwire = NULL;
 		while (vw != NULL)
 		{
@@ -11830,7 +11830,7 @@ static void savepage(short pgnum, char *filename_)
 			vw = (log_vwrec *)vw->temp;
 		}
 		count = 0;
-		s = gg.sbase[pgnum - 1];
+		s = gg.pages[pgnum - 1]->sbase;
 		firstsolder = NULL;
 		while (s != NULL)
 		{
@@ -11856,7 +11856,7 @@ static void savepage(short pgnum, char *filename_)
 			s = (log_srec *)s->temp;
 		}
 		count = 0;
-		l = gg.lbase[pgnum - 1];
+		l = gg.pages[pgnum - 1]->lbase;
 		firstlabel = NULL;
 		while (l != NULL)
 		{
@@ -11875,7 +11875,7 @@ static void savepage(short pgnum, char *filename_)
 			l = (log_lrec *)l->temp;
 		}
 		count = 0;
-		b = gg.bbase[pgnum - 1];
+		b = gg.pages[pgnum - 1]->bbase;
 		firstbox = NULL;
 		while (b != NULL)
 		{
@@ -11892,14 +11892,14 @@ static void savepage(short pgnum, char *filename_)
 			b = (log_brec *)b->temp;
 		}
 		count = 0;
-		g = gg.gbase[pgnum - 1];
+		g = gg.pages[pgnum - 1]->gbase;
 		while (g != NULL)
 		{
 			count++;
 			g = g->next;
 		}
 		fprintf(f, "g %d\n", count);
-		g = gg.gbase[pgnum - 1];
+		g = gg.pages[pgnum - 1]->gbase;
 		while (g != NULL)
 		{
 			k = g->kind;
@@ -12609,63 +12609,63 @@ static void loadpage(char *filename_, char *reason_)
 			_EscIO(FileNotFound);
 		fscanf(V.f, "%hd", &ver);
 		ver = -ver;
-		gg.actx = gg.curpage;
+		gg.actx = gg.curpage - 1;
 		calltools(act_clear);
-		hw = gg.hwbase[gg.curpage - 1];
+		hw = gg.pages[gg.curpage - 1]->hwbase;
 		while (hw != NULL)
 		{
-			gg.hwbase[gg.curpage - 1] = hw->next;
+			gg.pages[gg.curpage - 1]->hwbase = hw->next;
 			stamp(&hw->node->simtype->netstamp);
 			Free(hw);
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 		}
 
-		vw = gg.vwbase[gg.curpage - 1];
+		vw = gg.pages[gg.curpage - 1]->vwbase;
 		while (vw != NULL)
 		{
-			gg.vwbase[gg.curpage - 1] = vw->next;
+			gg.pages[gg.curpage - 1]->vwbase = vw->next;
 			stamp(&vw->node->simtype->netstamp);
 			Free(vw);
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 		}
 
-		s = gg.sbase[gg.curpage - 1];
+		s = gg.pages[gg.curpage - 1]->sbase;
 		while (s != NULL)
 		{
-			gg.sbase[gg.curpage - 1] = s->next;
+			gg.pages[gg.curpage - 1]->sbase = s->next;
 			Free(s);
-			s = gg.sbase[gg.curpage - 1];
+			s = gg.pages[gg.curpage - 1]->sbase;
 		}
 
-		g = gg.gbase[gg.curpage - 1];
+		g = gg.pages[gg.curpage - 1]->gbase;
 		while (g != NULL)
 		{
-			gg.gbase[gg.curpage - 1] = g->next;
+			gg.pages[gg.curpage - 1]->gbase = g->next;
 			stamp(&g->kind->simtype->netstamp);
 			disposegate(&g);
-			g = gg.gbase[gg.curpage - 1];
+			g = gg.pages[gg.curpage - 1]->gbase;
 		}
 
-		l = gg.lbase[gg.curpage - 1];
+		l = gg.pages[gg.curpage - 1]->lbase;
 		if (l != NULL)
 			stamp(&gg.labelstamp);
 
 		while (l != NULL)
 		{
-			gg.lbase[gg.curpage - 1] = l->next;
+			gg.pages[gg.curpage - 1]->lbase = l->next;
 			Free(l);
-			l = gg.lbase[gg.curpage - 1];
+			l = gg.pages[gg.curpage - 1]->lbase;
 		}
 
-		b = gg.bbase[gg.curpage - 1];
+		b = gg.pages[gg.curpage - 1]->bbase;
 		if (b != NULL)
 			stamp(&gg.boxstamp);
 
 		while (b != NULL)
 		{
-			gg.bbase[gg.curpage - 1] = b->next;
+			gg.pages[gg.curpage - 1]->bbase = b->next;
 			Free(b);
-			b = gg.bbase[gg.curpage - 1];
+			b = gg.pages[gg.curpage - 1]->bbase;
 		}
 
 		garbagecoll();
@@ -12935,7 +12935,7 @@ static void loadpage(char *filename_, char *reason_)
 					g1 = g;
 					newgate(&g, j + x1 * log_kindoffset);
 					if (g1 == NULL)
-						gg.gbase[gg.curpage - 1] = g;
+						gg.pages[gg.curpage - 1]->gbase = g;
 					else
 						g1->next = g;
 					g->next = NULL;
@@ -13895,7 +13895,7 @@ static void status_mem()
 		printf("Page %ld -- ", i + 1);
 		if (i + 1 <= gg.numpages)
 		{
-			g = gg.gbase[i];
+			g = gg.pages[i]->gbase;
 			j = 0;
 			while (g != NULL)
 			{
@@ -13903,21 +13903,21 @@ static void status_mem()
 				g = g->next;
 			}
 			printf("%4ld", j);
-			hw = gg.hwbase[i];
+			hw = gg.pages[i]->hwbase;
 			j = 0;
 			while (hw != NULL)
 			{
 				j++;
 				hw = hw->next;
 			}
-			vw = gg.vwbase[i];
+			vw = gg.pages[i]->vwbase;
 			while (vw != NULL)
 			{
 				j++;
 				vw = vw->next;
 			}
 			printf("%7ld", j);
-			l = gg.lbase[i];
+			l = gg.pages[i]->lbase;
 			j = 0;
 			while (l != NULL)
 			{
@@ -13925,7 +13925,7 @@ static void status_mem()
 				l = l->next;
 			}
 			printf("%7ld", j);
-			b = gg.bbase[i];
+			b = gg.pages[i]->bbase;
 			j = 0;
 			while (b != NULL)
 			{
@@ -14975,9 +14975,9 @@ static void dofunction()
 		else if (!strcmp(gg.func, "VLSI"))
 		{
 			clearfunc();
-			if (gg.gbase[gg.curpage - 1] == NULL &&
-					gg.hwbase[gg.curpage - 1] == NULL &&
-					gg.vwbase[gg.curpage - 1] == NULL)
+			if (gg.pages[gg.curpage - 1]->gbase == NULL &&
+					gg.pages[gg.curpage - 1]->hwbase == NULL &&
+					gg.pages[gg.curpage - 1]->vwbase == NULL)
 				setvlsimode(!vlsi);
 		}
 		else if (!strcmp(gg.func, "FAST"))
@@ -16255,6 +16255,10 @@ static void initialize()
 		kind[i] = NULL;
 	m_graphics_on();
 	clearalpha();
+
+	for(int i = 0; i < log_maxpages; ++i)
+		gg.pages[i] = page_alloc();
+	gg.numpages = 1;
 	gg.curpage = 1;
 	gg.showpage = 1;
 	realcurpage = 1;
@@ -16307,7 +16311,6 @@ static void initialize()
 	XRebindKeysym(m_display, XStringToKeysym("BackSpace"), NULL, 0, (unsigned char * )"\007", 1);
 	gg.refrflag = true;
 	gg.markers = false;
-	gg.numpages = 1;
 	*gg.func = '\0';
 	*gg.genfunc = '\0';
 	gg.xoff = origin;
@@ -16317,12 +16320,6 @@ static void initialize()
 	xoff0 = 0;
 	yoff0 = 0;
 	gatecount[0] = 0;
-	gg.gbase[0] = NULL;
-	gg.sbase[0] = NULL;
-	gg.hwbase[0] = NULL;
-	gg.vwbase[0] = NULL;
-	gg.lbase[0] = NULL;
-	gg.bbase[0] = NULL;
 	gg.nbase = NULL;
 	gg.pagechanged[0] = false;
 	stamp(gg.pagestamp);
diff --git a/log/src/logcom.c b/log/src/logcom.c
index a99bb4e628b749d0e0b8fbfce9dabbcfdd8b2e88..efbd55a3422c91497e6e8691b5a24384bc289753 100644
--- a/log/src/logcom.c
+++ b/log/src/logcom.c
@@ -538,7 +538,7 @@ log_action_t *act;
   Log_7_time(act);
   if (act->showpage <= 0)
     return;
-  g = act->gbase[act->showpage - 1];
+  g = act->pages[act->showpage - 1]->gbase;
   while (g != NULL) {
     if (g->kind->simtype == act->acttool) {
       act->actgate = g;
@@ -739,7 +739,7 @@ log_action_t *act;
     unfoundkind = NULL;
     FORLIM = WITH->numpages;
     for (i = 1; i <= FORLIM; i++) {
-      g = WITH->gbase[i - 1];
+      g = WITH->pages[i - 1]->gbase;
       while (g != NULL) {
 	if (g->kind->simtype == WITH->acttool) {
 	  WITH->actgate = g;
@@ -794,7 +794,7 @@ log_action_t *act;
 	(*procs_7[i])(act);
       FORLIM = WITH->numpages;
       for (i = 0; i < FORLIM; i++) {
-	g = WITH->gbase[i];
+	g = WITH->pages[i]->gbase;
 	while (g != NULL) {
 	  if (g->kind->simtype == WITH->acttool) {
 	    WITH->actgate = g;
diff --git a/log/src/loghier.c b/log/src/loghier.c
index 0c9060ff71aae16514792557af0cf92005b66e22..a293d67afc63e44d90d090ab7016eb181ba6a0eb 100644
--- a/log/src/loghier.c
+++ b/log/src/loghier.c
@@ -109,7 +109,7 @@ short pg;
   char STR2[256];
 
   bp2 = NULL;
-  bp = lact->bbase[pg - 1];
+  bp = lact->pages[pg - 1]->bbase;
   while (bp != NULL) {  /*find smallest box containing the label*/
     if (P_ibetween((long)bp->x1, (long)lp->x, (long)(bp->x2 - lp->w)) &&
 	P_ibetween((long)bp->y1, (long)lp->y, (long)bp->y2)) {
@@ -259,7 +259,7 @@ short pg;
   boxed = false;
   boxless = false;
   numdefs = 0;
-  lp = lact->lbase[pg - 1];
+  lp = lact->pages[pg - 1]->lbase;
   while (lp != NULL) {
     if (commandlabel(lp, buf, buf2) && !strcmp(buf, "NAME") &&
 	*strcpy(STR1, strltrim(buf2)) != '\0' && *buf2 != '(') {
@@ -274,7 +274,7 @@ short pg;
 	else
 	  boxless = true;
 	lprev = &dir;
-	g = lact->gbase[pg - 1];
+	g = lact->pages[pg - 1]->gbase;
 	while (g != NULL) {  /*check inter-dependencies of definitions*/
 	  if (gateinbox(bp, g)) {
 	    gateinstof(buf, g);
diff --git a/log/src/logntk.c b/log/src/logntk.c
index 3ef6d601240d3a41f82e64907c84a481f1af9302..1d83bed328c58f1e5290ea17fa84324a69bf7e71 100644
--- a/log/src/logntk.c
+++ b/log/src/logntk.c
@@ -517,7 +517,7 @@ struct LOC_Log_logntk_proc *LINK;
   char STR1[256];
   char STR3[256];
 
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && strcicmp(c->name, gateinstof(STR1, g)) == 0) {
       if (!trynamegate(g, LINK)) {
@@ -550,7 +550,7 @@ struct LOC_Log_logntk_proc *LINK;
   char STR3[256];
   short FORLIM;
 
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && re_compare(g->kind->name, p->name)) {
       if (!trynamegate(g, LINK)) {
@@ -620,7 +620,7 @@ struct LOC_Log_logntk_proc *LINK;
     p->ccount = 0;
     p = p->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     g->temp = (na_long)NULL;
     g = g->next;
@@ -638,7 +638,7 @@ struct LOC_Log_logntk_proc *LINK;
   notfoundlist = NULL;
   wignlist = NULL;
   maincell = (strcmp(cellname, main_name) == 0);
-  lb1 = LINK->act->lbase[LINK->act->curpage - 1];
+  lb1 = LINK->act->pages[LINK->act->curpage - 1]->lbase;
   while (lb1 != NULL) {
     if (labelinbox(mybox, lb1) && commandlabel(lb1, buf, buf2))
       docommand(buf, buf2, false, LINK);
@@ -648,7 +648,7 @@ struct LOC_Log_logntk_proc *LINK;
   nodecount = 0;
   strcpy(nodeprefix, "port");
   gtempl = NULL;
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   if (!maincell) {
     while (g != NULL) {
       if (gateinbox(mybox, g)) {
@@ -694,7 +694,7 @@ struct LOC_Log_logntk_proc *LINK;
 	strlist_cifind(ports, LINK->act->signaltab[i].name) != NULL)
       namenode(LINK->act->signaltab[i].np, LINK);
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       t = transbase;
@@ -721,7 +721,7 @@ struct LOC_Log_logntk_proc *LINK;
     nameprimgates(p, LINK);
     p = p->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       LINK->act->actstrlist = NULL;
@@ -775,7 +775,7 @@ struct LOC_Log_logntk_proc *LINK;
     strdispose((char **)((char **)(&n->temp)));
     n = n->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     strdispose((char **)((char **)(&g->temp)));
     g = g->next;
@@ -832,7 +832,7 @@ struct LOC_Log_logntk_proc *LINK;
   char cmd[256], args[256];
   char STR2[256];
 
-  l1 = LINK->act->lbase[LINK->act->curpage - 1];
+  l1 = LINK->act->pages[LINK->act->curpage - 1]->lbase;
   while (l1 != NULL && !(commandlabel(l1, cmd, args) &&
 			 strcicmp(cmd, newcmd) == 0 && *args == '('))
     l1 = l1->next;
@@ -945,7 +945,7 @@ struct LOC_dologntk *LINK;
 
   V.LINK = LINK;
   V.f2 = NULL;
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       gateinstof(V.s, g);
@@ -1083,7 +1083,7 @@ struct LOC_dologntk *LINK;
     if (gtempl == NULL) {
       l1 = ports;
       while (l1 != NULL) {
-	g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+	g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
 	while (g != NULL &&
 	       (g->sig == 0 || !gateinbox(mybox, g) ||
 		strcicmp(LINK->LINK->act->signaltab[g->sig - 1].name, l1->s) != 0))
@@ -1097,7 +1097,7 @@ struct LOC_dologntk *LINK;
       }
     }
   } else {
-    g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+    g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
     while (g != NULL) {
       if (gateinbox(mybox, g) && g->sig != 0) {
 	strcpy(w, LINK->LINK->act->signaltab[g->sig - 1].name);
@@ -1148,7 +1148,7 @@ struct LOC_dologntk *LINK;
   }
   strlist_empty(&havedone);
   j = 0;
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && strlist_find_r(orphans, g->kind->name) != NULL) {
       j++;
@@ -1156,7 +1156,7 @@ struct LOC_dologntk *LINK;
     }
     g = g->next;
   }
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       gateinstof(ginstname, g);
@@ -1507,7 +1507,7 @@ struct LOC_Log_logntk_proc *LINK;
 	  if (LINK->act->neargate != NULL){
 	    probegate = LINK->act->neargate;
 	  }
-	  g = LINK->act->gbase[LINK->act->curpage - 1];
+	  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
 	  while (g != NULL && probenode == NULL) {
 	    if (gateinbox(mybox, g)) {
 	      FORLIM = g->kind->numpins;
@@ -1612,7 +1612,7 @@ struct LOC_Log_logntk_proc *LINK;
     argl = arglist;
     while (argl != NULL) {
       strcpy(buf, argl->s);
-      g = LINK->act->gbase[LINK->act->curpage - 1];
+      g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
       while (g != NULL && (!gateinbox(mybox, g) || (char *)g->temp == NULL ||
 			   strcicmp((char *)g->temp, buf) != 0))
 	g = g->next;
diff --git a/log/src/logsim.c b/log/src/logsim.c
index 95a8edf626dfcb6c3df75e9b85ebafd9418fb41c..391eb8aa2574ce4e500e7ffbf4ad47e7f7869474 100644
--- a/log/src/logsim.c
+++ b/log/src/logsim.c
@@ -1072,7 +1072,7 @@ static void callallgates(log_16_actionkinds kind)
 	FORLIM = WITH->numpages;
 	for (pg = 0; pg < FORLIM; pg++)
 	{
-		g = WITH->gbase[pg];
+		g = WITH->pages[pg]->gbase;
 		while (g != NULL)
 		{
 			WITH1 = g->kind;
@@ -1170,7 +1170,7 @@ static void pass_16(log_16_action *act)
 							log_16_bv[(resetcounter > 0) - false]);
 				FORLIM = WITH->numpages;
 				for (pg = 0; pg < FORLIM; pg++)
-					executegates(&maketimebid, WITH->gbase[pg]);
+					executegates(&maketimebid, WITH->pages[pg]->gbase);
 				nexttimebid = diggattr[digtimestep - 1].UU.r;
 			}
 			passready = maketimebid;
@@ -1184,7 +1184,7 @@ static void pass_16(log_16_action *act)
 		stabilizing = false;
 	if (WITH->showpage > 0)
 	{
-		g = WITH->gbase[WITH->showpage - 1];
+		g = WITH->pages[WITH->showpage - 1]->gbase;
 		while (g != NULL)
 		{
 			WITH1 = g->kind;
diff --git a/log/src/logsimh.c b/log/src/logsimh.c
index 91f75c79f4c625e76e3e001b6fe8e69a37ebc2ed..9fe67d9c974db27270adf7523691803d88f03eab 100644
--- a/log/src/logsimh.c
+++ b/log/src/logsimh.c
@@ -1514,7 +1514,7 @@ static void parsegates(struct LOC_compilepage *LINK)
 
 	V.LINK = LINK;
 	/* Collect a list of all gates in the definition */
-	g1 = logsima_action.lact->gbase[LINK->hdef->pgnum - 1];
+	g1 = logsima_action.lact->pages[LINK->hdef->pgnum - 1]->gbase;
 	i = 0;
 	while (g1 != NULL)
 	{
@@ -1528,7 +1528,7 @@ static void parsegates(struct LOC_compilepage *LINK)
 	}
 	glist = (gaterec *)Malloc(i * sizeof(gaterec));
 	numg = 0;
-	g1 = logsima_action.lact->gbase[LINK->hdef->pgnum - 1];
+	g1 = logsima_action.lact->pages[LINK->hdef->pgnum - 1]->gbase;
 	while (g1 != NULL && LINK->okay)
 	{
 		if (g1 != LINK->gtempl && g1->kind->simtype == logsima_tool_16 &&
@@ -4298,7 +4298,7 @@ static void compilepage(hdefrec *hdef_)
 	V.optdelay = (V.hdef->optdelay && V.optlevel >= 3);
 	V.hdef->nextoptflag = false;
 	V.mybox = V.hdef->defbox;
-	lp = WITH->lbase[V.hdef->pgnum - 1];
+	lp = WITH->pages[V.hdef->pgnum - 1]->lbase;
 	while (lp != NULL && V.okay)
 	{
 		if (labelinbox(V.mybox, lp) && commandlabel(lp, wrd, buf))
@@ -4382,7 +4382,7 @@ static void compilepage(hdefrec *hdef_)
 		}
 		else
 		{
-			V.gtempl = WITH->gbase[V.hdef->pgnum - 1];
+			V.gtempl = WITH->pages[V.hdef->pgnum - 1]->gbase;
 
 			while (V.gtempl != NULL && (isinstance(V.gtempl) != V.hdef ||
 						!gateinbox(V.mybox, V.gtempl)))
@@ -4762,7 +4762,7 @@ static void updatehdef(hdefrec *hdef)
 		FORLIM = WITH->numpages;
 		for (i = 0; i < FORLIM; i++)
 		{
-			lp = WITH->lbase[i];
+			lp = WITH->pages[i]->lbase;
 			while (lp != NULL)
 			{
 				if (commandlabel(lp, wrd, buf) && !strcmp(wrd, "NAME") &&
@@ -4791,7 +4791,7 @@ static void updatehdef(hdefrec *hdef)
 				FORLIM = WITH->numpages;
 				for (i = 0; i < FORLIM; i++)
 				{
-					g1 = WITH->gbase[i];
+					g1 = WITH->pages[i]->gbase;
 					while (g1 != NULL)
 					{
 						if (isinstance(g1) == hdef)
diff --git a/log/src/logspc.c b/log/src/logspc.c
index 8fb44a2e0a34b89a5bebca660d282eaf17ab76a8..eaafe2c572a6071bb1dd2f53669e48b9f6564648 100644
--- a/log/src/logspc.c
+++ b/log/src/logspc.c
@@ -708,7 +708,7 @@ struct LOC_Log_logspc_proc *LINK;
   char STR1[256];
   char STR3[256];
 
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && strcicmp(c->name, gateinstof(STR1, g)) == 0) {
       if (!trynamegate(g, LINK)) {
@@ -741,7 +741,7 @@ struct LOC_Log_logspc_proc *LINK;
   char STR3[256];
   short FORLIM;
 
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && re_compare(g->kind->name, p->name)) {
       if (!trynamegate(g, LINK)) {
@@ -811,7 +811,7 @@ struct LOC_Log_logspc_proc *LINK;
     p->ccount = 0;
     p = p->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     g->temp = (na_long)NULL;
     g = g->next;
@@ -829,7 +829,7 @@ struct LOC_Log_logspc_proc *LINK;
   notfoundlist = NULL;
   wignlist = NULL;
   maincell = (strcmp(cellname, main_name) == 0);
-  lb1 = LINK->act->lbase[LINK->act->curpage - 1];
+  lb1 = LINK->act->pages[LINK->act->curpage - 1]->lbase;
   while (lb1 != NULL) {
     if (labelinbox(mybox, lb1) && commandlabel(lb1, buf, buf2))
       docommand(buf, buf2, false, LINK);
@@ -839,7 +839,7 @@ struct LOC_Log_logspc_proc *LINK;
   nodecount = 0;
   strcpy(nodeprefix, "port");
   gtempl = NULL;
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   if (!maincell) {
     while (g != NULL) {
       if (gateinbox(mybox, g)) {
@@ -885,7 +885,7 @@ struct LOC_Log_logspc_proc *LINK;
 	strlist_cifind(ports, LINK->act->signaltab[i].name) != NULL)
       namenode(LINK->act->signaltab[i].np, LINK);
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       t = transbase;
@@ -912,7 +912,7 @@ struct LOC_Log_logspc_proc *LINK;
     nameprimgates(p, LINK);
     p = p->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       LINK->act->actstrlist = NULL;
@@ -966,7 +966,7 @@ struct LOC_Log_logspc_proc *LINK;
     strdispose((char **)((char **)(&n->temp)));
     n = n->next;
   }
-  g = LINK->act->gbase[LINK->act->curpage - 1];
+  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     strdispose((char **)((char **)(&g->temp)));
     g = g->next;
@@ -1021,7 +1021,7 @@ struct LOC_Log_logspc_proc *LINK;
   char cmd[256], args[256];
   char STR2[256];
 
-  l1 = LINK->act->lbase[LINK->act->curpage - 1];
+  l1 = LINK->act->pages[LINK->act->curpage - 1]->lbase;
   while (l1 != NULL && !(commandlabel(l1, cmd, args) &&
 			 strcicmp(cmd, newcmd) == 0 && *args == '('))
     l1 = l1->next;
@@ -1161,7 +1161,7 @@ struct LOC_dologspc *LINK;
 
   V.LINK = LINK;
   V.f2 = NULL;
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       gateinstof(V.s, g);
@@ -1328,7 +1328,7 @@ struct LOC_dologspc *LINK;
     if (gtempl == NULL) {
       l1 = ports;
       while (l1 != NULL) {
-	g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+	g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
 	while (g != NULL &&
 	       (g->sig == 0 || !gateinbox(mybox, g) ||
 		strcicmp(LINK->LINK->act->signaltab[g->sig - 1].name, l1->s) != 0))
@@ -1342,7 +1342,7 @@ struct LOC_dologspc *LINK;
       }
     }
   } else {
-    g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+    g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
     while (g != NULL) {
       if (gateinbox(mybox, g) && g->sig != 0) {
 	strcpy(w, LINK->LINK->act->signaltab[g->sig - 1].name);
@@ -1403,7 +1403,7 @@ struct LOC_dologspc *LINK;
   }
   strlist_empty(&havedone);
   j = 0;
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g) && strlist_find_r(orphans, g->kind->name) != NULL) {
       j++;
@@ -1416,7 +1416,7 @@ struct LOC_dologspc *LINK;
   fprintf(LINK->outf, "V%d Vdd Gnd %g;\n", v_ctr, AnaVdd);
   v_ctr++;
 
-  g = LINK->LINK->act->gbase[LINK->LINK->act->curpage - 1];
+  g = LINK->LINK->act->pages[LINK->LINK->act->curpage - 1]->gbase;
   while (g != NULL) {
     if (gateinbox(mybox, g)) {
       gateinstof(ginstname, g);
@@ -2200,7 +2200,7 @@ struct LOC_Log_logspc_proc *LINK;
 	    probenode = LINK->act->nearvw->node;
 	  if (LINK->act->neargate != NULL)
 	    probegate = LINK->act->neargate;
-	  g = LINK->act->gbase[LINK->act->curpage - 1];
+	  g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
 	  while (g != NULL && probenode == NULL) {
 	    if (gateinbox(mybox, g)) {
 	      FORLIM = g->kind->numpins;
@@ -2304,7 +2304,7 @@ struct LOC_Log_logspc_proc *LINK;
     argl = arglist;
     while (argl != NULL) {
       strcpy(buf, argl->s);
-      g = LINK->act->gbase[LINK->act->curpage - 1];
+      g = LINK->act->pages[LINK->act->curpage - 1]->gbase;
       while (g != NULL && (!gateinbox(mybox, g) || (char *)g->temp == NULL ||
 			   strcicmp((char *)g->temp, buf) != 0))
 	g = g->next;
diff --git a/log/src/node.c b/log/src/node.c
index 50789cbca3358338ee0df037c8d0a5314bae8c13..72123996d04e5194b12316bd6081d241286ad68b 100644
--- a/log/src/node.c
+++ b/log/src/node.c
@@ -279,7 +279,7 @@ void dumpnodes()
 	fprintf(tracefile, "  Internal error, %d\n", P_escapecode);
 	ENDTRY(try6);
 	putc('\n', tracefile);
-	hw = gg.hwbase[gg.curpage - 1];
+	hw = gg.pages[gg.curpage - 1]->hwbase;
 	fprintf(tracefile, "HWIRES\n");
 	TRY(try8);
 	while (hw != NULL)
@@ -295,7 +295,7 @@ void dumpnodes()
 	fprintf(tracefile, "  Internal error, %d\n", P_escapecode);
 	ENDTRY(try8);
 	putc('\n', tracefile);
-	vw = gg.vwbase[gg.curpage - 1];
+	vw = gg.pages[gg.curpage - 1]->vwbase;
 	fprintf(tracefile, "VWIRES\n");
 	TRY(try9);
 	while (vw != NULL)
@@ -311,7 +311,7 @@ void dumpnodes()
 	fprintf(tracefile, "  Internal error, %d\n", P_escapecode);
 	ENDTRY(try9);
 	putc('\n', tracefile);
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	fprintf(tracefile, "SOLDER\n");
 	TRY(try10);
 	while (s != NULL)
@@ -329,7 +329,7 @@ void dumpnodes()
 	fprintf(tracefile, "  Internal error, %d\n", P_escapecode);
 	ENDTRY(try10);
 	putc('\n', tracefile);
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	fprintf(tracefile, "GATES\n");
 	TRY(try11);
 	while (g != NULL)
@@ -445,21 +445,21 @@ void combinenodes(log_nrec **n2, log_nrec **n1, cnrec *cnbase)
 			FORLIM = gg.numpages;
 			for (pg = 0; pg < FORLIM; pg++)
 			{
-				hw = gg.hwbase[pg];
+				hw = gg.pages[pg]->hwbase;
 				while (hw != NULL)
 				{
 					if (hw->node == nn1)
 						switchnode(&hw->node, nn2);
 					hw = hw->next;
 				}
-				vw = gg.vwbase[pg];
+				vw = gg.pages[pg]->vwbase;
 				while (vw != NULL)
 				{
 					if (vw->node == nn1)
 						switchnode(&vw->node, nn2);
 					vw = vw->next;
 				}
-				g = gg.gbase[pg];
+				g = gg.pages[pg]->gbase;
 				while (g != NULL)
 				{
 					FORLIM1 = g->kind->numpins;
diff --git a/log/src/page.c b/log/src/page.c
index 89f7308171dff965c08849bcd1cdf9f31d7c4d56..072cf8f584efc4e4d66c50b209cea5e546cff5f6 100644
--- a/log/src/page.c
+++ b/log/src/page.c
@@ -42,9 +42,9 @@ void chpageplace(short pg, short x1, short y1, short x2, short y2)
 
 int pageempty(short pg)
 {
-	return (gg.gbase[pg - 1] == NULL && gg.hwbase[pg - 1] == NULL &&
-			gg.vwbase[pg - 1] == NULL && gg.bbase[pg - 1] == NULL &&
-			gg.lbase[pg - 1] == NULL);
+	return (gg.pages[pg - 1]->gbase == NULL && gg.pages[pg - 1]->hwbase == NULL &&
+			gg.pages[pg - 1]->vwbase == NULL && gg.pages[pg - 1]->bbase == NULL &&
+			gg.pages[pg - 1]->lbase == NULL);
 }
 
 
@@ -61,10 +61,10 @@ int pagechanged(short pg)
 
 int anychanged()
 {
-	short i;
+	size_t i;
 
 	i = 1;
-	while (i <= gg.numpages && !pagechanged(i))
+	while (i <= gg.numpages && !pagechanged((short)i))
 		i++;
 	return (i <= gg.numpages);
 }
@@ -85,12 +85,12 @@ void newpage(short pg)
 		xoffp[i] = (origin + across / 2) * gg.scale / log_scale0 - across / 2;
 		yoffp[i] = (origin + baseline / 2) * gg.scale / log_scale0 - baseline / 2;
 		gatecount[i] = 0;
-		gg.gbase[i] = NULL;
-		gg.sbase[i] = NULL;
-		gg.hwbase[i] = NULL;
-		gg.vwbase[i] = NULL;
-		gg.lbase[i] = NULL;
-		gg.bbase[i] = NULL;
+		gg.pages[i]->gbase = NULL;
+		gg.pages[i]->sbase = NULL;
+		gg.pages[i]->hwbase = NULL;
+		gg.pages[i]->vwbase = NULL;
+		gg.pages[i]->lbase = NULL;
+		gg.pages[i]->bbase = NULL;
 		gg.pagechanged[i] = false;
 		stamp(&gg.pagestamp[i]);
 		gg.pageregions[i] = NULL;
@@ -113,3 +113,29 @@ void newpage(short pg)
 		gg.numpages--;
 }
 
+log_page *page_alloc()
+{
+	log_page *newpage = Malloc(sizeof(log_page));
+	
+	newpage->gbase = NULL;
+	newpage->sbase = NULL;
+	newpage->hwbase = NULL;
+	newpage->vwbase = NULL;
+	newpage->lbase = NULL;
+	newpage->bbase = NULL;
+
+	return newpage;
+}
+
+void page_free(log_page **page)
+{
+	Free(*page);
+	*page = NULL;
+}
+
+int page_is_empty(log_page *page)
+{
+	return  page->gbase == NULL && page->hwbase == NULL &&
+			page->vwbase == NULL && page->bbase == NULL &&
+			page->lbase == NULL;
+}
diff --git a/log/src/screen.c b/log/src/screen.c
index 2fe692d03297cdd3eccec02ca21be91f050aab99..db47f4e2723f8e043b644d0b1fbe244b16ba14d1 100644
--- a/log/src/screen.c
+++ b/log/src/screen.c
@@ -1781,7 +1781,7 @@ void setdimgate(log_grec *g, int dim)
 	g->dimcolor = dim;
 	if (gg.showpage <= 0)
 		return;
-	g1 = gg.gbase[gg.showpage - 1];
+	g1 = gg.pages[gg.showpage - 1]->gbase;
 	while (g1 != NULL && g1 != g)
 		g1 = g1->next;
 	if (g1 != g)
@@ -1913,7 +1913,7 @@ void drawnodec(log_nrec *n, short c)
 	}
 	if (vlsi && c == gg.color.wire[0])
 	{
-		hw = gg.hwbase[gg.curpage - 1];
+		hw = gg.pages[gg.curpage - 1]->hwbase;
 		while (hw != NULL)
 		{
 			if (hw->node == n && hw != gg.movinghw)
@@ -1923,7 +1923,7 @@ void drawnodec(log_nrec *n, short c)
 			}
 			hw = hw->next;
 		}
-		vw = gg.vwbase[gg.curpage - 1];
+		vw = gg.pages[gg.curpage - 1]->vwbase;
 		while (vw != NULL)
 		{
 			if (vw->node == n && vw != gg.movingvw)
@@ -1937,13 +1937,13 @@ void drawnodec(log_nrec *n, short c)
 	else
 	{
 		m_color((long)c);
-		hw = gg.hwbase[gg.curpage - 1];
+		hw = gg.pages[gg.curpage - 1]->hwbase;
 		while (hw != NULL) {
 			if (hw->node == n && hw != gg.movinghw)
 				hline(hw->x1, hw->x2, hw->y);
 			hw = hw->next;
 		}
-		vw = gg.vwbase[gg.curpage - 1];
+		vw = gg.pages[gg.curpage - 1]->vwbase;
 		while (vw != NULL)
 		{
 			if (vw->node == n && vw != gg.movingvw)
@@ -1953,7 +1953,7 @@ void drawnodec(log_nrec *n, short c)
 	}
 	if (showsolder)
 	{
-		s = gg.sbase[gg.curpage - 1];
+		s = gg.pages[gg.curpage - 1]->sbase;
 		while (s != NULL)
 		{
 			if ((s->hwire != NULL && s->hwire->node == n) ||
@@ -2103,7 +2103,7 @@ void refresh()
 	if (!gg.invisible && !gg.showconflicts)
 	{
 		suppressdots = gg.dotsvisible;
-		g = gg.gbase[gg.curpage - 1];
+		g = gg.pages[gg.curpage - 1]->gbase;
 		while (g != NULL)
 		{
 			if (P_ibetweenm(x1, (long)g->x, x2, (long)g->kind->bbmax) &&
@@ -2114,7 +2114,7 @@ void refresh()
 		suppressdots = false;
 		if (gg.glowmode)
 		{
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL)
 			{
 				if (hw->y > y1 && hw->y < y2 && hw != gg.movinghw)
@@ -2125,7 +2125,7 @@ void refresh()
 				}
 				hw = hw->next;
 			}
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL)
 			{
 				if (vw->x > x1 && vw->x < x2 && vw != gg.movingvw)
@@ -2138,7 +2138,7 @@ void refresh()
 			}
 			if (showsolder)
 			{
-				s = gg.sbase[gg.curpage - 1];
+				s = gg.pages[gg.curpage - 1]->sbase;
 				while (s != NULL)
 				{
 					if (s->hwire != NULL)
@@ -2153,7 +2153,7 @@ void refresh()
 		else
 		{
 			m_color((long)gg.color.wire[0]);
-			hw = gg.hwbase[gg.curpage - 1];
+			hw = gg.pages[gg.curpage - 1]->hwbase;
 			while (hw != NULL)
 			{
 				if (hw->y > y1 && hw->y < y2 && hw != gg.movinghw)
@@ -2164,7 +2164,7 @@ void refresh()
 				}
 				hw = hw->next;
 			}
-			vw = gg.vwbase[gg.curpage - 1];
+			vw = gg.pages[gg.curpage - 1]->vwbase;
 			while (vw != NULL)
 			{
 				if (vw->x > x1 && vw->x < x2 && vw != gg.movingvw)
@@ -2177,7 +2177,7 @@ void refresh()
 			}
 			if (showsolder)
 			{
-				s = gg.sbase[gg.curpage - 1];
+				s = gg.pages[gg.curpage - 1]->sbase;
 				while (s != NULL)
 				{
 					if (s->hwire != NULL)
@@ -2192,7 +2192,7 @@ void refresh()
 
 		if (gg.dotsvisible)
 		{
-			g = gg.gbase[gg.curpage - 1];
+			g = gg.pages[gg.curpage - 1]->gbase;
 			while (g != NULL)
 			{
 				if (g->x > x1 && g->x < x2 && g->y > y1 && g->y < y2)
@@ -2203,7 +2203,7 @@ void refresh()
 	}
 	else
 	{
-		g = gg.gbase[gg.curpage - 1];
+		g = gg.pages[gg.curpage - 1]->gbase;
 		while (g != NULL)
 		{
 			if (g->kind->flag.U3.visible)
@@ -2213,13 +2213,13 @@ void refresh()
 	}
 	if (!gg.textinvisible)
 	{
-		b = gg.bbase[gg.curpage - 1];
+		b = gg.pages[gg.curpage - 1]->bbase;
 		while (b != NULL)
 		{
 			drawboxc(b, gg.color.dashbox);
 			b = b->next;
 		}
-		l = gg.lbase[gg.curpage - 1];
+		l = gg.pages[gg.curpage - 1]->lbase;
 		m_color((long)gg.color.labeltext);
 		while (l != NULL)
 		{
diff --git a/log/src/wire.c b/log/src/wire.c
index 53c39b350fb8da8ca12ba0138ff1d4a70acf357b..3cbe6a3b37441227cf5c08b88e51a9e8cdda3cfa 100644
--- a/log/src/wire.c
+++ b/log/src/wire.c
@@ -51,8 +51,8 @@ void markcolor(log_hwrec **hw, struct LOC_wantsolder *LINK)
 void newhw(log_hwrec **hw)
 {
 	*hw = (log_hwrec *)Malloc(sizeof(log_hwrec));
-	(*hw)->next = gg.hwbase[gg.curpage - 1];
-	gg.hwbase[gg.curpage - 1] = *hw;
+	(*hw)->next = gg.pages[gg.curpage - 1]->hwbase;
+	gg.pages[gg.curpage - 1]->hwbase = *hw;
 	(*hw)->temp = (na_long)0;
 }
 
@@ -74,10 +74,10 @@ void disphw(log_hwrec **hw)
 		fprintf(tracefile, "Dispose hwire %ld\n", (long)(*hw));
 	if (*hw == NULL)
 		return;
-	hw1 = gg.hwbase[gg.curpage - 1];
+	hw1 = gg.pages[gg.curpage - 1]->hwbase;
 	if (*hw == hw1)
 	{
-		gg.hwbase[gg.curpage - 1] = (*hw)->next;
+		gg.pages[gg.curpage - 1]->hwbase = (*hw)->next;
 	}
 	else
 	{
@@ -104,8 +104,8 @@ void disphw(log_hwrec **hw)
 void newvw(log_vwrec **vw)
 {
 	*vw = (log_vwrec *)Malloc(sizeof(log_vwrec));
-	(*vw)->next = gg.vwbase[gg.curpage - 1];
-	gg.vwbase[gg.curpage - 1] = *vw;
+	(*vw)->next = gg.pages[gg.curpage - 1]->vwbase;
+	gg.pages[gg.curpage - 1]->vwbase = *vw;
 	(*vw)->temp = (na_long)0;
 }
 
@@ -127,10 +127,10 @@ void dispvw(log_vwrec **vw)
 		fprintf(tracefile, "Dispose vwire %ld\n", (long)(*vw));
 	if (*vw == NULL)
 		return;
-	vw1 = gg.vwbase[gg.curpage - 1];
+	vw1 = gg.pages[gg.curpage - 1]->vwbase;
 	if (*vw == vw1)
 	{
-		gg.vwbase[gg.curpage - 1] = (*vw)->next;
+		gg.pages[gg.curpage - 1]->vwbase = (*vw)->next;
 	}
 	else
 	{
@@ -156,8 +156,8 @@ void dispvw(log_vwrec **vw)
 void newsolder(log_srec **s)
 {
 	*s = (log_srec *)Malloc(sizeof(log_srec));
-	(*s)->next = gg.sbase[gg.curpage - 1];
-	gg.sbase[gg.curpage - 1] = *s;
+	(*s)->next = gg.pages[gg.curpage - 1]->sbase;
+	gg.pages[gg.curpage - 1]->sbase = *s;
 	(*s)->hwire = NULL;
 	(*s)->hwire2 = NULL;
 	(*s)->vwire = NULL;
@@ -183,10 +183,10 @@ void dispsolder(log_srec **s)
 		fprintf(tracefile, "Dispose solder %ld\n", (long)(*s));
 	if (*s == NULL)
 		return;
-	s1 = gg.sbase[gg.curpage - 1];
+	s1 = gg.pages[gg.curpage - 1]->sbase;
 	if (*s == s1)
 	{
-		gg.sbase[gg.curpage - 1] = (*s)->next;
+		gg.pages[gg.curpage - 1]->sbase = (*s)->next;
 	}
 	else
 	{
@@ -218,11 +218,11 @@ void closerwire(short x, short y)
 		gg.nearvw = NULL;
 		return;
 	}
-	gg.nearhw = gg.hwbase[gg.curpage - 1];
+	gg.nearhw = gg.pages[gg.curpage - 1]->hwbase;
 	while (gg.nearhw != NULL &&
 			(gg.nearhw->y != y || gg.nearhw->x1 > x || gg.nearhw->x2 < x))
 		gg.nearhw = gg.nearhw->next;
-	gg.nearvw = gg.vwbase[gg.curpage - 1];
+	gg.nearvw = gg.pages[gg.curpage - 1]->vwbase;
 	while (gg.nearvw != NULL &&
 			(gg.nearvw->x != x || gg.nearvw->y1 > y || gg.nearvw->y2 < y))
 		gg.nearvw = gg.nearvw->next;
@@ -244,7 +244,7 @@ void addsolder(short x, short y, log_hwrec *hw, log_hwrec *hw2, log_vwrec *vw, l
 	log_srec *s;
 	log_nrec *n;
 
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL && (s->x != x || s->y != y))
 		s = s->next;
 	if (s == NULL) {
@@ -317,7 +317,7 @@ log_srec *findsolder(short x, short y)
 {
 	log_srec *s;
 
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL && (s->x != x || s->y != y))
 		s = s->next;
 	return s;
@@ -375,7 +375,7 @@ void chghw(log_hwrec *hw, log_nrec *oldnode, log_nrec *n)
 	if (gg.traceflag)
 		fprintf(tracefile, "Change hwire %ld to node %ld\n", (long)hw, (long)n);
 	switchnode(&hw->node, n);
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->y - hw->y) <= g->kind->bbmax &&
@@ -393,7 +393,7 @@ void chghw(log_hwrec *hw, log_nrec *oldnode, log_nrec *n)
 		}
 		g = g->next;
 	}
-	vw = gg.vwbase[gg.curpage - 1];
+	vw = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw != NULL)
 	{
 		if (hw->x1 <= vw->x && vw->x <= hw->x2 && vw->y1 <= hw->y &&
@@ -406,7 +406,7 @@ void chghw(log_hwrec *hw, log_nrec *oldnode, log_nrec *n)
 				chgvw(vw, oldnode, n);
 			else
 			{  /*vlsi only*/
-				s = gg.sbase[gg.curpage - 1];
+				s = gg.pages[gg.curpage - 1]->sbase;
 				while (s != NULL && (s->x != vw->x || s->y != hw->y))
 					s = s->next;
 				if (s != NULL)
@@ -415,7 +415,7 @@ void chghw(log_hwrec *hw, log_nrec *oldnode, log_nrec *n)
 		}
 		vw = vw->next;
 	}
-	hw1 = gg.hwbase[gg.curpage - 1];
+	hw1 = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw1 != NULL && vlsi)
 	{
 		if (hw->y == hw1->y && (hw->x1 == hw1->x2 || hw->x2 == hw1->x1) &&
@@ -443,7 +443,7 @@ void chgvw(log_vwrec *vw, log_nrec *oldnode, log_nrec *n)
 	if (gg.traceflag)
 		fprintf(tracefile, "Change vwire %ld to node %ld\n", (long)vw, (long)n);
 	switchnode(&vw->node, n);
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->x - vw->x) <= g->kind->bbmax &&
@@ -461,7 +461,7 @@ void chgvw(log_vwrec *vw, log_nrec *oldnode, log_nrec *n)
 		}
 		g = g->next;
 	}
-	hw = gg.hwbase[gg.curpage - 1];
+	hw = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw != NULL)
 	{
 		if (hw->x1 <= vw->x && vw->x <= hw->x2 && vw->y1 <= hw->y &&
@@ -471,7 +471,7 @@ void chgvw(log_vwrec *vw, log_nrec *oldnode, log_nrec *n)
 				chghw(hw, oldnode, n);
 			else
 			{
-				s = gg.sbase[gg.curpage - 1];
+				s = gg.pages[gg.curpage - 1]->sbase;
 				while (s != NULL && (s->x != vw->x || s->y != hw->y))
 					s = s->next;
 				if (s != NULL)
@@ -480,7 +480,7 @@ void chgvw(log_vwrec *vw, log_nrec *oldnode, log_nrec *n)
 		}
 		hw = hw->next;
 	}
-	vw1 = gg.vwbase[gg.curpage - 1];
+	vw1 = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw1 != NULL && vlsi)
 	{
 		if (vw->x == vw1->x && (vw->y1 == vw1->y2 || vw->y2 == vw1->y1) &&
@@ -532,7 +532,7 @@ void delhwire(log_hwrec *hw)
 	stamp(&oldnode->simtype->netstamp);
 	switchnode(&hw->node, NULL);
 	savenode = oldnode;
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL)
 	{
 		s1 = s->next;
@@ -554,7 +554,7 @@ void delhwire(log_hwrec *hw)
 		}
 		s = s1;
 	}
-	vw = gg.vwbase[gg.curpage - 1];
+	vw = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw != NULL)
 	{
 		if (hw->x1 <= vw->x && vw->x <= hw->x2 && vw->y1 <= hw->y &&
@@ -566,7 +566,7 @@ void delhwire(log_hwrec *hw)
 		}
 		vw = vw->next;
 	}
-	hw1 = gg.hwbase[gg.curpage - 1];
+	hw1 = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw1 != NULL && vlsi)
 	{
 		if (hw->y == hw1->y && (hw1->x1 == hw->x2 || hw1->x2 == hw->x1) &&
@@ -577,7 +577,7 @@ void delhwire(log_hwrec *hw)
 		}
 		hw1 = hw1->next;
 	}
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->y - hw->y) <= g->kind->bbmax &&
@@ -625,7 +625,7 @@ void delvwire(log_vwrec *vw)
 	stamp(&oldnode->simtype->netstamp);
 	switchnode(&vw->node, NULL);
 	savenode = oldnode;
-	s = gg.sbase[gg.curpage - 1];
+	s = gg.pages[gg.curpage - 1]->sbase;
 	while (s != NULL)
 	{
 		s1 = s->next;
@@ -646,7 +646,7 @@ void delvwire(log_vwrec *vw)
 		}
 		s = s1;
 	}
-	hw = gg.hwbase[gg.curpage - 1];
+	hw = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw != NULL)
 	{
 		if (hw->x1 <= vw->x && vw->x <= hw->x2 && vw->y1 <= hw->y &&
@@ -658,7 +658,7 @@ void delvwire(log_vwrec *vw)
 		}
 		hw = hw->next;
 	}
-	vw1 = gg.vwbase[gg.curpage - 1];
+	vw1 = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw1 != NULL && vlsi)
 	{
 		if (vw->x == vw1->x && (vw1->y1 == vw->y2 || vw1->y2 == vw->y1) &&
@@ -670,7 +670,7 @@ void delvwire(log_vwrec *vw)
 		}
 		vw1 = vw1->next;
 	}
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->x - vw->x) <= g->kind->bbmax &&
@@ -764,7 +764,7 @@ void addhwire(short x1, short x2, short y, short colr)
 	hw->y = y;
 	hw->wcolr = colr;
 	chpageplace((int)gg.curpage, x1, y, x2, y);
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->y - y) <= g->kind->bbmax &&
@@ -780,7 +780,7 @@ void addhwire(short x1, short x2, short y, short colr)
 		}
 		g = g->next;
 	}
-	vw1 = gg.vwbase[gg.curpage - 1];
+	vw1 = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw1 != NULL)
 	{
 		vx = vw1->x;
@@ -805,7 +805,7 @@ void addhwire(short x1, short x2, short y, short colr)
 		gg.nearhw = NULL;
 		goto _L1;   /*return*/
 	}
-	vw1 = gg.vwbase[gg.curpage - 1];
+	vw1 = gg.pages[gg.curpage - 1]->vwbase;
 	while (vw1 != NULL)
 	{
 		vx = vw1->x;
@@ -907,7 +907,7 @@ void addvwire(short x, short y1, short y2, short colr)
 	vw->x = x;
 	vw->wcolr = colr;
 	chpageplace((int)gg.curpage, x, y1, x, y2);
-	g = gg.gbase[gg.curpage - 1];
+	g = gg.pages[gg.curpage - 1]->gbase;
 	while (g != NULL)
 	{
 		if (abs(g->x - x) <= g->kind->bbmax &&
@@ -923,7 +923,7 @@ void addvwire(short x, short y1, short y2, short colr)
 		}
 		g = g->next;
 	}
-	hw1 = gg.hwbase[gg.curpage - 1];
+	hw1 = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw1 != NULL)
 	{
 		hy = hw1->y;
@@ -949,7 +949,7 @@ void addvwire(short x, short y1, short y2, short colr)
 		gg.nearvw = NULL;
 		goto _L1;   /*return*/
 	}
-	hw1 = gg.hwbase[gg.curpage - 1];
+	hw1 = gg.pages[gg.curpage - 1]->hwbase;
 	while (hw1 != NULL)
 	{
 		hy = hw1->y;