Purge debug target -- it spent most of its life broken.

In future, we can use the framebuffer frontend with a null output handler, which gives us effectively the same thing with less special-case stuff.

svn path=/trunk/netsurf/; revision=7107
This commit is contained in:
John Mark Bell 2009-04-16 23:10:37 +00:00
parent 0e0c6eb1ee
commit 5ae689a296
6 changed files with 4 additions and 553 deletions

View File

@ -91,11 +91,9 @@ RESOURCES =
ifneq ($(TARGET),riscos)
ifneq ($(TARGET),gtk)
ifneq ($(TARGET),beos)
ifneq ($(TARGET),debug)
ifneq ($(TARGET),amiga)
ifneq ($(TARGET),framebuffer)
$(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "debug" or "framebuffer")
endif
ifneq ($(TARGET),amiga)
ifneq ($(TARGET),framebuffer)
$(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", or "framebuffer")
endif
endif
endif
@ -159,7 +157,7 @@ else
PKG_CONFIG :=
#endif
else
# Building for GTK or debug
# Building for GTK, Amiga, or Framebuffer
PKG_CONFIG := pkg-config
endif
endif
@ -578,28 +576,6 @@ ifeq ($(TARGET),framebuffer)
endif
# ----------------------------------------------------------------------------
# Debug target setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),debug)
CFLAGS += -std=c99 -DDEBUG_BUILD \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
$(WARNFLAGS) -I. -g \
$(shell $(PKG_CONFIG) --cflags libnsgif-0 libnsbmp-0) \
$(shell xml2-config --cflags)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl)
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG rendering))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,RISC OS sprite rendering))
$(eval $(call pkg_config_find_and_add,HUBBUB,libhubbub-0,Hubbub HTML parser))
LDFLAGS += $(shell $(PKG_CONFIG) --libs libnsgif-0 libnsbmp-0)
endif
# ----------------------------------------------------------------------------
# General make rules
# ----------------------------------------------------------------------------

View File

@ -77,10 +77,6 @@ RDEP_BEOS := adblock.css beosdefault.css default.css ca-bundle.txt \
RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \
$(wildcard beos/res/throbber/throbber*.png)
# S_DEBUG are sources purely for the debug build
S_DEBUG := netsurfd.c debug_bitmap.c filetyped.c fontd.c
S_DEBUG := $(addprefix debug/,$(S_DEBUG))
# S_AMIGA are sources purely for the Amiga build
S_AMIGA := compat.c gui.c tree.c history.c hotlist.c schedule.c \
thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \
@ -194,11 +190,6 @@ SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_BEOS)
EXETARGET := NetSurf
endif
ifeq ($(TARGET),debug)
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_DEBUG)
EXETARGET := nsdebug
endif
ifeq ($(TARGET),amiga)
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_AMIGA) $(S_PDF)
EXETARGET := NetSurf

View File

@ -1,149 +0,0 @@
/*
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file
* Generic bitmap handling (dummy debug implementation).
*
* This implements the interface given by desktop/bitmap.h using a simple
* buffer.
*/
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include "image/bitmap.h"
struct bitmap {
int width;
unsigned char pixels[1];
};
/**
* Create a bitmap.
*
* \param width width of image in pixels
* \param height width of image in pixels
* \param state a flag word indicating the initial state
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
void *bitmap_create(int width, int height, unsigned int state)
{
struct bitmap *bitmap;
bitmap = calloc(sizeof *bitmap + width * height * 4, 1);
if (bitmap)
bitmap->width = width;
return bitmap;
}
/**
* Return a pointer to the pixel data in a bitmap.
*
* \param bitmap a bitmap, as returned by bitmap_create()
* \return pointer to the pixel buffer
*
* The pixel data is packed as BITMAP_FORMAT, possibly with padding at the end
* of rows. The width of a row in bytes is given by bitmap_get_rowstride().
*/
unsigned char *bitmap_get_buffer(void *vbitmap)
{
struct bitmap *bitmap = vbitmap;
assert(bitmap);
return bitmap->pixels;
}
/**
* Find the width of a pixel row in bytes.
*
* \param bitmap a bitmap, as returned by bitmap_create()
* \return width of a pixel row in the bitmap
*/
size_t bitmap_get_rowstride(void *vbitmap)
{
struct bitmap *bitmap = vbitmap;
assert(bitmap);
return bitmap->width * 4;
}
size_t bitmap_get_bpp(void *bitmap)
{
/* Bytes, not bits (ugh!) */
return 4;
}
/**
* Free a bitmap.
*
* \param bitmap a bitmap, as returned by bitmap_create()
*/
void bitmap_destroy(void *vbitmap)
{
struct bitmap *bitmap = vbitmap;
assert(bitmap);
free(bitmap);
}
/**
* Save a bitmap in the platform's native format.
*
* \param bitmap a bitmap, as returned by bitmap_create()
* \param path pathname for file
* \return true on success, false on error and error reported
*/
bool bitmap_save(void *bitmap, const char *path, unsigned flags)
{
return true;
}
/**
* The bitmap image has changed, so flush any persistant cache.
*
* \param bitmap a bitmap, as returned by bitmap_create()
*/
void bitmap_modified(void *bitmap)
{
}
/**
* The bitmap image can be suspended.
*
* \param bitmap a bitmap, as returned by bitmap_create()
* \param private_word a private word to be returned later
* \param suspend the function to be called upon suspension
* \param resume the function to be called when resuming
*/
void bitmap_set_suspendable(void *bitmap, void *private_word,
void (*invalidate)(void *bitmap, void *private_word))
{
}
bool bitmap_get_opaque(void *bitmap) { return false; }
bool bitmap_test_opaque(void *bitmap) { return false; }
void bitmap_set_opaque(void *bitmap, bool opaque) {}

View File

@ -1,55 +0,0 @@
/*
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include "content/fetch.h"
#include "utils/log.h"
#include "utils/utils.h"
/**
* filetype -- determine the MIME type of a local file
*/
const char *fetch_filetype(const char *unix_path)
{
int l;
LOG(("unix path %s", unix_path));
l = strlen(unix_path);
if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
return "text/css";
if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0)
return "image/jpeg";
if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0)
return "image/jpeg";
if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0)
return "image/gif";
if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0)
return "image/png";
if (2 < l && strcasecmp(unix_path + l - 3, "jng") == 0)
return "image/jng";
if (2 < l && strcasecmp(unix_path + l - 3, "svg") == 0)
return "image/svg";
return "text/html";
}
char *fetch_mimetype(const char *ro_path)
{
return strdup("text/plain");
}

View File

@ -1,82 +0,0 @@
/*
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include "css/css.h"
#include "render/font.h"
static bool nsfont_width(const struct css_style *style,
const char *string, size_t length, int *width);
static bool nsfont_position_in_string(const struct css_style *style,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x);
static bool nsfont_split(const struct css_style *style,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x);
const struct font_functions nsfont = {
nsfont_width,
nsfont_position_in_string,
nsfont_split
};
bool nsfont_width(const struct css_style *style,
const char *string, size_t length,
int *width)
{
assert(style);
assert(string);
*width = length * 10;
return true;
}
bool nsfont_position_in_string(const struct css_style *style,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
assert(style);
assert(string);
*char_offset = (x + 5) / 10;
if (length < *char_offset)
*char_offset = length;
*actual_x = *char_offset * 10;
return true;
}
bool nsfont_split(const struct css_style *style,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
assert(style);
assert(string);
*char_offset = x / 10;
if (length < *char_offset)
*char_offset = length;
while (*char_offset && string[*char_offset] != ' ')
(*char_offset)--;
*actual_x = *char_offset * 10;
return true;
}

View File

@ -1,230 +0,0 @@
/*
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "utils/config.h"
#include "content/fetch.h"
#include "content/content.h"
#include "content/fetchcache.h"
#include "content/urldb.h"
#include "desktop/cookies.h"
#include "desktop/gui.h"
#include "desktop/options.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
#include "desktop/tree.h"
#include "image/bitmap.h"
#include "render/box.h"
#include "riscos/save_complete.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
#include "utils/utils.h"
int done, destroyed;
bool verbose_log = true;
bool print_active = false;
void *hotlist_toolbar = NULL;
void *hotlist_window = NULL;
struct browser_window *current_redraw_browser = NULL;
struct gui_window *search_current_window = NULL;
#ifndef riscos
char *default_stylesheet_url;
char *adblock_stylesheet_url;
bool option_filter_sprites = false;
bool option_dither_sprites = false;
void *plot = 0;
#endif
#ifdef riscos
void *ro_gui_current_redraw_gui = 0;
const char *NETSURF_DIR = "<NetSurf$Dir>";
char *default_stylesheet_url = "file:///<NetSurf$Dir>/Resources/CSS";
char *adblock_stylesheet_url = "file:///<NetSurf$Dir>/Resources/AdBlock";
#endif
static void callback(content_msg msg, struct content *c, intptr_t p1,
intptr_t p2, union content_msg_data data);
int main(int argc, char *argv[])
{
char url[1000];
struct content *c;
#ifndef riscos
default_stylesheet_url = malloc(200);
adblock_stylesheet_url = malloc(200);
getcwd(url, sizeof url);
snprintf(default_stylesheet_url, 200, "file:%s/ns.css", url);
snprintf(adblock_stylesheet_url, 200, "file:%s/AdBlock", url);
#endif
fetch_init();
fetchcache_init();
url_init();
options_read("options");
messages_load("messages");
while (1) {
puts("=== URL:");
if (!fgets(url, 1000, stdin))
break;
url[strlen(url) - 1] = 0;
destroyed = 0;
c = fetchcache(url, callback, 0, 0, 1000, 1000, false,
0, 0, true, false);
if (c) {
fetchcache_go(c, 0, callback, 0, 0, 1000, 1000,
0, 0, true, 0);
done = c->status == CONTENT_STATUS_DONE;
while (!done) {
fetch_poll();
sleep(1);
}
puts("=== SUCCESS, dumping cache");
} else {
destroyed = 1;
puts("=== FAILURE, dumping cache");
}
if (!destroyed) {
/*while (1)
schedule_run();*/
/* content_reformat(c, 1, 1000); */
/* save_complete(c, "save_complete");*/
if (c->type == CONTENT_HTML)
box_dump(stderr, c->data.html.layout, 0);
else if (c->type == CONTENT_CSS)
css_dump_stylesheet(c->data.css.css);
else if (c->type == CONTENT_GIF)
gif_decode_frame(c->data.gif.gif, 0);
/*else if (c->type == CONTENT_MNG)
nsmng_animate(c);*/
content_remove_user(c, callback, 0, 0);
c = 0;
}
content_clean();
}
/* options_write("options"); */
fetch_quit();
return 0;
}
void callback(content_msg msg, struct content *c, intptr_t p1,
intptr_t p2, union content_msg_data data)
{
LOG(("content %s, message %i", c->url, msg));
if (msg == CONTENT_MSG_DONE)
done = 1;
else if (msg == CONTENT_MSG_ERROR) {
printf("=== ERROR: %s\n", data.error);
done = destroyed = 1;
} else if (msg == CONTENT_MSG_STATUS)
printf("=== STATUS: %s\n", c->status_message);
}
void gui_multitask(void)
{
/* putchar('-'); */
}
void die(const char *error)
{
printf("die: %s\n", error);
exit(1);
}
void warn_user(const char *warning, const char *detail)
{
printf("WARNING: %s %s\n", warning, detail);
}
#ifdef WITH_PLUGIN
void plugin_msg_parse(wimp_message *message, int ack) {}
bool plugin_create(struct content *c, const char *params[]) {return true;}
bool plugin_convert(struct content *c, int width, int height) {return true;}
void plugin_reformat(struct content *c, int width, int height) {}
void plugin_destroy(struct content *c) {}
bool plugin_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale, unsigned long background_colour) {return true;}
void plugin_open(struct content *c, struct browser_window *bw,
struct content *page, unsigned int index, struct box *box,
struct object_params *params) {}
void plugin_close(struct content *c) {}
bool plugin_handleable(const char *mime_type) {return false;}
#endif
void tree_initialise_redraw(struct tree *tree) {}
void tree_redraw_area(struct tree *tree, int x, int y, int width, int height) {}
void tree_draw_line(int x, int y, int width, int height) {}
void tree_draw_node_element(struct tree *tree, struct node_element *element) {}
void tree_draw_node_expansion(struct tree *tree, struct node *node) {}
void tree_recalculate_node_element(struct node_element *element) {}
void tree_update_URL_node(struct node *node, const char *url,
const struct url_data *data) {}
void tree_resized(struct tree *tree) {}
void tree_set_node_sprite_folder(struct node *node) {}
#ifndef riscos
void schedule(int t, void (*callback)(void *p), void *p) {}
void schedule_remove(void (*callback)(void *p), void *p) {}
bool schedule_run(void) { return false; }
#endif
bool selection_highlighted(struct selection *s, unsigned start, unsigned end,
unsigned *start_idx, unsigned *end_idx) { return false; }
bool gui_search_term_highlighted(struct gui_window *g,
unsigned start_offset, unsigned end_offset,
unsigned *start_idx, unsigned *end_idx) { return false; }
struct caret ghost_caret;
bool cookies_update(const char *domain, const struct cookie_data *data)
{ return true; }
char *url_to_path(const char *url)
{
return strdup(url + 5);
}
char *path_to_url(const char *path)
{
char *r = malloc(strlen(path) + 7 + 1);
strcpy(r, "file://");
strcat(r, path);
return r;
}
void tree_set_node_sprite(struct node *node, const char *sprite,
const char *expanded) { }