about summary refs log tree commit diff stats
path: root/src/DefaultStyle.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-02-27 19:00:00 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-02-27 19:00:00 -0500
commit86b4d41a7463bd35cf662fc748aa338caef609c9 (patch)
treedb4ba2deed8edca7df91182c0253ee93248c7382 /src/DefaultStyle.c
parent899516a7c8880df05e30bbbed72ca1d3cb7a4f00 (diff)
downloadlynx-snapshots-86b4d41a7463bd35cf662fc748aa338caef609c9.tar.gz
snapshot of project "lynx", label v2-7-1ac-0_117
Diffstat (limited to 'src/DefaultStyle.c')
-rw-r--r--src/DefaultStyle.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c
index 140f0a77..7299ede1 100644
--- a/src/DefaultStyle.c
+++ b/src/DefaultStyle.c
@@ -12,7 +12,7 @@
 
 /*	Tab arrays:
 */
-PRIVATE HTTabStop tabs_8[] = {
+PRIVATE CONST HTTabStop tabs_8[] = {
 	{ 0, 8 }, {0, 16}, {0, 24}, {0, 32}, {0, 40},
 	{ 0, 48 }, {0, 56}, {0, 64}, {0, 72}, {0, 80},
 	{ 0, 88 }, {0, 96}, {0, 104}, {0, 112}, {0, 120},
@@ -364,5 +364,38 @@ PRIVATE HTStyle HTStyleHeadingRight = {
 PRIVATE HTStyleSheet sheet = { "default.style",
 				&HTStyleHeadingRight }; /* sheet */
 
-PUBLIC HTStyleSheet * styleSheet = &sheet;
- 
+PUBLIC HTStyleSheet * DefaultStyle NOARGS
+{
+    static HTStyleSheet *result;
+    HTStyle *p, *q;
+
+    /*
+     * The first time we're called, allocate a copy of the 'sheet' linked
+     * list.  Thereafter, simply copy the data from 'sheet' into our copy
+     * (preserving the copy's linked-list pointers).  We do this to reset the
+     * parameters of a style that might be altered while processing a page.
+     */
+    if (result == 0) {	/* allocate & copy */
+    	result = HTStyleSheetNew ();
+	*result = sheet;
+	result->styles = 0;
+	for (p = sheet.styles; p != 0; p = p->next) {
+	    q = HTStyleNew ();
+	    *q = *p;
+	    q->next = result->styles;
+	    result->styles = q;
+	}
+    } else {		/* recopy the data */
+    	for (p = result->styles, q = sheet.styles;
+		p != 0 && q != 0;
+		p = p->next, q = q->next) {
+    	    HTStyle *r = p->next;
+	    HTStyle temp;
+	    temp = *p;
+	    temp.next = q->next;
+	    *p = *q;
+	    p->next = r;
+	}
+    }
+    return result;
+}