summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-02-04 09:34:32 +0000
committerJames Bursa <james@netsurf-browser.org>2003-02-04 09:34:32 +0000
commit948dfeb1c2404e6bdad8c20c83a26f3eecb3764a (patch)
tree85878dac3866b577adb99c3c2d51691f763914db
parent30c5f817ba74c51578c62bfd7a558e3c982c84fc (diff)
downloadnetsurf-948dfeb1c2404e6bdad8c20c83a26f3eecb3764a.tar.gz
netsurf-948dfeb1c2404e6bdad8c20c83a26f3eecb3764a.tar.bz2
[project @ 2003-02-04 09:34:32 by bursa]
Remove obsolete files. svn path=/import/netsurf/; revision=95
-rw-r--r--render/font.c75
-rw-r--r--render/font.h28
-rw-r--r--render/makefile34
-rw-r--r--render/render.c195
-rw-r--r--render/show.tcl19
-rw-r--r--riscos/netsurf.c221
6 files changed, 0 insertions, 572 deletions
diff --git a/render/font.c b/render/font.c
deleted file mode 100644
index b180ed5d8..000000000
--- a/render/font.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * $Id: font.c,v 1.4 2002/06/26 12:19:24 bursa Exp $
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "css.h"
-#include "font.h"
-
-/**
- * internal structures
- */
-
-struct font_set {
- /* a set of font handles */
- int stop_lcc_complaining;
-};
-
-/**
- * functions
- */
-
-struct font_set * font_set_create(void)
-{
- return 0;
-}
-
-font_id font_add(struct font_set * font_set, const char * name, unsigned int weight,
- unsigned int size)
-{
- return 0;
-}
-
-void font_set_free(struct font_set * font_set)
-{
-}
-
-/**
- * find where to split some text to fit it in width
- */
-
-struct font_split font_split(struct font_set * font_set, font_id id, const char * text,
- unsigned long width, int force)
-{
- size_t len = strlen(text);
- unsigned int i;
- struct font_split split;
-
- split.height = 30;
-
- if (len * 20 <= width) {
- split.width = len * 20;
- split.end = text + len;
- } else {
- for (i = width / 20; i != 0 && text[i] != ' '; i--)
- ;
- if (force && i == 0) {
- i = width / 20;
- if (i == 0) i = 1;
- }
- split.width = i * 20;
- if (text[i] == ' ') i++;
- split.end = text + i;
- }
-
- return split;
-}
-
-unsigned long font_width(struct css_style * style, const char * text, unsigned int length)
-{
- return length * 7;
-}
-
diff --git a/render/font.h b/render/font.h
deleted file mode 100644
index 2ab98aaef..000000000
--- a/render/font.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * $Id: font.h,v 1.3 2002/06/18 21:24:21 bursa Exp $
- */
-
-/**
- * structures and typedefs
- */
-
-struct font_set;
-typedef unsigned int font_id;
-struct font_split {
- unsigned long width;
- unsigned long height;
- const char * end;
-};
-
-/**
- * interface
- */
-
-struct font_set * font_set_create(void);
-font_id font_add(struct font_set * font_set, const char * name, unsigned int weight,
- unsigned int size);
-void font_set_free(struct font_set * font_set);
-struct font_split font_split(struct font_set * font_set, font_id id, const char * text,
- unsigned long width, int force);
-unsigned long font_width(struct css_style * style, const char * text, unsigned int length);
-
diff --git a/render/makefile b/render/makefile
deleted file mode 100644
index de061e678..000000000
--- a/render/makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id: makefile,v 1.3 2002/05/04 19:57:18 bursa Exp $
-
-FLAGS = -g -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \
--Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes \
--Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -std=c9x `xml2-config --cflags`
-CC = gcc
-
-render: render.o utils.o css.o css_enum.o font.o box.o layout.o
- $(CC) $(FLAGS) -o render render.o utils.o css.o css_enum.o font.o box.o layout.o `xml2-config --libs`
-
-render.o: render.c css.h css_enum.h utils.h font.h box.h layout.h
- $(CC) $(FLAGS) -c render.c
-
-css.o: css.c css.h css_enum.h utils.h
- $(CC) $(FLAGS) -c css.c
-
-utils.o: utils.c utils.h
- $(CC) $(FLAGS) -c utils.c
-
-font.o: font.c font.h
- $(CC) $(FLAGS) -c font.c
-
-css_enum.o: css_enum.c css_enum.h
- $(CC) $(FLAGS) -c css_enum.c
-
-css_enum.c css_enum.h: css_enums makeenum
- ./makeenum css_enum < css_enums
-
-box.o: box.c box.h font.h css.h utils.h
- $(CC) $(FLAGS) -c box.c
-
-layout.o: layout.c layout.h font.h css.h utils.h box.h
- $(CC) $(FLAGS) -c layout.c
-
diff --git a/render/render.c b/render/render.c
deleted file mode 100644
index 6105593a2..000000000
--- a/render/render.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * $Id: render.c,v 1.17 2002/06/28 20:14:04 bursa Exp $
- */
-
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "libxml/HTMLparser.h"
-#include "css.h"
-#include "utils.h"
-#include "font.h"
-#include "box.h"
-#include "layout.h"
-
-/**
- * internal functions
- */
-
-void render_plain_element(char * g, struct box * box, unsigned long x, unsigned long y);
-void render_plain(struct box * box);
-void render_dump(struct box * box, unsigned long x, unsigned long y);
-
-
-/**
- * render to a character grid
- */
-
-void render_plain_element(char * g, struct box * box, unsigned long x, unsigned long y)
-{
- unsigned long i;
- unsigned int l;
- struct box * c;
- const char vline = box->type == BOX_INLINE_CONTAINER ? ':' : '|';
- const char hline = box->type == BOX_INLINE_CONTAINER ? '·' : '-';
-
- for (i = (y + box->y) + 1; i < (y + box->y + box->height); i++) {
- g[80 * i + (x + box->x)] = vline;
- g[80 * i + (x + box->x + box->width)] = vline;
- }
- for (i = (x + box->x); i <= (x + box->x + box->width); i++) {
- g[80 * (y + box->y) + i] = hline;
- g[80 * (y + box->y + box->height) + i] = hline;
- }
-
- switch (box->type) {
- case BOX_TABLE:
- case BOX_TABLE_ROW:
- case BOX_TABLE_CELL:
- case BOX_BLOCK: strncpy(g + 80 * (y + box->y) + x + box->x,
- (const char *) box->node->name,
- strlen((const char *) box->node->name));
- break;
- case BOX_INLINE: strncpy(g + 80 * (y + box->y) + x + box->x,
- (const char *) box->node->parent->name,
- strlen((const char *) box->node->parent->name));
- break;
- case BOX_INLINE_CONTAINER:
- default:
- break;
- }
-
- if (box->type == BOX_INLINE && box->node->content) {
- l = strlen(box->text);
- if ((x + box->x + box->width) - (x + box->x) - 1 < l)
- l = (x + box->x + box->width) - (x + box->x) - 1;
- strncpy(g + 80 * ((y + box->y) + 1) + (x + box->x) + 1, box->text, l);
- }
-
- for (c = box->children; c != 0; c = c->next)
- render_plain_element(g, c, x + box->x, y + box->y);
-}
-
-
-void render_plain(struct box * box)
-{
- int i;
- char *g;
-
- g = calloc(100000, 1);
- if (g == 0) exit(1);
-
- for (i = 0; i < 10000; i++)
- g[i] = ' ';
-
- render_plain_element(g, box, 0, 0);
-
- for (i = 0; i < 100; i++)
- printf("%.80s\n", g + (80 * i));
-}
-
-
-void render_dump(struct box * box, unsigned long x, unsigned long y)
-{
- struct box * c;
- const char * const noname = "";
- const char * name = noname;
-
- switch (box->type) {
- case BOX_TABLE:
- case BOX_TABLE_ROW:
- case BOX_TABLE_CELL:
- case BOX_FLOAT_LEFT:
- case BOX_FLOAT_RIGHT:
- case BOX_BLOCK: if (box->node) name = (const char *) box->node->name;
- break;
- case BOX_INLINE:
- case BOX_INLINE_CONTAINER:
- default:
- break;
- }
-
- printf("rect %li %li %li %li \"%s\" \"", x + box->x, y + box->y,
- box->width, box->height, name);
- if (box->type == BOX_INLINE) {
- unsigned int i;
- for (i = 0; i < box->length; i++) {
- if (box->text[i] == '"')
- printf("\\\"");
- else if (box->text[i] == '[')
- printf("\\[");
- else if (box->text[i] == '$')
- printf("\\$");
- else
- printf("%c", box->text[i]);
- }
- }
-
- if (name == noname)
- printf("\" \"\"\n");
- else
- printf("\" #%.6x\n", 0xffffff - ((name[0] << 16) | (name[1] << 8) | name[0]));
- fflush(stdout);
-
- for (c = box->children; c != 0; c = c->next)
- if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
- render_dump(c, x + box->x, y + box->y);
-
- for (c = box->float_children; c != 0; c = c->next_float)
- render_dump(c, x + box->x, y + box->y);
-}
-
-
-int main(int argc, char *argv[])
-{
- struct css_stylesheet * stylesheet;
- struct css_style * style = xcalloc(1, sizeof(struct css_style));
- struct css_selector * selector = xcalloc(1, sizeof(struct css_selector));
- xmlNode * c;
- xmlDoc * doc;
- struct box * doc_box = xcalloc(1, sizeof(struct box));
- struct box * html_box;
- char * f;
-
- if (argc < 3) die("usage: render htmlfile cssfile");
-
- fprintf(stderr, "Parsing html...\n");
- doc = htmlParseFile(argv[1], 0);
- if (doc == 0) die("htmlParseFile failed");
-
- for (c = doc->children; c != 0 && c->type != XML_ELEMENT_NODE; c = c->next)
- ;
- if (c == 0) die("no element in document");
- if (strcmp((const char *) c->name, "html")) die("document is not html");
-
- fprintf(stderr, "Parsing css...\n");
- f = load(argv[2]);
- stylesheet = css_new_stylesheet();
- css_parse_stylesheet(stylesheet, f);
-/* css_dump_stylesheet(stylesheet);*/
-
- memcpy(style, &css_base_style, sizeof(struct css_style));
- doc_box->type = BOX_BLOCK;
- doc_box->node = c;
- fprintf(stderr, "XML tree to box tree...\n");
- xml_to_box(c, style, stylesheet, &selector, 0, doc_box, 0);
- html_box = doc_box->children;
- box_dump(html_box, 0);
-
- fprintf(stderr, "Layout document...\n");
- layout_document(html_box, 600);
- box_dump(html_box, 0);
-/* render_plain(html_box);*/
-
- fprintf(stderr, "Rendering...\n");
- printf("%li %li\n", html_box->width, html_box->height);
- render_dump(html_box, 0, 0);
-
- return 0;
-}
-
-
-/******************************************************************************/
-
diff --git a/render/show.tcl b/render/show.tcl
deleted file mode 100644
index 2688c6cc8..000000000
--- a/render/show.tcl
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/wish
-
-gets stdin size
-scan $size "%i %i" x y
-canvas .can -width [expr $x+16] -height [expr $y+16] -borderwidth 0 -highlightthickness 0 -bg white
-pack .can
-
-proc rect {x y w h n t c} {
- set x [expr $x+8]
- set y [expr $y+8]
- .can create rectangle $x $y [expr $x+$w] [expr $y+$h] -fill $c
- .can create text $x $y -anchor nw -text $n -fill red -font "arial 18 bold"
- .can create text $x [expr $y+$h] -anchor sw -text $t -font "courier 12"
-}
-
-while {-1 != [gets stdin line]} {
- eval $line
-}
-
diff --git a/riscos/netsurf.c b/riscos/netsurf.c
deleted file mode 100644
index 019cce674..000000000
--- a/riscos/netsurf.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/**
- * $Id: netsurf.c,v 1.1 2002/07/27 21:10:45 bursa Exp $
- */
-
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "libxml/HTMLparser.h"
-#include "netsurf/render/css.h"
-#include "netsurf/render/box.h"
-#include "netsurf/render/font.h"
-#include "netsurf/render/layout.h"
-#include "netsurf/render/utils.h"
-#include "oslib/colourtrans.h"
-#include "oslib/font.h"
-#include "oslib/wimp.h"
-#include "curl/curl.h"
-
-font_f font;
-
-void redraw(struct box * box, signed long x, signed long y)
-{
- struct box * c;
- const char * const noname = "";
- const char * name = noname;
-
- switch (box->type) {
- case BOX_TABLE:
- case BOX_TABLE_ROW:
- case BOX_TABLE_CELL:
- case BOX_FLOAT_LEFT:
- case BOX_FLOAT_RIGHT:
- case BOX_BLOCK: if (box->node) name = (const char *) box->node->name;
- break;
- case BOX_INLINE:
- case BOX_INLINE_CONTAINER:
- default:
- break;
- }
-
-/* fprintf(stderr, "redraw: <%s> %li %li\n", name, x, y); */
-
- colourtrans_set_gcol(os_COLOUR_CYAN, 0, os_ACTION_OVERWRITE, 0);
- os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2);
- os_plot(os_PLOT_SOLID | os_PLOT_BY, box->width * 2, 0);
- os_plot(os_PLOT_SOLID | os_PLOT_BY, 0, -box->height * 2);
- os_plot(os_PLOT_SOLID | os_PLOT_BY, -box->width * 2, 0);
- os_plot(os_PLOT_SOLID | os_PLOT_BY, 0, box->height * 2);
-
- if (box->type == BOX_INLINE) {
- font_paint(font, box->text,
- font_OS_UNITS | font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN,
- x + box->x * 2, y - box->y * 2 - box->height * 2,
- 0, 0,
- box->length);
-
-/* colourtrans_set_gcol(os_COLOUR_BLACK, 0, os_ACTION_OVERWRITE, 0);
- os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2);
- os_writen(box->text, box->length);*/
-/* } else if (box->type != BOX_INLINE_CONTAINER) { */
-/* colourtrans_set_gcol((0xffffff - ((name[0] << 16) | (name[1] << 8) |
- name[0])) << 8,
- 0, os_ACTION_OVERWRITE, 0);*/
-/*
- colourtrans_set_gcol(os_COLOUR_RED, 0, os_ACTION_OVERWRITE, 0);
- os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2);
- os_write0(name);*/
- }
-
- for (c = box->children; c != 0; c = c->next)
- if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
- redraw(c, x + box->x * 2, y - box->y * 2);
-
- for (c = box->float_children; c != 0; c = c->next_float)
- redraw(c, x + box->x * 2, y - box->y * 2);
-}
-
-
-
-void render_window(struct box * box)
-{
- wimp_t task;
- wimp_window window = {
- { 0, 0, 1200, 2000 },
- 0, 0,
- wimp_TOP,
- wimp_WINDOW_MOVEABLE | wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_BACK_ICON |
- wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON | wimp_WINDOW_VSCROLL |
- wimp_WINDOW_SIZE_ICON | wimp_WINDOW_TOGGLE_ICON,
- wimp_COLOUR_BLACK, wimp_COLOUR_LIGHT_GREY,
- wimp_COLOUR_BLACK, wimp_COLOUR_WHITE,
- wimp_COLOUR_DARK_GREY, wimp_COLOUR_MID_LIGHT_GREY,
- wimp_COLOUR_CREAM,
- 0,
- { 0, -2000, 1200, 0 },
- wimp_ICON_TEXT, 0,
- 0,
- 0, 0,
- { "NetSurf" },
- 0
- };
- wimp_w w;
- wimp_window_state state;
- wimp_block block;
-
- task = wimp_initialise(wimp_VERSION_RO3, "NetSurf", 0, 0);
- window.extent.x1 = box->width * 2;
- window.extent.y0 = -box->height * 2;
- w = wimp_create_window(&window);
- state.w = w;
- wimp_get_window_state(&state);
- wimp_open_window((wimp_open *) &state);
-
- while (1) {
- wimp_event_no event = wimp_poll(wimp_MASK_NULL, &block, 0);
- osbool more;
- switch (event) {
- case wimp_REDRAW_WINDOW_REQUEST:
- more = wimp_redraw_window(&block.redraw);
- wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_BLACK);
- while (more) {
- redraw(box, block.redraw.box.x0 - block.redraw.xscroll,
- block.redraw.box.y1 - block.redraw.yscroll);
- more = wimp_get_rectangle(&block.redraw);
- }
- break;
- case wimp_OPEN_WINDOW_REQUEST:
- wimp_open_window(&block.open);
- break;
- case wimp_CLOSE_WINDOW_REQUEST:
- wimp_close_down(task);
- return;
- }
- }
-}
-
-
-
-size_t write_data(void * data, size_t size, size_t nmemb, htmlParserCtxt * parser_context)
-{
- fprintf(stderr, "%i\n", size * nmemb);
- htmlParseChunk(parser_context, data, size * nmemb, 0);
- return size * nmemb;
-}
-
-
-
-int main(int argc, char *argv[])
-{
- struct css_stylesheet * stylesheet;
- struct css_style * style = xcalloc(1, sizeof(struct css_style));
- struct css_selector * selector = xcalloc(1, sizeof(struct css_selector));
- xmlNode * c;
- xmlDoc * doc;
- struct box * doc_box = xcalloc(1, sizeof(struct box));
- struct box * html_box;
- char * f;
- CURL * curl;
- htmlParserCtxt * parser_context;
-
- if (argc < 3) die("usage: render htmlfile cssfile");
-
- parser_context = htmlCreatePushParserCtxt(0, 0, "", 0, argv[1],
- XML_CHAR_ENCODING_8859_1);
- if (parser_context == 0) die("htmlCreatePushParserCtxt failed");
-
- fprintf(stderr, "Fetching %s...\n", argv[1]);
- curl = curl_easy_init();
- if (curl == 0) die("curl_easy_init failed");
- curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, parser_context);
- curl_easy_perform(curl);
- curl_easy_cleanup(curl);
-
- htmlParseChunk(parser_context, "", 0, 1);
- doc = parser_context->myDoc;
-
-/* fprintf(stderr, "Parsing html...\n");
- doc = htmlParseFile(argv[1], 0);
- if (doc == 0) die("htmlParseFile failed");*/
-
- for (c = doc->children; c != 0 && c->type != XML_ELEMENT_NODE; c = c->next)
- ;
- if (c == 0) die("no element in document");
- if (strcmp((const char *) c->name, "html")) die("document is not html");
-
- fprintf(stderr, "Parsing css...\n");
- f = load(argv[2]);
- stylesheet = css_new_stylesheet();
- css_parse_stylesheet(stylesheet, f);
-/* css_dump_stylesheet(stylesheet);*/
-
- font = font_find_font("Homerton.Medium", 192, 192, 0, 0, 0, 0);
-
- memcpy(style, &css_base_style, sizeof(struct css_style));
- doc_box->type = BOX_BLOCK;
- doc_box->node = c;
- fprintf(stderr, "XML tree to box tree...\n");
- xml_to_box(c, style, stylesheet, &selector, 0, doc_box, 0);
- html_box = doc_box->children;
- box_dump(html_box, 0);
-
- fprintf(stderr, "Layout document...\n");
- layout_document(html_box, 600);
- box_dump(html_box, 0);
-/* render_plain(html_box);*/
-
- fprintf(stderr, "Rendering...\n");
- render_window(html_box);
-
- font_lose_font(font);
-
- return 0;
-}
-
-
-/******************************************************************************/
-