From 62245d13ec60e3c0fc78221f0a8f754f33c2b6a1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 5 Jan 2004 02:10:59 +0000 Subject: [project @ 2004-01-05 02:10:59 by jmb] Add ability to turn off browser features in build. This may be useful when hunting down bugs. svn path=/import/netsurf/; revision=480 --- content/content.c | 39 +++++++++++++++++++++++++++++++ content/content.h | 39 +++++++++++++++++++++++++++++++ content/fetch.c | 27 ++++++++++++++++++++- content/fetch.h | 20 +++++++++++++--- content/fetchcache.c | 17 ++++++++++---- content/fetchcache.h | 7 +++++- css/css.c | 19 ++++++++++++--- debug/netsurfd.c | 15 +++++++++++- desktop/401login.h | 5 ++++ desktop/browser.c | 65 ++++++++++++++++++++++++++++++++++++++++----------- desktop/browser.h | 16 ++++++++++--- desktop/loginlist.c | 5 ++++ desktop/netsurf.c | 7 ++++++ render/box.c | 22 ++++++++++++++++- render/box.h | 6 +++++ render/html.c | 45 ++++++++++++++++++++++++++++------- riscos/401login.c | 5 ++++ riscos/about.c | 6 +++++ riscos/about.h | 6 +++++ riscos/constdata.c | 6 +++++ riscos/constdata.h | 6 +++++ riscos/dialog.c | 24 +++++++++++++++---- riscos/draw.c | 3 +++ riscos/filetype.c | 13 +++++++++++ riscos/frames.c | 4 ++++ riscos/frames.h | 4 ++++ riscos/gif.c | 4 ++++ riscos/gui.c | 63 ++++++++++++++++++++++++++++++++++++++++++------- riscos/gui.h | 3 +++ riscos/htmlinstance.c | 19 ++++++++++----- riscos/jpeg.c | 5 ++-- riscos/plugin.c | 10 +++++++- riscos/png.c | 4 +++- riscos/sprite.c | 4 ++++ riscos/uri.c | 10 +++++++- riscos/url.c | 7 +++++- riscos/window.c | 13 ++++++++--- utils/config.h | 44 ++++++++++++++++++++++++++++++++++ utils/utils.c | 11 +++++++-- 39 files changed, 560 insertions(+), 68 deletions(-) create mode 100644 utils/config.h diff --git a/content/content.c b/content/content.c index a3ff9f777..91481ff48 100644 --- a/content/content.c +++ b/content/content.c @@ -15,19 +15,32 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/content/other.h" #include "netsurf/css/css.h" #include "netsurf/render/html.h" #include "netsurf/render/textplain.h" #ifdef riscos +#ifdef WITH_JPEG #include "netsurf/riscos/jpeg.h" +#endif +#ifdef WITH_PNG #include "netsurf/riscos/png.h" +#endif +#ifdef WITH_GIF #include "netsurf/riscos/gif.h" +#endif +#ifdef WITH_SPRITE #include "netsurf/riscos/sprite.h" +#endif +#ifdef WITH_DRAW #include "netsurf/riscos/draw.h" +#endif +#ifdef WITH_PLUGIN #include "netsurf/riscos/plugin.h" #endif +#endif #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" @@ -40,14 +53,26 @@ struct mime_entry { /** A map from MIME type to ::content_type. Must be sorted by mime_type. */ static const struct mime_entry mime_map[] = { #ifdef riscos +#ifdef WITH_DRAW {"application/drawfile", CONTENT_DRAW}, {"application/x-drawfile", CONTENT_DRAW}, {"image/drawfile", CONTENT_DRAW}, +#endif +#ifdef WITH_GIF {"image/gif", CONTENT_GIF}, +#endif +#ifdef WITH_JPEG {"image/jpeg", CONTENT_JPEG}, +#endif +#ifdef WITH_PNG {"image/png", CONTENT_PNG}, +#endif +#ifdef WITH_DRAW {"image/x-drawfile", CONTENT_DRAW}, +#endif +#ifdef WITH_SPRITE {"image/x-riscos-sprite", CONTENT_SPRITE}, +#endif #endif {"text/css", CONTENT_CSS}, {"text/html", CONTENT_HTML}, @@ -85,24 +110,36 @@ static const struct handler_entry handler_map[] = { {textplain_create, textplain_process_data, textplain_convert, textplain_revive, textplain_reformat, textplain_destroy, 0, 0, 0, 0}, #ifdef riscos +#ifdef WITH_JPEG {jpeg_create, jpeg_process_data, jpeg_convert, jpeg_revive, jpeg_reformat, jpeg_destroy, jpeg_redraw, 0, 0, 0}, +#endif #endif {css_create, css_process_data, css_convert, css_revive, css_reformat, css_destroy, 0, 0, 0, 0}, #ifdef riscos +#ifdef WITH_PNG {nspng_create, nspng_process_data, nspng_convert, nspng_revive, nspng_reformat, nspng_destroy, nspng_redraw, 0, 0, 0}, +#endif +#ifdef WITH_GIF {nsgif_create, nsgif_process_data, nsgif_convert, nsgif_revive, nsgif_reformat, nsgif_destroy, nsgif_redraw, 0, 0, 0}, +#endif +#ifdef WITH_SPRITE {sprite_create, sprite_process_data, sprite_convert, sprite_revive, sprite_reformat, sprite_destroy, sprite_redraw, 0, 0, 0}, +#endif +#ifdef WITH_DRAW {draw_create, draw_process_data, draw_convert, draw_revive, draw_reformat, draw_destroy, draw_redraw, 0, 0, 0}, +#endif +#ifdef WITH_PLUGIN {plugin_create, plugin_process_data, plugin_convert, plugin_revive, plugin_reformat, plugin_destroy, plugin_redraw, plugin_add_instance, plugin_remove_instance, plugin_reshape_instance}, +#endif #endif {other_create, other_process_data, other_convert, other_revive, other_reformat, other_destroy, 0, 0, 0, 0} @@ -123,8 +160,10 @@ content_type content_lookup(const char *mime_type) (int (*)(const void *, const void *)) strcmp); if (m == 0) { #ifdef riscos +#ifdef WITH_PLUGIN if (plugin_handleable(mime_type)) return CONTENT_PLUGIN; +#endif #endif return CONTENT_OTHER; } diff --git a/content/content.h b/content/content.h index 2e4a36f31..ffd73ab06 100644 --- a/content/content.h +++ b/content/content.h @@ -26,6 +26,7 @@ #define _NETSURF_DESKTOP_CONTENT_H_ #include "libxml/HTMLparser.h" +#include "netsurf/utils/config.h" #include "netsurf/content/cache.h" #include "netsurf/content/fetch.h" #include "netsurf/content/other.h" @@ -34,13 +35,25 @@ #include "netsurf/render/font.h" #include "netsurf/render/html.h" #ifdef riscos +#ifdef WITH_GIF #include "netsurf/riscos/gif.h" +#endif +#ifdef WITH_JPEG #include "netsurf/riscos/jpeg.h" +#endif +#ifdef WITH_PLUGIN #include "netsurf/riscos/plugin.h" +#endif +#ifdef WITH_PNG #include "netsurf/riscos/png.h" +#endif +#ifdef WITH_SPRITE #include "netsurf/riscos/sprite.h" +#endif +#ifdef WITH_DRAW #include "netsurf/riscos/draw.h" #endif +#endif /** The type of a content. */ @@ -48,15 +61,27 @@ typedef enum { CONTENT_HTML, CONTENT_TEXTPLAIN, #ifdef riscos +#ifdef WITH_JPEG CONTENT_JPEG, +#endif #endif CONTENT_CSS, #ifdef riscos +#ifdef WITH_PNG CONTENT_PNG, +#endif +#ifdef WITH_GIF CONTENT_GIF, +#endif +#ifdef WITH_SPRITE CONTENT_SPRITE, +#endif +#ifdef WITH_DRAW CONTENT_DRAW, +#endif +#ifdef WITH_PLUGIN CONTENT_PLUGIN, +#endif #endif CONTENT_OTHER, CONTENT_UNKNOWN /**< content-type not received yet */ @@ -72,7 +97,9 @@ typedef enum { CONTENT_MSG_STATUS, /**< new status string */ CONTENT_MSG_REDIRECT, /**< replacement URL */ CONTENT_MSG_REFORMAT, /**< content_reformat done */ +#ifdef WITH_AUTH CONTENT_MSG_AUTH /**< authentication required */ +#endif } content_msg; /** Linked list of users of a content. */ @@ -108,12 +135,24 @@ struct content { struct content_html_data html; struct content_css_data css; #ifdef riscos +#ifdef WITH_JPEG struct content_jpeg_data jpeg; +#endif +#ifdef WITH_PNG struct content_png_data png; +#endif +#ifdef WITH_GIF struct content_gif_data gif; +#endif +#ifdef WITH_SPRITE struct content_sprite_data sprite; +#endif +#ifdef WITH_DRAW struct content_draw_data draw; +#endif +#ifdef WITH_PLUGIN struct content_plugin_data plugin; +#endif #endif struct content_other_data other; } data; diff --git a/content/fetch.c b/content/fetch.c index 4df9d546b..87dbe79f5 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -27,12 +27,15 @@ #include #include "curl/curl.h" #include "libxml/uri.h" +#include "netsurf/utils/config.h" #include "netsurf/content/fetch.h" #ifdef riscos #include "netsurf/desktop/gui.h" #endif #include "netsurf/desktop/options.h" +#ifdef WITH_AUTH #include "netsurf/desktop/401login.h" +#endif #include "netsurf/render/form.h" #include "netsurf/utils/log.h" #include "netsurf/utils/messages.h" @@ -58,7 +61,9 @@ struct fetch { char *host; /**< Host part of URL. */ char *location; /**< Response Location header, or 0. */ unsigned long content_length; /**< Response Content-Length, or 0. */ +#ifdef WITH_AUTH char *realm; /**< HTTP Auth Realm */ +#endif char *post_urlenc; /**< Url encoded POST string, or 0. */ struct HttpPost *post_multipart; /**< Multipart post data, or 0. */ struct fetch *queue_prev; /**< Previous fetch for this host. */ @@ -151,13 +156,19 @@ void fetch_quit(void) struct fetch * fetch_start(char *url, char *referer, void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size), void *p, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart, bool cookies) + struct form_successful_control *post_multipart +#ifdef WITH_COOKIES + , bool cookies +#endif + ) { struct fetch *fetch = xcalloc(1, sizeof(*fetch)), *host_fetch; CURLcode code; CURLMcode codem; xmlURI *uri; +#ifdef WITH_AUTH struct login *li; +#endif LOG(("fetch %p, url '%s'", fetch, url)); @@ -278,6 +289,7 @@ struct fetch * fetch_start(char *url, char *referer, } /* HTTP auth */ +#ifdef WITH_AUTH if ((li=login_list_get(url)) != NULL) { code = curl_easy_setopt(fetch->curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); assert(code == CURLE_OK); @@ -286,6 +298,7 @@ struct fetch * fetch_start(char *url, char *referer, assert(code == CURLE_OK); } +#endif /* POST */ if (fetch->post_urlenc) { @@ -299,6 +312,7 @@ struct fetch * fetch_start(char *url, char *referer, } /* Cookies */ +#ifdef WITH_COOKIES if (cookies) { code = curl_easy_setopt(fetch->curl_handle, CURLOPT_COOKIEFILE, messages_get("cookiefile")); @@ -307,6 +321,7 @@ struct fetch * fetch_start(char *url, char *referer, messages_get("cookiejar")); assert(code == CURLE_OK); } +#endif /* add to the global curl multi handle */ codem = curl_multi_add_handle(curl_multi, fetch->curl_handle); @@ -323,7 +338,9 @@ struct fetch * fetch_start(char *url, char *referer, void fetch_abort(struct fetch *f) { CURLMcode codem; +#ifdef WITH_AUTH struct login *li; +#endif assert(f != 0); LOG(("fetch %p, url '%s'", f, f->url)); @@ -381,6 +398,7 @@ void fetch_abort(struct fetch *f) } /* HTTP auth */ +#ifdef WITH_AUTH if ((li=login_list_get(f->url)) != NULL) { code = curl_easy_setopt(fetch->curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); assert(code == CURLE_OK); @@ -389,6 +407,7 @@ void fetch_abort(struct fetch *f) assert(code == CURLE_OK); } +#endif /* POST */ if (fetch->post_urlenc) { @@ -425,7 +444,9 @@ void fetch_abort(struct fetch *f) free(f->host); free(f->referer); free(f->location); +#ifdef WITH_AUTH free(f->realm); +#endif free(f->post_urlenc); if (f->post_multipart) curl_formfree(f->post_multipart); @@ -552,12 +573,14 @@ size_t fetch_curl_header(char * data, size_t size, size_t nmemb, struct fetch *f ; if ('0' <= data[i] && data[i] <= '9') f->content_length = atol(data + i); +#ifdef WITH_AUTH } else if (16 < size && strncasecmp(data, "WWW-Authenticate",16) == 0) { /* extract Realm from WWW-Authenticate header */ f->realm = xcalloc(size, 1); for (i=16;(unsigned int)i!=strlen(data);i++) if(data[i]=='=')break; strncpy(f->realm, data+i+2, size-i-5); +#endif } return size; } @@ -589,10 +612,12 @@ bool fetch_process_headers(struct fetch *f) } /* handle HTTP 401 (Authentication errors) */ +#ifdef WITH_AUTH if (http_code == 401) { f->callback(FETCH_AUTH, f->p, f->realm,0); return true; } +#endif /* handle HTTP errors (non 2xx response codes) */ if (f->only_2xx && strncmp(f->url, "http", 4) == 0 && diff --git a/content/fetch.h b/content/fetch.h index 159921610..5075f6058 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -13,8 +13,18 @@ #define _NETSURF_DESKTOP_FETCH_H_ #include - -typedef enum {FETCH_TYPE, FETCH_DATA, FETCH_FINISHED, FETCH_ERROR, FETCH_REDIRECT, FETCH_AUTH} fetch_msg; +#include "netsurf/utils/config.h" + +typedef enum { + FETCH_TYPE, + FETCH_DATA, + FETCH_FINISHED, + FETCH_ERROR, + FETCH_REDIRECT, +#ifdef WITH_AUTH + FETCH_AUTH +#endif +} fetch_msg; struct content; struct fetch; @@ -26,7 +36,11 @@ void fetch_init(void); struct fetch * fetch_start(char *url, char *referer, void (*callback)(fetch_msg msg, void *p, char *data, unsigned long size), void *p, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart, bool cookies); + struct form_successful_control *post_multipart +#ifdef WITH_COOKIES + ,bool cookies +#endif + ); void fetch_abort(struct fetch *f); void fetch_poll(void); void fetch_quit(void); diff --git a/content/fetchcache.c b/content/fetchcache.c index cc755e73c..b3eac27fa 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -17,6 +17,7 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/cache.h" #include "netsurf/content/content.h" #include "netsurf/content/fetchcache.h" @@ -47,7 +48,11 @@ struct content * fetchcache(const char *url0, char *referer, void *p2, const char *error), void *p1, void *p2, unsigned long width, unsigned long height, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart, bool cookies) + struct form_successful_control *post_multipart +#ifdef WITH_COOKIES + ,bool cookies +#endif + ) { struct content *c; char *url = xstrdup(url0); @@ -76,7 +81,11 @@ struct content * fetchcache(const char *url0, char *referer, c->width = width; c->height = height; c->fetch = fetch_start(url, referer, fetchcache_callback, c, only_2xx, - post_urlenc, post_multipart, cookies); + post_urlenc, post_multipart +#ifdef WITH_COOKIES + ,cookies +#endif + ); free(url); if (c->fetch == 0) { LOG(("warning: fetch_start failed")); @@ -162,7 +171,7 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) cache_destroy(c); content_destroy(c); break; - +#ifdef WITH_AUTH case FETCH_AUTH: /* data -> string containing the Realm */ LOG(("FETCH_AUTH, '%s'", data)); @@ -170,7 +179,7 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) content_broadcast(c, CONTENT_MSG_AUTH, data); cache_destroy(c); break; - +#endif default: assert(0); } diff --git a/content/fetchcache.h b/content/fetchcache.h index 12326970b..bc1cfb76e 100644 --- a/content/fetchcache.h +++ b/content/fetchcache.h @@ -16,6 +16,7 @@ #define _NETSURF_DESKTOP_FETCHCACHE_H_ #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" struct form_successful_control; @@ -25,7 +26,11 @@ struct content * fetchcache(const char *url, char *referer, void *p2, const char *error), void *p1, void *p2, unsigned long width, unsigned long height, bool only_2xx, char *post_urlenc, - struct form_successful_control *post_multipart, bool cookies); + struct form_successful_control *post_multipart +#ifdef WITH_COOKIES + ,bool cookies +#endif + ); void fetchcache_init(void); #endif diff --git a/css/css.c b/css/css.c index 45b3485d8..c46214669 100644 --- a/css/css.c +++ b/css/css.c @@ -11,6 +11,7 @@ #include #define CSS_INTERNALS #undef NDEBUG +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/content/fetch.h" #include "netsurf/content/fetchcache.h" @@ -169,7 +170,11 @@ void css_revive(struct content *c, unsigned int width, unsigned int height) c->data.css.import_content[i] = fetchcache( c->data.css.import_url[i], c->url, css_atimport_callback, c, (void*)i, - c->width, c->height, true, 0, 0, false); + c->width, c->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.css.import_content[i] == 0) continue; if (c->data.css.import_content[i]->status != CONTENT_STATUS_DONE) @@ -335,7 +340,11 @@ void css_atimport(struct content *c, struct css_node *node) c->data.css.import_url[i] = url1; c->data.css.import_content[i] = fetchcache( c->data.css.import_url[i], c->url, css_atimport_callback, - c, (void*)i, c->width, c->height, true, 0, 0, false); + c, (void*)i, c->width, c->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.css.import_content[i] && c->data.css.import_content[i]->status != CONTENT_STATUS_DONE) c->active++; @@ -383,7 +392,11 @@ void css_atimport_callback(content_msg msg, struct content *css, c->data.css.import_url[i] = xstrdup(error); c->data.css.import_content[i] = fetchcache( c->data.css.import_url[i], c->url, css_atimport_callback, - c, (void*)i, css->width, css->height, true, 0, 0, false); + c, (void*)i, css->width, css->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.css.import_content[i] && c->data.css.import_content[i]->status != CONTENT_STATUS_DONE) c->active++; diff --git a/debug/netsurfd.c b/debug/netsurfd.c index 33b16678b..827d01b46 100644 --- a/debug/netsurfd.c +++ b/debug/netsurfd.c @@ -7,6 +7,7 @@ #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/fetch.h" #include "netsurf/content/cache.h" #include "netsurf/content/content.h" @@ -47,7 +48,11 @@ int main(int argc, char *argv[]) break; url[strlen(url) - 1] = 0; destroyed = 0; - c = fetchcache(url, 0, callback, 0, 0, 100, 1000, false, 0, 0, true); + c = fetchcache(url, 0, callback, 0, 0, 100, 1000, false, 0, 0 +#ifdef WITH_COOKIES + , true +#endif + ); if (c) { done = c->status == CONTENT_STATUS_DONE; while (!done) @@ -84,9 +89,11 @@ void gui_remove_gadget(void *p) { } +#ifdef WITH_PLUGIN void plugin_decode(void *a, void *b, void *c, void *d) { } +#endif void html_redraw(struct content *c, long x, long y, unsigned long width, unsigned long height, @@ -112,17 +119,22 @@ void html_remove_instance(struct content *c, struct browser_window *bw, { } +#ifdef WITH_AUTH void *login_list_get(char *url) { return 0; } +#endif +#ifdef WITH_PLUGIN bool plugin_handleable(const char *mime_type) { return false; } +#endif #ifdef riscos +#ifdef WITH_PLUGIN void plugin_msg_parse(wimp_message *message, int ack) {} void plugin_create(struct content *c) {} void plugin_process_data(struct content *c, char *data, unsigned long size) {} @@ -142,6 +154,7 @@ void plugin_remove_instance(struct content *c, struct browser_window *bw, void plugin_reshape_instance(struct content *c, struct browser_window *bw, struct content *page, struct box *box, struct object_params *params, void **state) {} +#endif char *NETSURF_DIR = ""; #endif diff --git a/desktop/401login.h b/desktop/401login.h index d9262c54c..27f76f65a 100644 --- a/desktop/401login.h +++ b/desktop/401login.h @@ -8,9 +8,12 @@ #ifndef NETSURF_DESKTOP_401LOGIN_H #define NETSURF_DESKTOP_401LOGIN_H +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/browser.h" +#ifdef WITH_AUTH + struct login { char *host; /**< hostname */ @@ -26,3 +29,5 @@ struct login *login_list_get(char *host); void login_list_remove(char *host); #endif + +#endif diff --git a/desktop/browser.c b/desktop/browser.c index cc4b468dc..3c4536d36 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -15,10 +15,13 @@ #include #include "curl/curl.h" #include "libxml/debugXML.h" +#include "netsurf/utils/config.h" #include "netsurf/content/cache.h" #include "netsurf/content/fetchcache.h" #include "netsurf/css/css.h" +#ifdef WITH_AUTH #include "netsurf/desktop/401login.h" +#endif #include "netsurf/desktop/browser.h" #include "netsurf/render/box.h" #include "netsurf/render/font.h" @@ -110,7 +113,11 @@ void browser_window_forward(struct browser_window* bw) } -struct browser_window* create_browser_window(int flags, int width, int height, struct browser_window *parent) +struct browser_window* create_browser_window(int flags, int width, int height +#ifdef WITH_FRAMES +, struct browser_window *parent +#endif +) { struct browser_window* bw; bw = (struct browser_window*) xcalloc(1, sizeof(struct browser_window)); @@ -130,9 +137,7 @@ struct browser_window* create_browser_window(int flags, int width, int height, s bw->url = NULL; bw->caret_callback = 0; - bw->parent = NULL; - -#if 0 +#ifdef WITH_FRAMES bw->parent = parent; if (bw->parent != NULL) { @@ -149,7 +154,7 @@ struct browser_window* create_browser_window(int flags, int width, int height, s bw->window = gui_create_browser_window(bw); -#if 0 +#ifdef WITH_FRAMES } #endif @@ -162,17 +167,24 @@ void browser_window_set_status(struct browser_window* bw, const char* text) gui_window_set_status(bw->window, text); } -void browser_window_destroy(struct browser_window* bw, bool self) +void browser_window_destroy(struct browser_window* bw +#ifdef WITH_FRAMES +, bool self +#endif +) { /*unsigned int i;*/ LOG(("bw = %p", bw)); assert(bw != 0); -#if 0 + +#ifdef WITH_FRAMES if (bw->no_children == 0 && bw->parent != NULL) { /* leaf node -> delete */ if (bw->current_content != NULL) { if (bw->current_content->status == CONTENT_STATUS_DONE) content_remove_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state); +#ifdef WITH_AUTH login_list_remove(bw->current_content->url); +#endif } xfree(bw->url); xfree(bw); @@ -187,11 +199,14 @@ void browser_window_destroy(struct browser_window* bw, bool self) /* all children killed -> remove this node */ if (self || bw->parent != NULL) { #endif + if (bw->current_content != NULL) { if (bw->current_content->status == CONTENT_STATUS_DONE) content_remove_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state); content_remove_user(bw->current_content, browser_window_callback, bw, 0); +#ifdef WITH_AUTH login_list_remove(bw->current_content->url); +#endif } if (bw->loading_content != NULL) { content_remove_user(bw->loading_content, browser_window_callback, bw, 0); @@ -199,15 +214,21 @@ void browser_window_destroy(struct browser_window* bw, bool self) xfree(bw->url); gui_window_destroy(bw->window); - /*xfree(bw->children);*/ + +#ifdef WITH_FRAMES + xfree(bw->children); +#endif + xfree(bw); -#if 0 + +#ifdef WITH_FRAMES } else { bw->no_children = 0; xfree(bw->children); } #endif + LOG(("end")); } @@ -215,7 +236,9 @@ void browser_window_open_location_historical(struct browser_window* bw, const char* url, char *post_urlenc, struct form_successful_control *post_multipart) { +#ifdef WITH_AUTH struct login *li; +#endif LOG(("bw = %p, url = %s", bw, url)); assert(bw != 0 && url != 0); @@ -223,15 +246,19 @@ void browser_window_open_location_historical(struct browser_window* bw, /* Check window still exists, if not, don't bother going any further */ if (!gui_window_in_list(bw->window)) return; - /*if (bw->url != NULL) - browser_window_destroy(bw, false);*/ +#ifdef WITH_FRAMES + if (bw->url != NULL) + browser_window_destroy(bw, false); +#endif +#ifdef WITH_AUTH if ((li = login_list_get(url)) == NULL) { if (bw->current_content != NULL) { login_list_remove(bw->current_content->url); } } +#endif browser_window_set_status(bw, "Opening page..."); browser_window_start_throbber(bw); @@ -239,7 +266,11 @@ void browser_window_open_location_historical(struct browser_window* bw, bw->history_add = false; bw->loading_content = fetchcache(url, 0, browser_window_callback, bw, 0, gui_window_get_width(bw->window), 0, false, - post_urlenc, post_multipart, true); + post_urlenc, post_multipart +#ifdef WITH_COOKIES + , true +#endif + ); if (bw->loading_content == 0) { browser_window_set_status(bw, "Unable to fetch document"); return; @@ -366,6 +397,7 @@ void browser_window_callback(content_msg msg, struct content *c, browser_window_reformat(bw, 0); break; +#ifdef WITH_AUTH case CONTENT_MSG_AUTH: gui_401login_open(bw, c, error); if (c == bw->loading_content) @@ -374,6 +406,7 @@ void browser_window_callback(content_msg msg, struct content *c, bw->current_content = 0; browser_window_stop_throbber(bw); break; +#endif default: assert(0); @@ -412,8 +445,10 @@ void download_window_callback(content_msg msg, struct content *c, case CONTENT_MSG_REFORMAT: break; +#ifdef WITH_AUTH case CONTENT_MSG_AUTH: break; +#endif } } @@ -1256,7 +1291,11 @@ void browser_window_follow_link(struct browser_window* bw, { struct browser_window* bw_new; bw_new = create_browser_window(browser_TITLE | browser_TOOLBAR - | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw_new->window); browser_window_open_location(bw_new, url); } diff --git a/desktop/browser.h b/desktop/browser.h index fd25299d8..ada21a37b 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -11,6 +11,7 @@ #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/gui.h" #include "netsurf/render/box.h" @@ -54,10 +55,11 @@ struct browser_window void (*caret_callback)(struct browser_window *bw, char key, void *p); void *caret_p; - +#ifdef WITH_FRAMES struct browser_window *parent; unsigned int no_children; struct browser_window **children; +#endif }; @@ -92,8 +94,16 @@ struct box_selection /* public functions */ -struct browser_window* create_browser_window(int flags, int width, int height, struct browser_window *parent); -void browser_window_destroy(struct browser_window* bw, bool self); +struct browser_window* create_browser_window(int flags, int width, int height +#ifdef WITH_FRAMES +, struct browser_window *parent +#endif +); +void browser_window_destroy(struct browser_window* bw +#ifdef WITH_FRAMES +, bool self +#endif +); void browser_window_open_location(struct browser_window* bw, const char* url); void browser_window_open_location_historical(struct browser_window* bw, const char* url, char *post_urlenc, diff --git a/desktop/loginlist.c b/desktop/loginlist.c index 090f877f5..45d4c0684 100644 --- a/desktop/loginlist.c +++ b/desktop/loginlist.c @@ -9,10 +9,13 @@ #include #include +#include "netsurf/utils/config.h" #include "netsurf/desktop/401login.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" +#ifdef WITH_AUTH + void login_list_dump(void); /** @@ -162,3 +165,5 @@ void login_list_dump(void) { LOG(("%s", nli->host)); } } + +#endif diff --git a/desktop/netsurf.c b/desktop/netsurf.c index f8a632cde..eaab1491e 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -8,6 +8,7 @@ #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/cache.h" #include "netsurf/content/fetch.h" #include "netsurf/content/fetchcache.h" @@ -55,8 +56,12 @@ void netsurf_init(int argc, char** argv) fetch_init(); cache_init(); fetchcache_init(); +#ifdef WITH_PNG nspng_init(); +#endif +#ifdef WITH_GIF nsgif_init(); +#endif } @@ -79,6 +84,8 @@ void netsurf_exit(void) { cache_quit(); fetch_quit(); +#ifdef WITH_COOKIES clean_cookiejar(); +#endif gui_quit(); } diff --git a/render/box.c b/render/box.c index 16f7e9b5f..24a565f4e 100644 --- a/render/box.c +++ b/render/box.c @@ -14,6 +14,7 @@ #include #include #include "libxml/HTMLparser.h" +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/css/css.h" #include "netsurf/render/box.h" @@ -22,8 +23,10 @@ #include "netsurf/render/html.h" #ifdef riscos #include "netsurf/desktop/gui.h" +#ifdef WITH_PLUGIN #include "netsurf/riscos/plugin.h" #endif +#endif #define NDEBUG #include "netsurf/utils/log.h" #include "netsurf/utils/messages.h" @@ -83,18 +86,24 @@ void box_normalise_table_row(struct box *row, static void box_normalise_inline_container(struct box *cont, pool box_pool); static void gadget_free(struct form_control* g); static void box_free_box(struct box *box); +#ifdef WITH_PLUGIN static struct result box_object(xmlNode *n, struct status *status, struct css_style *style); static struct result box_embed(xmlNode *n, struct status *status, struct css_style *style); static struct result box_applet(xmlNode *n, struct status *status, struct css_style *style); +#endif +#if defined(WITH_PLUGIN) static struct result box_iframe(xmlNode *n, struct status *status, struct css_style *style); +#endif static void add_form_element(struct page_elements* pe, struct form* f); static void add_gadget_element(struct page_elements* pe, struct form_control* g); +#ifdef WITH_PLUGIN static bool plugin_decode(struct content* content, char* url, struct box* box, struct object_params* po); +#endif /* element_table must be sorted by name */ struct element_entry { @@ -104,15 +113,23 @@ struct element_entry { }; static const struct element_entry element_table[] = { {"a", box_a}, +#ifdef WITH_PLUGIN {"applet", box_applet}, +#endif {"body", box_body}, {"button", box_button}, +#ifdef WITH_PLUGIN {"embed", box_embed}, +#endif {"form", box_form}, +#if defined(WITH_PLUGIN) {"iframe", box_iframe}, +#endif {"img", box_image}, {"input", box_input}, +#ifdef WITH_PLUGIN {"object", box_object}, +#endif {"select", box_select}, {"textarea", box_textarea} }; @@ -172,8 +189,10 @@ struct box * box_create(struct css_style * style, box->font = 0; box->gadget = 0; box->object = 0; +#ifdef WITH_PLUGIN box->object_params = 0; box->object_state = 0; +#endif box->x = box->y = 0; return box; } @@ -1684,6 +1703,7 @@ void add_gadget_element(struct page_elements* pe, struct form_control* g) } +#ifdef WITH_PLUGIN /** * add an object to the box tree */ @@ -2139,7 +2159,7 @@ bool plugin_decode(struct content* content, char* url, struct box* box, return true; } - +#endif /** * Find the absolute coordinates of a box. diff --git a/render/box.h b/render/box.h index e8264247c..b41e52c7c 100644 --- a/render/box.h +++ b/render/box.h @@ -12,6 +12,7 @@ #include #include #include "libxml/HTMLparser.h" +#include "netsurf/utils/config.h" #include "netsurf/css/css.h" #include "netsurf/render/font.h" #include "netsurf/utils/pool.h" @@ -36,6 +37,7 @@ struct column { struct box; +#ifdef WITH_PLUGIN /* parameters for and related elements */ struct object_params { char* data; @@ -62,6 +64,10 @@ struct plugin_params { char* valuetype; struct plugin_params* next; }; +#else +struct object_params {}; +struct plugin_params {}; +#endif struct box { box_type type; diff --git a/render/html.c b/render/html.c index 21a428a8d..c7cb76ba3 100644 --- a/render/html.c +++ b/render/html.c @@ -9,6 +9,7 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/content/fetch.h" #include "netsurf/content/fetchcache.h" @@ -202,17 +203,23 @@ void html_convert_css_callback(content_msg msg, struct content *css, c->active--; c->data.html.stylesheet_content[i] = fetchcache( error, c->url, html_convert_css_callback, - c, (void*)i, css->width, css->height, true, 0, 0, false); + c, (void*)i, css->width, css->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.html.stylesheet_content[i] != 0 && c->data.html.stylesheet_content[i]->status != CONTENT_STATUS_DONE) c->active++; break; +#ifdef WITH_AUTH case CONTENT_MSG_AUTH: c->data.html.stylesheet_content[i] = 0; c->active--; c->error = 1; break; +#endif default: assert(0); @@ -273,7 +280,11 @@ void html_find_stylesheets(struct content *c, xmlNode *head) #endif c->url, html_convert_css_callback, - c, 0, c->width, c->height, true, 0, 0, false); + c, 0, c->width, c->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); assert(c->data.html.stylesheet_content[0] != 0); if (c->data.html.stylesheet_content[0]->status != CONTENT_STATUS_DONE) c->active++; @@ -327,7 +338,11 @@ void html_find_stylesheets(struct content *c, xmlNode *head) (i + 1) * sizeof(*c->data.html.stylesheet_content)); c->data.html.stylesheet_content[i] = fetchcache(url, c->url, html_convert_css_callback, c, (void*)i, - c->width, c->height, true, 0, 0, false); + c->width, c->height, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.html.stylesheet_content[i] && c->data.html.stylesheet_content[i]->status != CONTENT_STATUS_DONE) c->active++; @@ -417,9 +432,13 @@ void html_fetch_object(struct content *c, char *url, struct box *box) c->data.html.object[i].content = fetchcache(url, c->url, html_object_callback, c, (void*)i, c->width, c->height, - true, 0, 0, false); /* we don't know the object's - dimensions yet; use - parent's as an estimate */ + true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); /* we don't know the object's + dimensions yet; use + parent's as an estimate */ if (c->data.html.object[i].content) { c->active++; if (c->data.html.object[i].content->status == CONTENT_STATUS_DONE) @@ -507,7 +526,11 @@ void html_object_callback(content_msg msg, struct content *object, c->data.html.object[i].url = xstrdup(error); c->data.html.object[i].content = fetchcache( error, c->url, html_object_callback, - c, (void*)i, 0, 0, true, 0, 0, false); + c, (void*)i, 0, 0, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.html.object[i].content) { c->active++; if (c->data.html.object[i].content->status == CONTENT_STATUS_DONE) @@ -519,11 +542,13 @@ void html_object_callback(content_msg msg, struct content *object, case CONTENT_MSG_REFORMAT: break; +#ifdef WITH_AUTH case CONTENT_MSG_AUTH: c->data.html.object[i].content = 0; c->active--; c->error = 1; break; +#endif default: assert(0); @@ -552,7 +577,11 @@ void html_revive(struct content *c, unsigned int width, unsigned int height) c->data.html.object[i].content = fetchcache( c->data.html.object[i].url, c->url, html_object_callback, - c, (void*)i, 0, 0, true, 0, 0, false); + c, (void*)i, 0, 0, true, 0, 0 +#ifdef WITH_COOKIES + , false +#endif + ); if (c->data.html.object[i].content && c->data.html.object[i].content->status != CONTENT_STATUS_DONE) c->active++; diff --git a/riscos/401login.c b/riscos/401login.c index 2aa644390..ab59f0f45 100644 --- a/riscos/401login.c +++ b/riscos/401login.c @@ -9,6 +9,7 @@ #include #include #include "oslib/wimp.h" +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/browser.h" #include "netsurf/desktop/401login.h" @@ -18,6 +19,8 @@ #include "netsurf/utils/messages.h" #include "netsurf/utils/utils.h" +#ifdef WITH_AUTH + static void get_unamepwd(void); static wimp_window *dialog_401_template; @@ -153,3 +156,5 @@ void get_unamepwd() { login_list_add(url, lidets); } + +#endif diff --git a/riscos/about.c b/riscos/about.c index 0318f5299..1560c6306 100644 --- a/riscos/about.c +++ b/riscos/about.c @@ -17,6 +17,7 @@ #include #include /* for __unixify */ +#include "netsurf/utils/config.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/riscos/about.h" #include "netsurf/utils/log.h" @@ -30,6 +31,8 @@ #include "oslib/osfscontrol.h" #include "oslib/osgbpb.h" +#ifdef WITH_ABOUT + static const char *pabouthdr = "%s
\"Netsurf
 

NetSurf %s

Copyright © 2002, 2003 NetSurf Developers.
 

"; /**< About page header */ static const char *pabtplghd = "The following plugins are installed on your system:
 
"; /**< Plugin table header */ static const char *paboutpl1 = ""; /**< Plugin entry without image */ @@ -261,6 +264,7 @@ void about_create(void) { return; } +#ifdef WITH_COOKIES /** * Creates the cookie list and stores it in .WWW.Netsurf */ @@ -321,6 +325,7 @@ void cookie_create(void) { xfree(cookies); return; } +#endif /** * Clean up created files @@ -331,3 +336,4 @@ void about_quit(void) { xosfile_delete(".WWW.NetSurf.Cookies", 0, 0, 0, 0, 0); } +#endif diff --git a/riscos/about.h b/riscos/about.h index e3ed66a69..e6e9f69b4 100644 --- a/riscos/about.h +++ b/riscos/about.h @@ -8,9 +8,15 @@ #ifndef _NETSURF_RISCOS_ABOUT_H_ #define _NETSURF_RISCOS_ABOUT_H_ +#include "netsurf/utils/config.h" + +#ifdef WITH_ABOUT void about_create(void); +#ifdef WITH_COOKIES void cookie_create(void); +#endif void about_quit(void); +#endif #endif diff --git a/riscos/constdata.c b/riscos/constdata.c index a7f573789..a7589e73e 100644 --- a/riscos/constdata.c +++ b/riscos/constdata.c @@ -7,10 +7,16 @@ * Copyright 2003 John M Bell */ +#include "netsurf/utils/config.h" #include "netsurf/riscos/constdata.h" +#ifdef WITH_ABOUT const char * const ABOUT_URL = "file:///%3CWimp$ScrapDir%3E/WWW/NetSurf/About"; +#ifdef WITH_COOKIES const char * const COOKIE_URL = "file:///%3CWimp$ScrapDir%3E/WWW/NetSurf/Cookies"; +#endif +#endif + const char * const GESTURES_URL = "file:///%3CNetSurf$Dir%3E/Resources/gestures"; const char * const HOME_URL = "file:///%3CNetSurf$Dir%3E/Docs/en/intro"; const char * const HELP_URL = "file:///%3CNetSurf$Dir%3E/Docs/en/index"; diff --git a/riscos/constdata.h b/riscos/constdata.h index f5a6d47aa..088174678 100644 --- a/riscos/constdata.h +++ b/riscos/constdata.h @@ -10,8 +10,14 @@ #ifndef _NETSURF_RISCOS_CONSTDATA_H_ #define _NETSURF_RISCOS_CONSTDATA_H_ +#include "netsurf/utils/config.h" + +#ifdef WITH_ABOUT extern const char * const ABOUT_URL; +#ifdef WITH_COOKIES extern const char * const COOKIE_URL; +#endif +#endif extern const char * const GESTURES_URL; extern const char * const HOME_URL; extern const char * const HELP_URL; diff --git a/riscos/dialog.c b/riscos/dialog.c index b5b54f19e..59addfb49 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -15,6 +15,7 @@ #include "oslib/osgbpb.h" #include "oslib/osspriteop.h" #include "oslib/wimp.h" +#include "netsurf/utils/config.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/riscos/constdata.h" #include "netsurf/riscos/gui.h" @@ -24,8 +25,11 @@ #include "netsurf/utils/utils.h" wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br, - dialog_config_prox, dialog_config_th, download_template, - dialog_401li; + dialog_config_prox, dialog_config_th, download_template +#ifdef WITH_AUTH + ,dialog_401li +#endif + ; wimp_menu* theme_menu = NULL; static struct ro_choices choices; @@ -146,8 +150,10 @@ void ro_gui_dialog_open(wimp_w w) bool ro_gui_dialog_keypress(wimp_key *key) { +#ifdef WITH_AUTH if (key->w == dialog_401li) return ro_gui_401login_keypress(key); +#endif return false; } @@ -168,8 +174,10 @@ void ro_gui_dialog_click(wimp_pointer *pointer) ro_gui_dialog_click_config_prox(pointer); else if (pointer->w == dialog_config_th) ro_gui_dialog_click_config_th(pointer); +#ifdef WITH_AUTH else if (pointer->w == dialog_401li) ro_gui_401login_click(pointer); +#endif } @@ -236,7 +244,11 @@ void ro_gui_dialog_click_config_br(wimp_pointer *pointer) break; case ICON_CONFIG_BR_EXPLAIN: bw = create_browser_window(browser_TITLE | browser_TOOLBAR | - browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 320, 256, NULL); + browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 320, 256 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); browser_window_open_location(bw, GESTURES_URL); break; @@ -299,7 +311,11 @@ void ro_gui_dialog_click_config_th(wimp_pointer *pointer) break; case ICON_CONFIG_TH_GET: bw = create_browser_window(browser_TITLE | browser_TOOLBAR | - browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 480, 320, NULL); + browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 480, 320 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); browser_window_open_location(bw, THEMES_URL); break; diff --git a/riscos/draw.c b/riscos/draw.c index c215b38f6..96b63b2b2 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -8,12 +8,14 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/riscos/draw.h" #include "netsurf/utils/utils.h" #include "netsurf/utils/log.h" #include "oslib/drawfile.h" +#ifdef WITH_DRAW void draw_create(struct content *c, const char *params[]) { c->data.draw.data = xcalloc(0, 1); @@ -106,3 +108,4 @@ void draw_redraw(struct content *c, long x, long y, xfree(matrix); } +#endif diff --git a/riscos/filetype.c b/riscos/filetype.c index d31f4cda1..98c3005bd 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -9,6 +9,7 @@ #include #include #include "oslib/osfile.h" +#include "netsurf/utils/config.h" #include "netsurf/content/fetch.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" @@ -19,14 +20,26 @@ struct type_entry { char mime_type[40]; }; static const struct type_entry type_map[] = { +#ifdef WITH_PLUGIN {0x188, "application/x-shockwave-flash"}, +#endif +#ifdef WITH_GIF {0x695, "image/gif"}, +#endif +#ifdef WITH_DRAW {0xaff, "image/x-drawfile"}, +#endif +#ifdef WITH_PNG {0xb60, "image/png"}, +#endif +#ifdef WITH_JPEG {0xc85, "image/jpeg"}, +#endif {0xf79, "text/css"}, {0xfaf, "text/html"}, +#ifdef WITH_SPRITE {0xff9, "image/x-riscos-sprite"}, +#endif {0xfff, "text/plain"}, }; #define TYPE_MAP_COUNT (sizeof(type_map) / sizeof(type_map[0])) diff --git a/riscos/frames.c b/riscos/frames.c index 055d531e5..1c49382ef 100644 --- a/riscos/frames.c +++ b/riscos/frames.c @@ -7,6 +7,7 @@ #include +#include "netsurf/utils/config.h" #include "netsurf/desktop/browser.h" #include "netsurf/desktop/gui.h" #include "netsurf/riscos/frames.h" @@ -20,6 +21,8 @@ #include "oslib/os.h" #include "oslib/wimp.h" +#ifdef WITH_FRAMES + void frame_add_instance_to_list(struct content *c, struct browser_window *parent, struct content *page, struct box *box, struct object_params *params, void **state, struct browser_window *bw, gui_window *g); void frame_remove_instance_from_list(struct content *c); struct frame_list *frame_get_instance_from_list(struct content *c); @@ -206,3 +209,4 @@ struct frame_list *frame_get_instance_from_list(struct content *c) { return NULL; } +#endif diff --git a/riscos/frames.h b/riscos/frames.h index e65044cc9..eee37d107 100644 --- a/riscos/frames.h +++ b/riscos/frames.h @@ -37,6 +37,7 @@ #ifndef _NETSURF_RISCOS_FRAMES_H_ #define _NETSURF_RISCOS_FRAMES_H_ +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/browser.h" #include "netsurf/render/box.h" @@ -44,6 +45,8 @@ #include "oslib/wimp.h" +#ifdef WITH_FRAMES + struct frame_list { struct content *c; @@ -68,3 +71,4 @@ void frame_reshape_instance(struct content *c, struct browser_window *bw, struct content *page, struct box *box, struct object_params *params, void **state); #endif +#endif diff --git a/riscos/gif.c b/riscos/gif.c index 7f2acb40b..1363730fc 100644 --- a/riscos/gif.c +++ b/riscos/gif.c @@ -15,11 +15,14 @@ #include "oslib/colourtrans.h" #include "oslib/os.h" #include "oslib/osspriteop.h" +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/riscos/gif.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" +#ifdef WITH_GIF + static osspriteop_area *create_buffer_sprite(struct content *c, anim a); void nsgif_init(void) @@ -217,3 +220,4 @@ static osspriteop_area *create_buffer_sprite( struct content *c, anim a ) return result; } +#endif diff --git a/riscos/gui.c b/riscos/gui.c index a0524bd91..8f225b540 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -20,19 +20,28 @@ #include "oslib/plugin.h" #include "oslib/wimp.h" #include "oslib/uri.h" +#include "netsurf/utils/config.h" #include "netsurf/desktop/gui.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/options.h" #include "netsurf/render/font.h" #include "netsurf/render/form.h" #include "netsurf/render/html.h" +#ifdef WITH_ABOUT #include "netsurf/riscos/about.h" +#endif #include "netsurf/riscos/constdata.h" #include "netsurf/riscos/gui.h" +#ifdef WITH_PLUGIN #include "netsurf/riscos/plugin.h" +#endif #include "netsurf/riscos/theme.h" +#ifdef WITH_URI #include "netsurf/riscos/uri.h" +#endif +#ifdef WITH_URL #include "netsurf/riscos/url.h" +#endif #include "netsurf/utils/log.h" #include "netsurf/utils/messages.h" #include "netsurf/utils/utils.h" @@ -53,8 +62,13 @@ static const wimp_MESSAGE_LIST(25) task_messages = { { message_DATA_SAVE_ACK, message_DATA_LOAD, message_DATA_OPEN, +#ifdef WITH_URI message_URI_PROCESS, +#endif +#ifdef WITH_URL message_INET_SUITE_OPEN_URL, +#endif +#ifdef WITH_PLUGIN message_PLUG_IN_OPENING, message_PLUG_IN_CLOSED, message_PLUG_IN_RESHAPE_REQUEST, @@ -74,6 +88,7 @@ static const wimp_MESSAGE_LIST(25) task_messages = { { message_PLUG_IN_ABORT, message_PLUG_IN_ACTION, /* message_PLUG_IN_INFORMED, (not provided by oslib) */ +#endif 0 } }; struct ro_gui_poll_block { @@ -137,7 +152,9 @@ void gui_init(int argc, char** argv) ro_gui_dialog_init(); ro_gui_download_init(); ro_gui_menus_init(); +#ifdef WITH_AUTH ro_gui_401login_init(); +#endif ro_gui_history_init(); wimp_close_template(); ro_gui_icon_bar_create(); @@ -166,7 +183,9 @@ void ro_gui_icon_bar_create(void) void gui_quit(void) { +#ifdef WITH_ABOUT about_quit(); +#endif ro_gui_history_quit(); wimp_close_down(task_handle); } @@ -258,8 +277,14 @@ void gui_poll(bool active) case wimp_CLOSE_WINDOW_REQUEST : g = ro_lookup_gui_from_w(block.close.w); if (g != NULL) { - browser_window_destroy(g->data.browser.bw, true); + browser_window_destroy(g->data.browser.bw +#ifdef WITH_FRAMES + , true +#endif + ); +#ifdef WITH_COOKIES clean_cookiejar(); +#endif } else ro_gui_dialog_close((wimp_w)(&(block.close.w))); @@ -350,14 +375,17 @@ void gui_poll(bool active) ro_msg_dataopen(&(block.message)); break; +#ifdef WITH_URI case message_URI_PROCESS : ro_uri_message_received(&(block.message)); break; - +#endif +#ifdef WITH_URL case message_INET_SUITE_OPEN_URL: ro_url_message_received(&(block.message)); break; - +#endif +#ifdef WITH_PLUGIN case message_PLUG_IN_OPENING: case message_PLUG_IN_CLOSED: case message_PLUG_IN_RESHAPE_REQUEST: @@ -379,6 +407,7 @@ void gui_poll(bool active) plugin_msg_parse(&(block.message), (event == wimp_USER_MESSAGE_ACKNOWLEDGE ? 1 : 0)); break; +#endif case message_QUIT : netsurf_quit = true; @@ -404,13 +433,13 @@ void gui_multitask(void) switch (event) { case wimp_NULL_REASON_CODE: + ro_gui_throb(); if (over_window != NULL) { wimp_pointer pointer; wimp_get_pointer_info(&pointer); ro_gui_window_mouse_at(&pointer); } - ro_gui_throb(); break; case wimp_REDRAW_WINDOW_REQUEST : @@ -512,14 +541,17 @@ void gui_multitask(void) ro_msg_dataopen(&(block.message)); break; +#ifdef WITH_URI case message_URI_PROCESS : ro_uri_message_received(&(block.message)); break; - +#endif +#ifdef WITH_URL case message_INET_SUITE_OPEN_URL: ro_url_message_received(&(block.message)); break; - +#endif +#ifdef WITH_PLUGIN case message_PLUG_IN_OPENING: case message_PLUG_IN_CLOSED: case message_PLUG_IN_RESHAPE_REQUEST: @@ -541,6 +573,7 @@ void gui_multitask(void) plugin_msg_parse(&(block.message), (event == wimp_USER_MESSAGE_ACKNOWLEDGE ? 1 : 0)); break; +#endif case message_QUIT : netsurf_quit = true; @@ -594,7 +627,11 @@ void ro_gui_icon_bar_click(wimp_pointer* pointer) { struct browser_window* bw; bw = create_browser_window(browser_TITLE | browser_TOOLBAR - | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); browser_window_open_location(bw, HOME_URL); wimp_set_caret_position(bw->window->data.browser.toolbar, @@ -863,7 +900,11 @@ void ro_msg_dataopen(wimp_message *message) /* create a new window with the file */ bw = create_browser_window(browser_TITLE | browser_TOOLBAR | - browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); url = ro_path_to_url(message->data.data_xfer.file_name); browser_window_open_location(bw, url); @@ -907,7 +948,11 @@ void ro_gui_open_help_page (void) struct browser_window *bw; bw = create_browser_window(browser_TITLE | browser_TOOLBAR | browser_SCROLL_X_ALWAYS | - browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); browser_window_open_location(bw, HELP_URL); wimp_set_caret_position(bw->window->data.browser.toolbar, diff --git a/riscos/gui.h b/riscos/gui.h index 6153be6f8..fa0b783c3 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -11,6 +11,7 @@ #include #include "oslib/wimp.h" +#include "netsurf/utils/config.h" #include "netsurf/desktop/browser.h" #include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/gui.h" @@ -131,10 +132,12 @@ void ro_gui_start_selection(wimp_pointer *pointer, wimp_window_state *state, void ro_gui_drag_end(wimp_dragged* drag); /* in 401login.c */ +#ifdef WITH_AUTH void ro_gui_401login_init(void); void ro_gui_401login_open(char* host, char * realm, char* fetchurl); void ro_gui_401login_click(wimp_pointer *pointer); bool ro_gui_401login_keypress(wimp_key *key); +#endif /* in window.c */ void ro_gui_window_click(gui_window* g, wimp_pointer* mouse); diff --git a/riscos/htmlinstance.c b/riscos/htmlinstance.c index f305beb94..68c03fdeb 100644 --- a/riscos/htmlinstance.c +++ b/riscos/htmlinstance.c @@ -5,6 +5,7 @@ * Copyright 2003 James Bursa */ +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/browser.h" #include "netsurf/render/box.h" @@ -20,13 +21,15 @@ void html_add_instance(struct content *c, struct browser_window *bw, for (i = 0; i != c->data.html.object_count; i++) { if (c->data.html.object[i].content == 0) continue; +#ifdef WITH_FRAMES if (c->data.html.object[i].content->type == CONTENT_HTML) - /*frame_add_instance(c->data.html.object[i].content, + frame_add_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, c->data.html.object[i].box->object_params, - &c->data.html.object[i].box->object_state)*/; + &c->data.html.object[i].box->object_state); else +#endif content_add_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, @@ -44,13 +47,15 @@ void html_reshape_instance(struct content *c, struct browser_window *bw, for (i = 0; i != c->data.html.object_count; i++) { if (c->data.html.object[i].content == 0) continue; +#ifdef WITH_FRAMES if (c->data.html.object[i].content->type == CONTENT_HTML) - /*frame_reshape_instance(c->data.html.object[i].content, + frame_reshape_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, c->data.html.object[i].box->object_params, - &c->data.html.object[i].box->object_state)*/; + &c->data.html.object[i].box->object_state); else +#endif content_reshape_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, @@ -67,13 +72,15 @@ void html_remove_instance(struct content *c, struct browser_window *bw, for (i = 0; i != c->data.html.object_count; i++) { if (c->data.html.object[i].content == 0) continue; +#ifdef WITH_FRAMES if (c->data.html.object[i].content->type == CONTENT_HTML) - /*frame_remove_instance(c->data.html.object[i].content, + frame_remove_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, c->data.html.object[i].box->object_params, - &c->data.html.object[i].box->object_state)*/; + &c->data.html.object[i].box->object_state); else +#endif content_remove_instance(c->data.html.object[i].content, bw, c, c->data.html.object[i].box, diff --git a/riscos/jpeg.c b/riscos/jpeg.c index db119484d..3a40e8090 100644 --- a/riscos/jpeg.c +++ b/riscos/jpeg.c @@ -13,12 +13,13 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/riscos/jpeg.h" #include "netsurf/utils/utils.h" #include "oslib/jpeg.h" - +#ifdef WITH_JPEG void jpeg_create(struct content *c, const char *params[]) { c->data.jpeg.data = xcalloc(0, 1); @@ -85,4 +86,4 @@ void jpeg_redraw(struct content *c, long x, long y, &factors, (int) c->data.jpeg.length, jpeg_SCALE_DITHERED); } - +#endif diff --git a/riscos/plugin.c b/riscos/plugin.c index 4bdbdf4e9..0ec741f93 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -24,6 +24,7 @@ #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/desktop/browser.h" #include "netsurf/desktop/gui.h" @@ -42,6 +43,8 @@ #include "oslib/plugin.h" #include "oslib/wimp.h" +#ifdef WITH_PLUGIN + /* parameters file creation */ void plugin_write_parameters_file(struct object_params *params); int plugin_calculate_rsize(char* name, char* data, char* mime); @@ -1290,7 +1293,11 @@ void plugin_url_access(wimp_message *message) { struct browser_window *bwnew; bwnew = create_browser_window(browser_TITLE | browser_TOOLBAR | browser_SCROLL_X_ALWAYS - | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bwnew->window); bwnew->url = xstrdup(url); browser_window_open_location(bwnew, url); @@ -1375,3 +1382,4 @@ void plugin_force_redraw(struct content *object, struct content *c, because doing so breaks things :-) */ } +#endif diff --git a/riscos/png.c b/riscos/png.c index d56c5d827..8105ebfe7 100644 --- a/riscos/png.c +++ b/riscos/png.c @@ -15,11 +15,13 @@ #include "oslib/colourtrans.h" #include "oslib/os.h" #include "oslib/osspriteop.h" +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/riscos/png.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" +#ifdef WITH_PNG /* libpng uses names starting png_, so use nspng_ here to avoid clashes */ #ifndef NO_IFC @@ -402,4 +404,4 @@ void nspng_redraw(struct content *c, long x, long y, xfree(table); } - +#endif diff --git a/riscos/sprite.c b/riscos/sprite.c index 51c3a057c..44bd39c9a 100644 --- a/riscos/sprite.c +++ b/riscos/sprite.c @@ -8,6 +8,7 @@ #include #include #include +#include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/riscos/sprite.h" #include "netsurf/utils/utils.h" @@ -15,6 +16,8 @@ #include "oslib/colourtrans.h" #include "oslib/osspriteop.h" +#ifdef WITH_SPRITE + void sprite_create(struct content *c, const char *params[]) { c->data.sprite.data = xcalloc(4, 1); @@ -114,3 +117,4 @@ void sprite_redraw(struct content *c, long x, long y, xfree(table); } +#endif diff --git a/riscos/uri.c b/riscos/uri.c index 56780563b..aac943f2a 100644 --- a/riscos/uri.c +++ b/riscos/uri.c @@ -9,6 +9,7 @@ #include #include "oslib/uri.h" #include "oslib/wimp.h" +#include "netsurf/utils/config.h" #include "netsurf/desktop/browser.h" #include "netsurf/riscos/theme.h" #include "netsurf/desktop/gui.h" @@ -16,6 +17,8 @@ #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" +#ifdef WITH_URI + void ro_uri_message_received(uri_full_message_process*); @@ -55,7 +58,11 @@ void ro_uri_message_received(uri_full_message_process* uri_message) xuri_request_uri(0, uri_requested, uri_length, uri_handle, NULL); bw = create_browser_window(browser_TITLE | browser_TOOLBAR - | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); browser_window_open_location(bw, uri_requested); @@ -67,3 +74,4 @@ void ro_uri_message_received(uri_full_message_process* uri_message) xfree(uri_requested); } +#endif diff --git a/riscos/url.c b/riscos/url.c index 011eb9e37..0eba47891 100644 --- a/riscos/url.c +++ b/riscos/url.c @@ -10,6 +10,7 @@ #include #include "oslib/inetsuite.h" #include "oslib/wimp.h" +#include "netsurf/utils/config.h" #include "netsurf/desktop/browser.h" #include "netsurf/riscos/theme.h" #include "netsurf/desktop/gui.h" @@ -99,7 +100,11 @@ void ro_url_message_received(wimp_message* message) /* create new browser window */ bw = create_browser_window(browser_TITLE | browser_TOOLBAR - | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480, NULL); + | browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480 +#ifdef WITH_FRAMES + , NULL +#endif + ); gui_window_show(bw->window); diff --git a/riscos/window.c b/riscos/window.c index ed7dddc5b..dc99f1d8a 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -17,6 +17,7 @@ #include "oslib/wimp.h" #include "oslib/wimpspriteop.h" #include "netsurf/css/css.h" +#include "netsurf/utils/config.h" #include "netsurf/riscos/constdata.h" #include "netsurf/riscos/gui.h" #include "netsurf/riscos/theme.h" @@ -430,7 +431,7 @@ void ro_gui_window_open(gui_window *g, wimp_open *open) void ro_gui_throb(void) { gui_window* g; - float nowtime = (float) (clock() / CLOCKS_PER_SEC); + float nowtime = (float) (clock() / (CLOCKS_PER_SEC/(15*23/theme_throbs))); for (g = window_list; g != NULL; g = g->next) { @@ -444,7 +445,7 @@ void ro_gui_throb(void) { g->throbtime = nowtime; g->throbber++; - if (theme_throbs < (unsigned int)g->throbber) + if (theme_throbs < (float)g->throbber) g->throbber = 0; sprintf(g->throb_buf, "throbber%u", g->throbber); wimp_set_icon_state(g->data.browser.toolbar, @@ -718,8 +719,14 @@ bool ro_gui_window_keypress(gui_window *g, int key, bool toolbar) return true; case wimp_KEY_CONTROL + wimp_KEY_F2: /* Close window. */ - browser_window_destroy(g->data.browser.bw, true); + browser_window_destroy(g->data.browser.bw +#ifdef WITH_FRAMES + , true +#endif + ); +#ifdef WITH_COOKIES clean_cookiejar(); +#endif return true; case wimp_KEY_RETURN: diff --git a/utils/config.h b/utils/config.h new file mode 100644 index 000000000..c26ed3f50 --- /dev/null +++ b/utils/config.h @@ -0,0 +1,44 @@ +/* + * This file is part of NetSurf, http://netsurf.sourceforge.net/ + * Licensed under the GNU General Public License, + * http://www.opensource.org/licenses/gpl-license + * Copyright 2003 John M Bell + */ + +#ifndef _NETSURF_UTILS_CONFIG_H_ +#define _NETSURF_UTILS_CONFIG_H_ + +/* This file toggles build options on and off. + * Simply undefine a symbol to turn the relevant feature off. + */ + +/* Image renderering modules */ +#define WITH_DRAW +#define WITH_GIF +#define WITH_JPEG +#define WITH_PNG +#define WITH_SPRITE + +/* Plugin module */ +#define WITH_PLUGIN + +/* Frames */ +#undef WITH_FRAMES + +/* HTTP Auth */ +#define WITH_AUTH + +/* Cookies */ +#define WITH_COOKIES + +/* About page */ +#define WITH_ABOUT + +/* Acorn URI protocol support */ +#define WITH_URI + +/* ANT URL protocol support */ +#define WITH_URL + +#endif + diff --git a/utils/utils.c b/utils/utils.c index 149324f29..c887edc36 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -18,6 +18,7 @@ #include #include "libxml/encoding.h" #include "libxml/uri.h" +#include "netsurf/utils/config.h" #ifdef riscos #include "netsurf/riscos/about.h" #include "netsurf/riscos/constdata.h" @@ -208,15 +209,20 @@ char *url_join(char *rel_url, char *base_url) * It simplifies the code it the other places too (they just * call this as usual, then we handle it here). */ +#ifdef WITH_ABOUT if (strcasecmp(rel_url, "about:") == 0) { about_create(); return xstrdup(ABOUT_URL); } +#ifdef WITH_COOKIES else if (strcasecmp(rel_url, "about:cookies") == 0) { cookie_create(); return xstrdup(COOKIE_URL); } - else if (strcasecmp(rel_url, "help:") == 0) { +#endif + else +#endif + if (strcasecmp(rel_url, "help:") == 0) { return xstrdup(HELP_URL); } else if (strcasecmp(rel_url, "home:") == 0) { @@ -324,7 +330,7 @@ void regcomp_wrapper(regex_t *preg, const char *regex, int cflags) * libcurl /really/ should do this for us. * This gets called every time a window is closed or NetSurf is quit. */ - +#ifdef WITH_COOKIES void clean_cookiejar(void) { FILE *fp; @@ -389,3 +395,4 @@ void clean_cookiejar(void) { xfree(cookies); } +#endif -- cgit v1.2.3
%s%s