diff --git a/configure.ac b/configure.ac index 1252672e..e1b5dd44 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ echo "Feature summary:" > features.log # =================================================================== AC_PROG_CC +AC_PROG_CXX AC_CHECK_TOOL([LD], [ld]) AC_PROG_AWK AC_PATH_PROGS(AWK, "$AWK") @@ -611,17 +612,18 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-17.0; do +for package in mozjs-24; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-17.0) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-24) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" LIBS="$SPIDERMONKEY_LIBS $LIBS_X" CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS" CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS" + AC_LANG_PUSH([C++]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* mozilla-js.pc may have -DXP_UNIX or similar in Cflags. @@ -635,6 +637,7 @@ for package in mozjs-17.0; do AC_MSG_RESULT([yes])], [# Leave CONFIG_SPIDERMONKEY blank, to continue the search. AC_MSG_RESULT([found but unusable])]) + AC_LANG_POP([C++]) else AC_MSG_RESULT([no]) fi @@ -646,14 +649,6 @@ if test -z "$CONFIG_SPIDERMONKEY"; then CONFIG_SPIDERMONKEY=no fi -if test "$CONFIG_SPIDERMONKEY" = "yes"; then - # LIBS, CFLAGS, and CPPFLAGS still include the SpiderMonkey options. - AC_CHECK_FUNCS([JS_ReportAllocationOverflow]) - AC_CHECK_FUNCS([JS_SetBranchCallback]) - AC_CHECK_FUNCS([JS_TriggerOperationCallback], [HAVE_JS_TRIGGEROPERATIONCALLBACK=yes]) -elif test -n "$with_spidermonkey" && test "x$with_spidermonkey" != "xno"; then - AC_MSG_WARN([SpiderMonkey was not found even though you specified --with-spidermonkey.]) -fi EL_RESTORE_FLAGS if test "x$CONFIG_SPIDERMONKEY" = xyes; then diff --git a/contrib/smjs/smartprefixes_classic.js b/contrib/smjs/smartprefixes_classic.js index 848bcd86..3b489bda 100644 --- a/contrib/smjs/smartprefixes_classic.js +++ b/contrib/smjs/smartprefixes_classic.js @@ -44,7 +44,7 @@ var smartprefixes = { sdp: "http://www.slashdot.org/search.pl?query=%s&op=polls", sdj: "http://www.slashdot.org/search.pl?query=%s&op=journals", dbug: "http://bugs.debian.org/%s", - dix: "http://dix.osola.com/index.de.php?trans=1&search=%s", + //dix: "http://dix.osola.com/index.de.php?trans=1&search=%s", dixgram: "http://dix.osola.com/v.php?language=german&search=%s", dpkg: "http://packages.debian.org/%s", emacs: "http://www.emacswiki.org/cgi-bin/wiki.pl?search=%s", diff --git a/contrib/smjs/smartprefixes_common.js b/contrib/smjs/smartprefixes_common.js index aaebfa4f..945bad6e 100644 --- a/contrib/smjs/smartprefixes_common.js +++ b/contrib/smjs/smartprefixes_common.js @@ -102,15 +102,15 @@ function gmane (url) } /* javascript:bugzilla('http://bugzilla.elinks.cz/', "%s"); */ -function bugzilla (base_url, arguments) +function bugzilla (base_url, args) { - if (!arguments || arguments == '') return base_url; + if (!args || args == '') return base_url; - if (arguments.match(/^[\d]+$/)) - return base_url + 'show_bug.cgi?id=' + arguments; + if (args.match(/^[\d]+$/)) + return base_url + 'show_bug.cgi?id=' + args; return base_url + 'buglist.cgi?short_desc_type=allwordssubstr' - + '&short_desc=' + escape(arguments); + + '&short_desc=' + escape(args); } /* javascript:babelfish("%s"); */ @@ -130,18 +130,18 @@ function babelfish (url) "Deutsch": 'de', "english": 'en', "french": 'fr', - "fran\231ais": 'fr', + "fran\x99ais": 'fr', "greek": 'el', "italian": 'it', "italiano": 'it', "japanese": 'ja', "korean": 'ko', "portuguese": 'pt', - "portugu\234s": 'pt', + "portugu\x9Cs": 'pt', "russian": 'ru', "spanish": 'es', "espanol": 'es', - "espa\241ol": 'es', + "espa\xA1ol": 'es', }; var parts = url.match(/^(\S+)\s+(\S+)\s*(.*)/); diff --git a/meson.build b/meson.build index 90210338..2cdebf09 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('felinks', 'c', version:'0.14.GIT', license:'GPLv2') +project('felinks', ['c','cpp'], version:'0.14.GIT', license:'GPLv2') srcs=[] srcdir = meson.source_root() @@ -92,12 +92,15 @@ conf_data.set('CONFIG_LIBDOM', get_option('libdom')) #CONFIG_XBEL_BOOKMARKS=true #CONFIG_COOKIES=true #CONFIG_DOM=true -if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') or conf_data.get('CONFIG_ECMASCRIPT_SMJS') +if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') == 1 or conf_data.get('CONFIG_ECMASCRIPT_SMJS') conf_data.set('CONFIG_ECMASCRIPT', true) else conf_data.set('CONFIG_ECMASCRIPT', false) endif conf_data.set('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT', true) + + + #CONFIG_FORMHIST', true) #CONFIG_GLOBHIST', true) conf_data.set('CONFIG_SCRIPTING', true) @@ -154,6 +157,12 @@ conf_data.set10('HAVE_SYS_TIME_H', 1) compiler = meson.get_compiler('c') +if conf_data.get('CONFIG_ECMASCRIPT') + extracflags = ['-xc++', '-fpermissive'] +else + extracflags = [] +endif + conf_data.set10('HAVE_WCHAR_H', compiler.has_header('wchar.h')) conf_data.set10('HAVE_WCTYPE_H', compiler.has_header('wctype.h')) conf_data.set10('HAVE_FCNTL_H', compiler.has_header('fcntl.h')) @@ -262,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2') endif if conf_data.get('CONFIG_ECMASCRIPT') - mozjsdeps = dependency('mozjs-17.0') + mozjsdeps = dependency('mozjs-24') deps += mozjsdeps endif @@ -328,7 +337,11 @@ endif #AC_C_CONST #AC_C_INLINE -conf_data.set('NONSTATIC_INLINE', 'inline') +if conf_data.get('CONFIG_ECMASCRIPT') + conf_data.set('NONSTATIC_INLINE', '') +else + conf_data.set('NONSTATIC_INLINE', 'inline') +endif #AC_SYS_LARGEFILE @@ -412,17 +425,9 @@ if compiler.has_function('strcasestr', prefix : '#include ', args: '-D conf_data.set10('HAVE_STRCASESTR', 1) endif -if compiler.has_function('strstr', prefix : '#include ') - conf_data.set10('HAVE_STRSTR', 1) -endif - -if compiler.has_function('strchr', prefix : '#include ') - conf_data.set10('HAVE_STRCHR', 1) -endif - -if compiler.has_function('strrchr', prefix : '#include ') - conf_data.set10('HAVE_STRRCHR', 1) -endif +conf_data.set10('HAVE_STRSTR', 1) +conf_data.set10('HAVE_STRCHR', 1) +conf_data.set10('HAVE_STRRCHR', 1) if compiler.has_function('memmove', prefix : '#include ') conf_data.set10('HAVE_MEMMOVE', 1) diff --git a/src/bfu/button.h b/src/bfu/button.h index 8fb14ed5..74f7dbe4 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -4,6 +4,10 @@ #include "bfu/common.h" #include "util/align.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -92,4 +96,8 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge extern const struct widget_ops button_ops; void dlg_format_buttons(struct dialog_data *, struct widget_data *, int, int, int *, int, int *, enum format_align, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h index f18faeef..b91c833b 100644 --- a/src/bfu/checkbox.h +++ b/src/bfu/checkbox.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_CHECKBOX_H #define EL__BFU_CHECKBOX_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -39,4 +43,8 @@ dlg_format_checkbox(struct dialog_data *dlg_data, #define widget_has_group(widget_data) ((widget_data)->widget->type == WIDGET_CHECKBOX \ ? (widget_data)->widget->info.checkbox.gid : -1) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/common.h b/src/bfu/common.h index a1fd368e..fc16b0bf 100644 --- a/src/bfu/common.h +++ b/src/bfu/common.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_COMMON_H #define EL__BFU_COMMON_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct widget_data; @@ -47,4 +51,8 @@ enum widget_type { }; +#ifdef __cplusplus +} +#endif + #endif /* EL__BFU_COMMON_H */ diff --git a/src/bfu/dialog.h b/src/bfu/dialog.h index ceeb67a5..7ede125a 100644 --- a/src/bfu/dialog.h +++ b/src/bfu/dialog.h @@ -8,6 +8,9 @@ #include "terminal/window.h" /* dialog_data->win->term is so common that... */ #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif struct dialog_data; struct term_event; @@ -222,4 +225,8 @@ struct widget_data *select_widget_by_id(struct dialog_data *dlg_data, int i); assert(n == (dlg)->number_of_widgets); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/group.h b/src/bfu/group.h index bd284500..f05e1a04 100644 --- a/src/bfu/group.h +++ b/src/bfu/group.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_GROUP_H #define EL__BFU_GROUP_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct terminal; struct widget_data; @@ -11,4 +15,8 @@ void dlg_format_group(struct dialog_data *dlg_data, void group_layouter(struct dialog_data *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index a489ab04..56fbd841 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -5,6 +5,10 @@ #include "bfu/listbox.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; /** BFU hierbox browser button */ @@ -146,4 +150,8 @@ widget_handler_status_T push_hierbox_delete_button(struct dialog_data *dlg_data, widget_handler_status_T push_hierbox_clear_button(struct dialog_data *dlg_data, struct widget_data *button); widget_handler_status_T push_hierbox_search_button(struct dialog_data *dlg_data, struct widget_data *button); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/hotkey.h b/src/bfu/hotkey.h index 24a8352c..6e1a6079 100644 --- a/src/bfu/hotkey.h +++ b/src/bfu/hotkey.h @@ -5,6 +5,10 @@ #include "terminal/kbd.h" +#ifdef __cplusplus +extern "C" { +#endif + struct menu; struct terminal; @@ -18,4 +22,8 @@ void refresh_hotkeys(struct terminal *term, struct menu *menu); int check_hotkeys(struct menu *menu, term_event_char_T hotkey, struct terminal *term); int check_not_so_hot_keys(struct menu *menu, term_event_char_T key, struct terminal *term); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/inpfield.h b/src/bfu/inpfield.h index eca314a3..668b218f 100644 --- a/src/bfu/inpfield.h +++ b/src/bfu/inpfield.h @@ -6,6 +6,9 @@ #include "util/lists.h" #include "util/align.h" +#ifdef __cplusplus +extern "C" { +#endif struct dialog; struct dialog_data; @@ -115,4 +118,8 @@ input_field_line(struct session *ses, unsigned char *prompt, void *data, #define widget_is_textfield(widget_data) ((widget_data)->widget->type == WIDGET_FIELD \ || (widget_data)->widget->type == WIDGET_FIELD_PASS) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/inphist.h b/src/bfu/inphist.h index d7a5ecf0..8e6acd5b 100644 --- a/src/bfu/inphist.h +++ b/src/bfu/inphist.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; @@ -58,4 +62,8 @@ int save_input_history(struct input_history *history, unsigned char *filename); void dlg_set_history(struct widget_data *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/leds.h b/src/bfu/leds.h index 4ed6c65f..c778bc77 100644 --- a/src/bfu/leds.h +++ b/src/bfu/leds.h @@ -6,6 +6,10 @@ #include "main/module.h" #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; @@ -50,4 +54,9 @@ unsigned char get_led_value(struct led *led); void unset_led_value(struct led *led); #endif + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 2a1356c6..c43d753c 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -4,6 +4,10 @@ #include "util/align.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct listbox_data; struct listbox_item; @@ -144,4 +148,8 @@ struct listbox_data *get_listbox_widget_data(struct widget_data *widget_data); #define get_dlg_listbox_data(dlg_data) \ get_listbox_widget_data(dlg_data->widgets_data) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/listmenu.h b/src/bfu/listmenu.h index 3b2b22b2..d738ecf0 100644 --- a/src/bfu/listmenu.h +++ b/src/bfu/listmenu.h @@ -2,6 +2,10 @@ #ifndef EL__BFU_LISTMENU_H #define EL__BFU_LISTMENU_H +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct string; struct terminal; @@ -20,4 +24,8 @@ void menu_labels(struct menu_item *m, unsigned char *base, unsigned char **lbls) void do_select_submenu(struct terminal *term, void *menu_, void *ses_); void free_menu(struct menu_item *m); +#ifdef __cplusplus +} +#endif + #endif /* EL__BFU_LISTMENU_H */ diff --git a/src/bfu/menu.h b/src/bfu/menu.h index 7be48814..39025772 100644 --- a/src/bfu/menu.h +++ b/src/bfu/menu.h @@ -4,6 +4,10 @@ #include "config/kbdbind.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; struct window; @@ -177,4 +181,8 @@ void do_menu_selected(struct terminal *, struct menu_item *, void *, int, int); void do_mainmenu(struct terminal *, struct menu_item *, void *, int); void deselect_mainmenu(struct terminal *term, struct menu *menu); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/msgbox.h b/src/bfu/msgbox.h index 2e06fe8a..1df93772 100644 --- a/src/bfu/msgbox.h +++ b/src/bfu/msgbox.h @@ -4,6 +4,10 @@ #include "util/align.h" #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; @@ -133,5 +137,8 @@ info_box(struct terminal *term, enum msgbox_flags flags, unsigned char *title, enum format_align align, unsigned char *text); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/bfu/style.h b/src/bfu/style.h index e9cbb95f..7dce1173 100644 --- a/src/bfu/style.h +++ b/src/bfu/style.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_STYLE_H #define EL__BFU_STYLE_H +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct terminal; @@ -27,4 +31,8 @@ get_bfu_color(struct terminal *term, unsigned char *stylename); */ void done_bfu_colors(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/text.h b/src/bfu/text.h index 469a94e1..ddb520de 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -3,6 +3,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -60,4 +64,8 @@ dlg_format_text(struct dialog_data *dlg_data, struct widget_data *widget_data, && (widget_data)->info.text.lines > 0 \ && (widget_data)->box.height < (widget_data)->info.text.lines) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/widget.h b/src/bfu/widget.h index 49c06f01..7a9c7df8 100644 --- a/src/bfu/widget.h +++ b/src/bfu/widget.h @@ -16,6 +16,10 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; @@ -87,5 +91,8 @@ widget_is_focusable(struct widget_data *widget_data) } } +#ifdef __cplusplus +} +#endif #endif diff --git a/src/bookmarks/backend/common.h b/src/bookmarks/backend/common.h index f406aa3c..5abdef24 100644 --- a/src/bookmarks/backend/common.h +++ b/src/bookmarks/backend/common.h @@ -6,6 +6,10 @@ #include "util/lists.h" #include "util/secsave.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bookmarks_backend { /* Order matters here. --Zas. */ unsigned char *(*filename)(int); @@ -16,4 +20,8 @@ struct bookmarks_backend { void bookmarks_read(void); void bookmarks_write(LIST_OF(struct bookmark) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/backend/default.h b/src/bookmarks/backend/default.h index b11416d9..0d86d8a9 100644 --- a/src/bookmarks/backend/default.h +++ b/src/bookmarks/backend/default.h @@ -4,6 +4,14 @@ #include "bookmarks/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct bookmarks_backend default_bookmarks_backend; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/backend/xbel.h b/src/bookmarks/backend/xbel.h index 85f6f536..78c66027 100644 --- a/src/bookmarks/backend/xbel.h +++ b/src/bookmarks/backend/xbel.h @@ -3,6 +3,14 @@ #include "bookmarks/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct bookmarks_backend xbel_bookmarks_backend; +#ifdef __cplusplus +} +#endif + #endif /* !EL__BOOKMARKS_BACKEND_XBEL_H */ diff --git a/src/bookmarks/bookmarks.h b/src/bookmarks/bookmarks.h index 55f2d283..ea30370b 100644 --- a/src/bookmarks/bookmarks.h +++ b/src/bookmarks/bookmarks.h @@ -5,6 +5,10 @@ #include "main/object.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct terminal; @@ -57,4 +61,8 @@ int update_bookmark(struct bookmark *, int, unsigned char *, unsigned char *); void open_bookmark_folder(struct session *ses, unsigned char *foldername); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/dialogs.h b/src/bookmarks/dialogs.h index 9f0b1bbd..7b987d74 100644 --- a/src/bookmarks/dialogs.h +++ b/src/bookmarks/dialogs.h @@ -6,6 +6,10 @@ #include "terminal/terminal.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser bookmark_browser; /* Launch the bookmark manager */ @@ -35,4 +39,8 @@ void bookmark_terminal_tabs_dialog(struct terminal *term); /* Free search memorization */ void free_last_searched_bookmark(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cache/cache.h b/src/cache/cache.h index de064277..7ff59adb 100644 --- a/src/cache/cache.h +++ b/src/cache/cache.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct uri; @@ -149,4 +153,8 @@ int get_cache_entry_count(void); int get_cache_entry_used_count(void); int get_cache_entry_loading_count(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cache/dialogs.h b/src/cache/dialogs.h index e3e41b3e..fd2d944b 100644 --- a/src/cache/dialogs.h +++ b/src/cache/dialogs.h @@ -3,10 +3,18 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; extern struct hierbox_browser cache_browser; void cache_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/cmdline.h b/src/config/cmdline.h index 4ed39042..5d96c648 100644 --- a/src/config/cmdline.h +++ b/src/config/cmdline.h @@ -4,7 +4,15 @@ #include "main/main.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + enum retval parse_options(int, unsigned char *[], LIST_OF(struct string_list_item) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/conf.h b/src/config/conf.h index 05f548c8..173a5d20 100644 --- a/src/config/conf.h +++ b/src/config/conf.h @@ -4,6 +4,10 @@ #include "terminal/terminal.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + enum parse_error { ERROR_NONE, ERROR_COMMAND, @@ -28,4 +32,8 @@ create_config_string(unsigned char *prefix, unsigned char *name); struct string *wrap_option_desc(struct string *out, const unsigned char *src, const struct string *indent, int maxwidth); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/dialogs.h b/src/config/dialogs.h index 60ec88f7..fd361478 100644 --- a/src/config/dialogs.h +++ b/src/config/dialogs.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser option_browser; extern struct hierbox_browser keybinding_browser; @@ -20,4 +24,8 @@ void init_keybinding_listboxes(struct keymap keymap_table[], const struct action_list actions[]); void done_keybinding_listboxes(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/domain.h b/src/config/domain.h index 726201af..09b20a88 100644 --- a/src/config/domain.h +++ b/src/config/domain.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; @@ -26,4 +30,8 @@ struct option *get_domain_option_from_session(unsigned char *, void done_domain_trees(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/home.h b/src/config/home.h index 6a48936f..a59b499f 100644 --- a/src/config/home.h +++ b/src/config/home.h @@ -1,10 +1,18 @@ #ifndef EL__CONFIG_HOME_H #define EL__CONFIG_HOME_H +#ifdef __cplusplus +extern "C" { +#endif + extern unsigned char *elinks_home; extern int first_use; void init_home(void); void done_home(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/kbdbind.h b/src/config/kbdbind.h index 8facc190..f46ce9d2 100644 --- a/src/config/kbdbind.h +++ b/src/config/kbdbind.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct module; @@ -199,4 +203,8 @@ void add_actions_to_string(struct string *string, action_id_T actions[], extern struct module kbdbind_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/options.h b/src/config/options.h index 10b074bb..234f7cb4 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -8,6 +8,10 @@ #include "util/memory.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* TODO: We should provide some generic mechanism for options caching. */ /* Fix namespace clash on Cygwin. */ @@ -555,4 +559,8 @@ enum verbose_level { VERBOSE_LEVELS, }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/opttypes.h b/src/config/opttypes.h index 65ef11f4..fa377034 100644 --- a/src/config/opttypes.h +++ b/src/config/opttypes.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct option_type_info { unsigned char *name; unsigned char *(*cmdline)(struct option *, unsigned char ***, int *); @@ -22,4 +26,8 @@ extern int commandline; unsigned char *get_option_type_name(enum option_type type); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/timer.h b/src/config/timer.h index c7904f06..ecf99693 100644 --- a/src/config/timer.h +++ b/src/config/timer.h @@ -1,8 +1,16 @@ #ifndef EL__CONFIG_TIMER_H #define EL__CONFIG_TIMER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module periodic_saving_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/urlhist.h b/src/config/urlhist.h index 9054b60e..78e11f2b 100644 --- a/src/config/urlhist.h +++ b/src/config/urlhist.h @@ -3,9 +3,17 @@ #include "bfu/inphist.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct input_history goto_url_history; extern struct module goto_url_history_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/cookies.h b/src/cookies/cookies.h index c8b8e38c..7bbcc180 100644 --- a/src/cookies/cookies.h +++ b/src/cookies/cookies.h @@ -16,6 +16,10 @@ #include "util/string.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct terminal; @@ -66,4 +70,8 @@ struct string *send_cookies_js(struct uri *uri); extern struct module cookies_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/dialogs.h b/src/cookies/dialogs.h index 8896d3f1..d4f6bd15 100644 --- a/src/cookies/dialogs.h +++ b/src/cookies/dialogs.h @@ -6,10 +6,18 @@ #include "terminal/terminal.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + extern LIST_OF(struct cookie) cookie_queries; void accept_cookie_dialog(struct session *ses, void *data); extern struct hierbox_browser cookie_browser; void cookie_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/parser.h b/src/cookies/parser.h index d9e832cc..a29b8847 100644 --- a/src/cookies/parser.h +++ b/src/cookies/parser.h @@ -1,6 +1,10 @@ #ifndef EL__COOKIES_PARSER_H #define EL__COOKIES_PARSER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cookie_str { unsigned char *str; unsigned char *nam_end, *val_start, *val_end; @@ -8,4 +12,8 @@ struct cookie_str { struct cookie_str *parse_cookie_str(struct cookie_str *cstr, unsigned char *str); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/path.c b/src/cookies/path.c index 406d3d26..5a27d387 100644 --- a/src/cookies/path.c +++ b/src/cookies/path.c @@ -1,6 +1,7 @@ /* Cookie path matching */ #include +#include "cookies/path.h" int is_path_prefix(unsigned char *cookiepath, unsigned char *requestpath) diff --git a/src/cookies/path.h b/src/cookies/path.h index c6e065ee..4036046c 100644 --- a/src/cookies/path.h +++ b/src/cookies/path.h @@ -1,6 +1,14 @@ #ifndef EL__COOKIES_PATH_H #define EL__COOKIES_PATH_H +#ifdef __cplusplus +extern "C" { +#endif + int is_path_prefix(unsigned char *d, unsigned char *s); +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/src/dialogs/document.h b/src/dialogs/document.h index e6c41706..6765cb21 100644 --- a/src/dialogs/document.h +++ b/src/dialogs/document.h @@ -3,10 +3,18 @@ #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + void nowhere_box(struct terminal *term, unsigned char *title); void link_info_dialog(struct session *ses); void document_info_dialog(struct session *); void cached_header_dialog(struct session *ses, struct cache_entry *cached); void protocol_header_dialog(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/download.h b/src/dialogs/download.h index 6b10add4..a1a1cfa2 100644 --- a/src/dialogs/download.h +++ b/src/dialogs/download.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_DOWNLOAD_H #define EL__DIALOGS_DOWNLOAD_H +#ifdef __cplusplus +extern "C" { +#endif + struct file_download; struct session; struct terminal; @@ -11,4 +15,8 @@ void done_download_display(struct file_download *file_download); void display_download(struct terminal *, struct file_download *, struct session *); void download_manager(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/edit.h b/src/dialogs/edit.h index c368863d..19de5cc7 100644 --- a/src/dialogs/edit.h +++ b/src/dialogs/edit.h @@ -5,6 +5,10 @@ #include "session/session.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + enum edit_dialog_type { EDIT_DLG_SEARCH, /* search dialog */ EDIT_DLG_ADD /* edit/add dialog */ @@ -17,4 +21,8 @@ void do_edit_dialog(struct terminal *, int, unsigned char *, void when_cancel(struct dialog *), void *, enum edit_dialog_type); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/exmode.h b/src/dialogs/exmode.h index 6adf4861..00401f90 100644 --- a/src/dialogs/exmode.h +++ b/src/dialogs/exmode.h @@ -3,10 +3,18 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; extern struct module exmode_module; void exmode_start(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/info.h b/src/dialogs/info.h index 37d2d689..2b28ce17 100644 --- a/src/dialogs/info.h +++ b/src/dialogs/info.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_INFO_H #define EL__DIALOGS_INFO_H +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; @@ -11,4 +15,8 @@ void menu_copying(struct terminal *, void *, void *); void resource_info(struct terminal *term); void memory_inf(struct terminal *, void *, struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/menu.h b/src/dialogs/menu.h index c5848c60..f5a26eed 100644 --- a/src/dialogs/menu.h +++ b/src/dialogs/menu.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct open_in_new; struct session; @@ -57,4 +61,8 @@ void auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, menu_func_T file_func, menu_func_T dir_func, void *data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/options.h b/src/dialogs/options.h index cb74f031..700b7e0b 100644 --- a/src/dialogs/options.h +++ b/src/dialogs/options.h @@ -4,9 +4,17 @@ #include "session/session.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + void charset_list(struct terminal *, void *, void *); void terminal_options(struct terminal *, void *, struct session *); void menu_language_list(struct terminal *, void *, void *); void resize_terminal_dialog(struct terminal *term); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/progress.c b/src/dialogs/progress.c index 8c74444a..8519414c 100644 --- a/src/dialogs/progress.c +++ b/src/dialogs/progress.c @@ -7,6 +7,7 @@ #include "elinks.h" #include "bfu/dialog.h" +#include "dialogs/progress.h" #include "intl/gettext/libintl.h" #include "network/progress.h" #include "terminal/draw.h" diff --git a/src/dialogs/progress.h b/src/dialogs/progress.h index f97503dd..6abcee07 100644 --- a/src/dialogs/progress.h +++ b/src/dialogs/progress.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_PROGRESS_H #define EL__DIALOGS_PROGRESS_H +#ifdef __cplusplus +extern "C" { +#endif + struct progress; struct terminal; @@ -20,4 +24,8 @@ draw_progress_bar(struct progress *progress, struct terminal *term, int x, int y, int width, unsigned char *text, struct color_pair *meter_color); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/status.h b/src/dialogs/status.h index 0c92dc4b..fc4bd78f 100644 --- a/src/dialogs/status.h +++ b/src/dialogs/status.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_STATUS_H #define EL__DIALOGS_STATUS_H +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct session; struct terminal; @@ -13,4 +17,8 @@ unsigned char * get_download_msg(struct download *download, struct terminal *term, int wide, int full, unsigned char *separator); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/apply.h b/src/document/css/apply.h index c5e2fa7f..0a2f2948 100644 --- a/src/document/css/apply.h +++ b/src/document/css/apply.h @@ -7,6 +7,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct css_stylesheet; struct html_context; struct html_element; @@ -33,4 +37,8 @@ css_apply(struct html_context *html_context, struct html_element *element, struct css_stylesheet *css, LIST_OF(struct html_element) *html_stack); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/css.h b/src/document/css/css.h index 7d5e0f92..e608816e 100644 --- a/src/document/css/css.h +++ b/src/document/css/css.h @@ -2,6 +2,10 @@ #ifndef EL__DOCUMENT_CSS_CSS_H #define EL__DOCUMENT_CSS_CSS_H +#ifdef __cplusplus +extern "C" { +#endif + struct css_stylesheet; struct module; struct uri; @@ -26,4 +30,8 @@ void import_css(struct css_stylesheet *css, struct uri *uri); int supports_css_media_type(const unsigned char *optstr, const unsigned char *token, size_t token_length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/parser.h b/src/document/css/parser.h index 67d00e21..ed678900 100644 --- a/src/document/css/parser.h +++ b/src/document/css/parser.h @@ -6,6 +6,11 @@ #define EL__DOCUMENT_CSS_PARSER_H #include "util/lists.h" + +#ifdef __cplusplus +extern "C" { +#endif + struct scanner; struct css_stylesheet; struct uri; @@ -25,4 +30,8 @@ void css_parse_properties(LIST_OF(struct css_property) *props, void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, const unsigned char *string, const unsigned char *end); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/property.h b/src/document/css/property.h index 27535b22..daa8be62 100644 --- a/src/document/css/property.h +++ b/src/document/css/property.h @@ -8,6 +8,10 @@ #include "util/color.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + enum css_property_type { CSS_PT_NONE, CSS_PT_BACKGROUND, @@ -137,4 +141,8 @@ struct css_property_info { /** This table contains info about all the known CSS properties. */ extern struct css_property_info css_property_info[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/scanner.h b/src/document/css/scanner.h index 5db7d853..b8b851e6 100644 --- a/src/document/css/scanner.h +++ b/src/document/css/scanner.h @@ -4,6 +4,10 @@ #include "util/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + /** The various token types and what they contain. Patterns taken from * the flex scanner declarations in the CSS 2 Specification. * @@ -115,4 +119,8 @@ check_css_precedence(int type, int skipto) return get_css_precedence(type) < get_css_precedence(skipto); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h index d97ea499..9a1c303f 100644 --- a/src/document/css/stylesheet.h +++ b/src/document/css/stylesheet.h @@ -5,6 +5,10 @@ #include "protocol/uri.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /* #define DEBUG_CSS */ /** @file @@ -195,4 +199,8 @@ void del_css_selector_from_set(struct css_selector *); void dump_css_selector_tree(struct css_selector_set *set); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/value.h b/src/document/css/value.h index 96ab9b5e..97dc4976 100644 --- a/src/document/css/value.h +++ b/src/document/css/value.h @@ -8,6 +8,9 @@ #include "document/css/property.h" #include "document/css/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif /** This function takes a value of a specified type from the given * scanner and converts it to a reasonable struct css_property-ready @@ -65,4 +68,9 @@ int css_parse_text_align_value(struct css_property_info *propinfo, int css_parse_white_space_value(struct css_property_info *propinfo, union css_property_value *value, struct scanner *scanner); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/docdata.h b/src/document/docdata.h index 1606966f..07714f2d 100644 --- a/src/document/docdata.h +++ b/src/document/docdata.h @@ -4,6 +4,10 @@ #include "document/document.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + #define LINES_GRANULARITY 0x7F #define LINE_GRANULARITY 0x0F #define LINK_GRANULARITY 0x7F @@ -17,4 +21,8 @@ struct line *realloc_lines(struct document *document, int y); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/document.h b/src/document/document.h index 5d9da917..a44872fe 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -10,6 +10,10 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document_refresh; struct el_form_control; @@ -319,4 +323,8 @@ extern struct module document_module; int find_tag(struct document *document, unsigned char *name, int namelen); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/renderer.h b/src/document/dom/renderer.h index ebb95c9c..5ef91bf8 100644 --- a/src/document/dom/renderer.h +++ b/src/document/dom/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_DOM_RENDERER_H #define EL__DOCUMENT_DOM_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_dom_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/rss.h b/src/document/dom/rss.h index 1f07f787..8b7c40e6 100644 --- a/src/document/dom/rss.h +++ b/src/document/dom/rss.h @@ -4,10 +4,17 @@ #include "dom/stack.h" +#ifdef __cplusplus +extern "C" { +#endif #define RSS_CONFIG_FLAGS \ (DOM_CONFIG_NORMALIZE_WHITESPACE | DOM_CONFIG_NORMALIZE_CHARACTERS) extern struct dom_stack_context_info dom_rss_renderer_context_info; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/source.h b/src/document/dom/source.h index 01b49224..5cd2a87f 100644 --- a/src/document/dom/source.h +++ b/src/document/dom/source.h @@ -4,7 +4,14 @@ #include "dom/stack.h" +#ifdef __cplusplus +extern "C" { +#endif extern struct dom_stack_context_info dom_source_renderer_context_info; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/util.h b/src/document/dom/util.h index 1827c52a..2857c7bf 100644 --- a/src/document/dom/util.h +++ b/src/document/dom/util.h @@ -12,6 +12,9 @@ #include "intl/charsets.h" #include "terminal/draw.h" +#ifdef __cplusplus +extern "C" { +#endif struct document; struct uri; @@ -51,4 +54,8 @@ void render_dom_text(struct dom_renderer *renderer, struct screen_char *template struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, unsigned char *uristring, int urilength); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/format.h b/src/document/format.h index 1c824f43..447764d2 100644 --- a/src/document/format.h +++ b/src/document/format.h @@ -3,6 +3,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct screen_char; @@ -35,5 +39,9 @@ struct text_style { void get_screen_char_template(struct screen_char *template_, struct document_options *options, struct text_style style); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/forms.h b/src/document/forms.h index 9d2e3146..55bfaebc 100644 --- a/src/document/forms.h +++ b/src/document/forms.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct menu_item; @@ -119,4 +123,8 @@ int has_form_submit(struct form *form); int get_form_control_link(struct document *document, struct el_form_control *fc); void done_form_control(struct el_form_control *fc); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/frames.h b/src/document/html/frames.h index f2ce8aa1..67a41ac8 100644 --- a/src/document/html/frames.h +++ b/src/document/html/frames.h @@ -4,6 +4,10 @@ #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct session; struct uri; @@ -48,4 +52,8 @@ void format_frames(struct session *ses, struct frameset_desc *fsd, struct docume void parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, int **new_values, int *new_values_count); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/internal.h b/src/document/html/internal.h index ff2224e2..eaec3c20 100644 --- a/src/document/html/internal.h +++ b/src/document/html/internal.h @@ -6,6 +6,10 @@ #include "document/html/parser.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct uri; @@ -145,4 +149,8 @@ void import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri, const unsigned char *unterminated_url, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parse-meta-refresh.h b/src/document/html/parse-meta-refresh.h index d81409d3..103ce036 100644 --- a/src/document/html/parse-meta-refresh.h +++ b/src/document/html/parse-meta-refresh.h @@ -1,6 +1,10 @@ #ifndef EL__DOCUMENT_HTML_PARSE_META_REFRESH_H #define EL__DOCUMENT_HTML_PARSE_META_REFRESH_H +#ifdef __cplusplus +extern "C" { +#endif + /** Parses a \ element. * * @param[in] content @@ -18,4 +22,8 @@ int html_parse_meta_refresh(const unsigned char *content, unsigned long *delay, unsigned char **url); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser.h b/src/document/html/parser.h index 7631278a..b957687f 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -10,6 +10,10 @@ #include "util/color.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct el_form_control; struct frameset_desc; @@ -205,4 +209,8 @@ void ln_break(struct html_context *html_context, int n); int get_color(struct html_context *html_context, unsigned char *a, unsigned char *c, color_T *rgb); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/forms.h b/src/document/html/parser/forms.h index 8515ee7b..e0dfa9f3 100644 --- a/src/document/html/parser/forms.h +++ b/src/document/html/parser/forms.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; element_handler_T html_button; @@ -13,4 +17,8 @@ element_handler_T html_select; element_handler_T html_option; element_handler_T html_textarea; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/general.h b/src/document/html/parser/general.h index 5c25b595..d6985c73 100644 --- a/src/document/html/parser/general.h +++ b/src/document/html/parser/general.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + element_handler_T html_address; element_handler_T html_base; element_handler_T html_blockquote; @@ -61,4 +65,8 @@ element_handler_T html_xmp_close; void html_apply_canvas_bgcolor(struct html_context *); void html_handle_body_meta(struct html_context *, unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/link.h b/src/document/html/parser/link.h index 9b087e87..5b5c900e 100644 --- a/src/document/html/parser/link.h +++ b/src/document/html/parser/link.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; void put_link_line(unsigned char *prefix, unsigned char *linkname, unsigned char *link, unsigned char *target, struct html_context *html_context); @@ -19,4 +23,8 @@ element_handler_T html_audio; element_handler_T html_video; element_handler_T html_embed; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/parse.h b/src/document/html/parser/parse.h index 1e53149e..50fbdd4a 100644 --- a/src/document/html/parser/parse.h +++ b/src/document/html/parser/parse.h @@ -2,6 +2,10 @@ #ifndef EL__DOCUMENT_HTML_PARSER_PARSE_H #define EL__DOCUMENT_HTML_PARSER_PARSE_H +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct document_options; struct part; @@ -76,4 +80,8 @@ int supports_html_media_attr(const unsigned char *media); void free_tags_lookup(void); void init_tags_lookup(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/stack.h b/src/document/html/parser/stack.h index 754166f7..5ff77700 100644 --- a/src/document/html/parser/stack.h +++ b/src/document/html/parser/stack.h @@ -4,6 +4,10 @@ #include "document/html/parser.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct html_element *search_html_stack(struct html_context *html_context, @@ -20,4 +24,8 @@ void kill_html_stack_until(struct html_context *html_context, int ls, ...); /* void dump_html_stack(struct html_context *html_context); */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/table.h b/src/document/html/parser/table.h index a97481a9..8926696e 100644 --- a/src/document/html/parser/table.h +++ b/src/document/html/parser/table.h @@ -4,6 +4,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct part; @@ -122,4 +126,8 @@ parse_table(unsigned char *html, unsigned char *eof, unsigned char **end, void free_table(struct table *table); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/renderer.h b/src/document/html/renderer.h index d27a63ce..c503e849 100644 --- a/src/document/html/renderer.h +++ b/src/document/html/renderer.h @@ -4,6 +4,10 @@ #include "document/document.h" +#ifdef __cplusplus +extern "C" { +#endif + struct el_box; struct cache_entry; struct html_context; @@ -70,4 +74,9 @@ struct part *format_html_part(struct html_context *html_context, unsigned char * int dec2qwerty(int num, unsigned char *link_sym, const unsigned char *key, int base); int qwerty2dec(const unsigned char *link_sym, const unsigned char *key, int base); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/tables.h b/src/document/html/tables.h index 84745b50..84007a9a 100644 --- a/src/document/html/tables.h +++ b/src/document/html/tables.h @@ -2,8 +2,16 @@ #ifndef EL__DOCUMENT_HTML_TABLES_H #define EL__DOCUMENT_HTML_TABLES_H +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; void format_table(unsigned char *, unsigned char *, unsigned char *, unsigned char **, struct html_context *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/libdom/renderer.h b/src/document/libdom/renderer.h index b489b6ba..0445fc7a 100644 --- a/src/document/libdom/renderer.h +++ b/src/document/libdom/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_LIBDOM_RENDERER_H #define EL__DOCUMENT_LIBDOM_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_source_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/options.h b/src/document/options.h index 60dc67ca..0743df83 100644 --- a/src/document/options.h +++ b/src/document/options.h @@ -6,6 +6,10 @@ #include "util/color.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; /** Active link coloring options */ @@ -144,6 +148,7 @@ struct document_options { #ifdef CONFIG_UTF8 unsigned int utf8:1; #endif /* CONFIG_UTF8 */ + unsigned int dump:1; /** Active link coloring. * This is mostly here to make use of this option cache so * link drawing is faster. --jonas */ @@ -182,4 +187,8 @@ int compare_opt(struct document_options *o1, struct document_options *o2); * and redraws the document. */ void toggle_document_option(struct session *ses, unsigned char *option_name); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/plain/renderer.h b/src/document/plain/renderer.h index 9cb93f60..d95e9ccd 100644 --- a/src/document/plain/renderer.h +++ b/src/document/plain/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_PLAIN_RENDERER_H #define EL__DOCUMENT_PLAIN_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_plain_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/refresh.h b/src/document/refresh.h index 2d8732cd..c9af5ef1 100644 --- a/src/document/refresh.h +++ b/src/document/refresh.h @@ -3,6 +3,10 @@ #include "main/timer.h" /* timer_id_T */ +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct uri; @@ -18,4 +22,8 @@ void done_document_refresh(struct document_refresh *refresh); void kill_document_refresh(struct document_refresh *refresh); void start_document_refreshes(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/renderer.c b/src/document/renderer.c index 234c7ad6..e49b4abc 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -388,7 +388,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, #ifdef CONFIG_ECMASCRIPT if (!vs->ecmascript_fragile) assert(vs->ecmascript); - if (!options->gradual_rerendering) { + if (!options->dump && !options->gradual_rerendering) { /* We also reset the state if the underlying document changed * from the last time we did the snippets. This may be * triggered i.e. when redrawing a document which has been diff --git a/src/document/renderer.h b/src/document/renderer.h index 350d7964..884c79b8 100644 --- a/src/document/renderer.h +++ b/src/document/renderer.h @@ -3,6 +3,10 @@ #include "document/document.h" +#ifdef __cplusplus +extern "C" { +#endif + struct conv_table; struct document_options; struct document_view; @@ -15,4 +19,8 @@ void render_document_frames(struct session *ses, int no_cache); struct conv_table *get_convert_table(unsigned char *head, int to_cp, int default_cp, int *from_cp, enum cp_status *cp_status, int ignore_server_cp); void sort_links(struct document *document); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/view.h b/src/document/view.h index cb514ab7..253b9c02 100644 --- a/src/document/view.h +++ b/src/document/view.h @@ -5,6 +5,9 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif struct document; struct view_state; @@ -38,4 +41,8 @@ struct document_view { && (doc_view)->vs->current_link < (doc_view)->document->nlinks) \ ? &(doc_view)->document->links[(doc_view)->vs->current_link] : NULL) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/code.h b/src/dom/code.h index 3a58ca0f..a8bcc98f 100644 --- a/src/dom/code.h +++ b/src/dom/code.h @@ -1,6 +1,10 @@ #ifndef EL_DOM_CODE_H #define EL_DOM_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + /** DOM status, error, and exception codes * * These enum values are used for return codes throughout the DOM engine. @@ -76,4 +80,8 @@ enum dom_code { DOM_CODE_TYPE_MISMATCH_ERR = 17, }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/configuration.h b/src/dom/configuration.h index 2661cbf5..dfe2364d 100644 --- a/src/dom/configuration.h +++ b/src/dom/configuration.h @@ -1,6 +1,10 @@ #ifndef EL__DOM_CONFIGURATION_H #define EL__DOM_CONFIGURATION_H +#ifdef __cplusplus +extern "C" { +#endif + struct dom_node; struct dom_stack; @@ -92,4 +96,8 @@ add_dom_config_normalizer(struct dom_stack *stack, struct dom_config *config, enum dom_config_flag parse_dom_config(unsigned char *flaglist, unsigned char separator); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/css/scanner.h b/src/dom/css/scanner.h index 3d3173db..894529cc 100644 --- a/src/dom/css/scanner.h +++ b/src/dom/css/scanner.h @@ -3,6 +3,10 @@ #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The various token types and what they contain. Patterns taken from * the flex scanner declarations in the CSS 2 Specification. */ enum css_token_type { @@ -108,4 +112,8 @@ check_css_precedence(int type, int skipto) return get_css_precedence(type) < get_css_precedence(skipto); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/node.h b/src/dom/node.h index 90dc3f73..3bb2b4c0 100644 --- a/src/dom/node.h +++ b/src/dom/node.h @@ -58,6 +58,10 @@ #include "dom/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dom_node_list; struct dom_document; @@ -475,4 +479,8 @@ get_dom_node_list_by_type(struct dom_node *parent, enum dom_node_type type) #define get_dom_node_list(parent, node) \ get_dom_node_list_by_type(parent, (node)->type) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/scanner.h b/src/dom/scanner.h index 9e830422..ece2705e 100644 --- a/src/dom/scanner.h +++ b/src/dom/scanner.h @@ -4,6 +4,10 @@ #include "dom/string.h" #include "util/error.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Define if you want a talking scanner */ /* #define DEBUG_DOM_SCANNER */ @@ -292,4 +296,8 @@ end_dom_token_scanning(struct dom_scanner *scanner, struct dom_scanner_token *en return get_dom_scanner_token(scanner); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/select.h b/src/dom/select.h index e794e1f5..ee8f3799 100644 --- a/src/dom/select.h +++ b/src/dom/select.h @@ -3,6 +3,9 @@ #include "dom/node.h" +#ifdef __cplusplus +extern "C" { +#endif /* FIXME: Namespaces; *|E */ @@ -354,4 +357,8 @@ select_dom_nodes(struct dom_select *select, struct dom_node *root); * +------------------------------------------------------------------------------------+ */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/docbook/docbook.h b/src/dom/sgml/docbook/docbook.h index 879b3427..693e39a8 100644 --- a/src/dom/sgml/docbook/docbook.h +++ b/src/dom/sgml/docbook/docbook.h @@ -4,6 +4,10 @@ #include "dom/stack.h" #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_docbook_info; #define DOCBOOK_(node, name, flags) \ @@ -27,4 +31,8 @@ enum docbook_attribute_type { #undef DOCBOOK_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/dump.h b/src/dom/sgml/dump.h index ac21a85a..fad6b157 100644 --- a/src/dom/sgml/dump.h +++ b/src/dom/sgml/dump.h @@ -3,10 +3,18 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + struct dom_stack; struct dom_stack_context; struct dom_stack_context * add_sgml_file_dumper(struct dom_stack *stack, FILE *file); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/html/html.h b/src/dom/sgml/html/html.h index 31747dde..b2c91baa 100644 --- a/src/dom/sgml/html/html.h +++ b/src/dom/sgml/html/html.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_html_info; #undef VERSION @@ -28,4 +32,8 @@ enum html_attribute_type { #undef HTML_ #undef HTM2_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/parser.h b/src/dom/sgml/parser.h index 4c338d50..fba7a541 100644 --- a/src/dom/sgml/parser.h +++ b/src/dom/sgml/parser.h @@ -7,6 +7,10 @@ #include "dom/sgml/sgml.h" #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + struct sgml_parser; struct string; struct uri; @@ -144,4 +148,8 @@ parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize, int c */ unsigned int get_sgml_parser_line_number(struct sgml_parser *parser); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/rss/rss.h b/src/dom/sgml/rss/rss.h index ea04c39e..690b1459 100644 --- a/src/dom/sgml/rss/rss.h +++ b/src/dom/sgml/rss/rss.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_rss_info; #define RSS_(node, name, flags) SGML_NODE_INFO_TYPE(RSS, node, name) @@ -25,4 +29,8 @@ enum rss_attribute_type { #undef RSS_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/scanner.h b/src/dom/sgml/scanner.h index 7c3edcfd..a531dfdd 100644 --- a/src/dom/sgml/scanner.h +++ b/src/dom/sgml/scanner.h @@ -3,6 +3,10 @@ #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + enum sgml_token_type { /* Char tokens: */ @@ -87,4 +91,8 @@ extern struct dom_scanner_info sgml_scanner_info; #define skip_sgml_tokens(scanner, type) \ skip_dom_scanner_tokens(scanner, type, get_sgml_precedence(type)) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/sgml.h b/src/dom/sgml/sgml.h index f7b8048c..24d372eb 100644 --- a/src/dom/sgml/sgml.h +++ b/src/dom/sgml/sgml.h @@ -6,6 +6,10 @@ #include "dom/node.h" #include "dom/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The flags stored in the attribute sgml node info data */ /* TODO: Other potential flags (there can be only 16) * @@ -91,4 +95,8 @@ struct sgml_info { struct sgml_info *get_sgml_info(enum sgml_document_type doctype); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/xbel/xbel.h b/src/dom/sgml/xbel/xbel.h index 493c4940..fe11d243 100644 --- a/src/dom/sgml/xbel/xbel.h +++ b/src/dom/sgml/xbel/xbel.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_xbel_info; #define XBEL_(node, name, flags) SGML_NODE_INFO_TYPE(XBEL, node, name) @@ -25,4 +29,8 @@ enum xbel_attribute_type { #undef XBEL_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/stack.h b/src/dom/stack.h index 3c230ef4..5a60b649 100644 --- a/src/dom/stack.h +++ b/src/dom/stack.h @@ -47,6 +47,10 @@ #include "util/error.h" #include "util/hash.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dom_stack; /** DOM stack callback @@ -334,4 +338,8 @@ search_dom_stack(struct dom_stack *stack, enum dom_node_type type, * to the stack. */ void walk_dom_nodes(struct dom_stack *stack, struct dom_node *root); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/string.h b/src/dom/string.h index f6032538..441c0f98 100644 --- a/src/dom/string.h +++ b/src/dom/string.h @@ -4,6 +4,10 @@ #include "util/conv.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* For now DOM has it's own little string library. Mostly because there are * some memory overhead associated with util/string's block-based allocation * scheme which is optimized for building strings and quickly dispose of it. @@ -74,4 +78,8 @@ add_to_dom_string(struct dom_string *string, unsigned char *str, size_t len) #define isquote(c) ((c) == '"' || (c) == '\'') +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 8bf25de2..55273fad 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -32,11 +32,7 @@ struct ecmascript_interpreter { /* The code evaluated by setTimeout() */ struct string code; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) struct heartbeat *heartbeat; -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - time_t exec_start; -#endif /* This is a cross-rerenderings accumulator of * @document.onload_snippets (see its description for juicy details). diff --git a/src/ecmascript/empty.cpp b/src/ecmascript/empty.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/ecmascript/meson.build b/src/ecmascript/meson.build index 8b9d01cd..af4aec2b 100644 --- a/src/ecmascript/meson.build +++ b/src/ecmascript/meson.build @@ -13,7 +13,7 @@ else endif if CONFIG_ANY_SPIDERMONKEY - srcs += files('spidermonkey-shared.c') + srcs += files('spidermonkey-shared.c', 'empty.cpp') endif srcs += files('ecmascript.c') diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index 61b22e69..d23922dd 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -44,7 +44,7 @@ spidermonkey_runtime_addref(void) assert(spidermonkey_empty_context == NULL); if_assert_failed return 0; - spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L); + spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L, JS_USE_HELPER_THREADS); if (!spidermonkey_runtime) return 0; spidermonkey_empty_context = JS_NewContext(spidermonkey_runtime, diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 72ea1049..74e709ad 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -87,7 +87,7 @@ jsid_to_string(JSContext *ctx, jsid *id) return jsval_to_string(ctx, &v); } -#define ELINKS_CAST_PROP_PARAMS JSObject *obj = *(hobj._); \ - jsval *vp = (hvp._); +#define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \ + jsval *vp = (hvp.address()); #endif diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 2c8ba385..6555bbce 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -50,7 +50,7 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" - +using namespace JS; /*** Global methods */ @@ -111,34 +111,6 @@ reported: JS_ClearPendingException(ctx); } -#if !defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) && defined(HAVE_JS_SETBRANCHCALLBACK) -static JSBool -safeguard(JSContext *ctx, JSScript *script) -{ - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); - struct session *ses = interpreter->vs->doc_view->session; - int max_exec_time = get_opt_int("ecmascript.max_exec_time", ses); - - if (time(NULL) - interpreter->exec_start > max_exec_time) { - struct terminal *term = ses->tab->term; - - /* A killer script! Alert! */ - ecmascript_timeout_dialog(term, max_exec_time); - return JS_FALSE; - } - return JS_TRUE; -} - -static void -setup_safeguard(struct ecmascript_interpreter *interpreter, - JSContext *ctx) -{ - interpreter->exec_start = time(NULL); - JS_SetBranchCallback(ctx, safeguard); -} -#endif - - static void spidermonkey_init(struct module *xxx) { @@ -157,8 +129,9 @@ void * spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) { JSContext *ctx; - JSObject *window_obj, *document_obj, *forms_obj, *history_obj, *location_obj, + JSObject *document_obj, *forms_obj, *history_obj, *location_obj, *statusbar_obj, *menubar_obj, *navigator_obj; + JSAutoCompartment *ac = NULL; assert(interpreter); if (!js_module_init_ok) return NULL; @@ -168,17 +141,19 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!ctx) return NULL; interpreter->backend_data = ctx; + JSAutoRequest ar(ctx); JS_SetContextPrivate(ctx, interpreter); - JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JSOPTION_METHODJIT); - JS_SetVersion(ctx, JSVERSION_LATEST); + JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS_SetErrorReporter(ctx, error_reporter); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) JS_SetOperationCallback(ctx, heartbeat_callback); -#endif - + RootedObject window_obj(ctx); window_obj = JS_NewGlobalObject(ctx, &window_class, NULL); - if (!window_obj) goto release_and_fail; + if (window_obj) { + ac = new JSAutoCompartment(ctx, window_obj); + } else { + goto release_and_fail; + } if (!JS_InitStandardClasses(ctx, window_obj)) { goto release_and_fail; @@ -288,18 +263,12 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, } ctx = interpreter->backend_data; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif interpreter->ret = ret; - JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx), + JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), code->source, code->length, "", 0, &rval); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) done_heartbeat(interpreter->heartbeat); -#endif } @@ -315,17 +284,12 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, if (!js_module_init_ok) return NULL; ctx = interpreter->backend_data; interpreter->ret = NULL; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif - ret = JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx), + ret = JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), code->source, code->length, "", 0, &rval); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) done_heartbeat(interpreter->heartbeat); -#endif + if (ret == JS_FALSE) { return NULL; } @@ -352,21 +316,15 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, ctx = interpreter->backend_data; interpreter->ret = NULL; - fun = JS_CompileFunction(ctx, JS_GetGlobalObject(ctx), "", 0, NULL, code->source, + fun = JS_CompileFunction(ctx, JS_GetGlobalForScopeChain(ctx), "", 0, NULL, code->source, code->length, "", 0); if (!fun) return -1; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif - ret = JS_CallFunction(ctx, JS_GetGlobalObject(ctx), fun, 0, NULL, &rval); - -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) + ret = JS_CallFunction(ctx, JS_GetGlobalForScopeChain(ctx), fun, 0, NULL, &rval); done_heartbeat(interpreter->heartbeat); -#endif + if (ret == 2) { /* onClick="history.back()" */ return 0; } diff --git a/src/ecmascript/spidermonkey/Makefile b/src/ecmascript/spidermonkey/Makefile index 377ca804..1d712994 100644 --- a/src/ecmascript/spidermonkey/Makefile +++ b/src/ecmascript/spidermonkey/Makefile @@ -2,8 +2,6 @@ top_builddir=../../.. include $(top_builddir)/Makefile.config INCLUDES += $(SPIDERMONKEY_CFLAGS) -OBJS-$(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) += heartbeat.o - -OBJS = document.o form.o location.o navigator.o unibar.o window.o +OBJS = document.o form.o heartbeat.o location.o navigator.o unibar.o window.o include $(top_srcdir)/Makefile.lib diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 026f0671..72f084eb 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -47,20 +47,20 @@ #include "viewer/text/vs.h" -static JSBool document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @document_class object must have a @window_class parent. */ JSClass document_class = { "document", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, document_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; #ifdef CONFIG_COOKIES static JSBool -document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -94,7 +94,7 @@ document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -document_set_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -121,7 +121,7 @@ document_set_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid #endif static JSBool -document_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -141,7 +141,7 @@ document_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h } static JSBool -document_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -169,7 +169,7 @@ document_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h static JSBool -document_get_property_referrer(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_referrer(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -220,7 +220,7 @@ document_get_property_referrer(JSContext *ctx, JSHandleObject hobj, JSHandleId h static JSBool -document_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -247,7 +247,7 @@ document_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -document_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -277,7 +277,7 @@ document_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -document_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -304,7 +304,7 @@ document_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -document_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -347,10 +347,10 @@ JSPropertySpec document_props[] = { /* @document_class.getProperty */ static JSBool -document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 736f75b4..64c53ad3 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -47,7 +47,33 @@ #include "viewer/text/vs.h" -static JSClass form_class; /* defined below */ +//static JSClass form_class; /* defined below */ + +static JSBool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); + +static void form_finalize(JSFreeOp *op, JSObject *obj); + +/* Each @form_class object must have a @document_class parent. */ +static JSClass form_class = { + "form", + JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ + JS_PropertyStub, JS_PropertyStub, + form_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, form_finalize +}; + /* Accordingly to the JS specs, each input type should own object. That'd be a @@ -55,15 +81,15 @@ static JSClass form_class; /* defined below */ * HTMLInputElement. The difference could be spotted only by some clever tricky * JS code, but I hope it doesn't matter anywhere. --pasky */ -static JSBool input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); static void input_finalize(JSFreeOp *op, JSObject *obj); /* Each @input_class object must have a @form_class parent. */ static JSClass input_class = { "input", /* here, we unleash ourselves */ JSCLASS_HAS_PRIVATE, /* struct form_state *, or NULL if detached */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, input_get_property, input_set_property, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, input_finalize }; @@ -97,7 +123,7 @@ static struct form_state *input_get_form_state(JSContext *ctx, JSObject *jsinput static JSBool -input_get_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -163,7 +189,7 @@ input_get_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_set_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -220,7 +246,7 @@ input_set_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_get_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -268,7 +294,7 @@ input_get_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu } static JSBool -input_set_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -313,7 +339,7 @@ input_set_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -input_get_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -334,7 +360,7 @@ input_get_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_set_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -381,7 +407,7 @@ input_set_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_defaultChecked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_defaultChecked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -429,7 +455,7 @@ input_get_property_defaultChecked(JSContext *ctx, JSHandleObject hobj, JSHandleI } static JSBool -input_get_property_defaultValue(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_defaultValue(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -478,7 +504,7 @@ input_get_property_defaultValue(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -input_get_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -527,7 +553,7 @@ input_get_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_set_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -575,7 +601,7 @@ input_set_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_form(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_form(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -597,7 +623,7 @@ input_get_property_form(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -645,7 +671,7 @@ input_get_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_set_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -691,7 +717,7 @@ input_set_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -740,7 +766,7 @@ input_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM /* @input_class.setProperty */ static JSBool -input_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -785,7 +811,7 @@ input_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSB } static JSBool -input_get_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -835,7 +861,7 @@ input_get_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, /* @input_class.setProperty */ static JSBool -input_set_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -883,7 +909,7 @@ input_set_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -934,7 +960,7 @@ input_get_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId /* @input_class.setProperty */ static JSBool -input_set_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -989,7 +1015,7 @@ input_set_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -input_get_property_size(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_size(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1037,7 +1063,7 @@ input_get_property_size(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1093,7 +1119,7 @@ input_get_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu } static JSBool -input_set_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1146,7 +1172,7 @@ input_set_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -input_get_property_tabIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_tabIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1204,7 +1230,7 @@ input_get_property_tabIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1267,7 +1293,7 @@ input_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1287,7 +1313,7 @@ input_get_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -input_set_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1390,10 +1416,10 @@ input_get_form_state(JSContext *ctx, JSObject *jsinput) /* @input_class.getProperty */ static JSBool -input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_form; /* instance of @form_class */ JSObject *parent_doc; /* instance of @document_class */ @@ -1547,10 +1573,10 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl /* @input_class.setProperty */ static JSBool -input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_form; /* instance of @form_class */ JSObject *parent_doc; /* instance of @document_class */ @@ -1916,13 +1942,13 @@ get_form_control_object(JSContext *ctx, JSObject *jsform, static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv); -static JSBool form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @form_elements_class object must have a @form_class parent. */ static JSClass form_elements_class = { "elements", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, form_elements_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -1939,7 +1965,7 @@ static const spidermonkeyFunctionSpec form_elements_funcs[] = { { NULL } }; -static JSBool form_elements_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Tinyids of properties. Use negative values to distinguish these * from array indexes (elements[INT] for INT>=0 is equivalent to @@ -1954,10 +1980,10 @@ static JSPropertySpec form_elements_props[] = { }; static JSBool -form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); jsval idval; JSObject *parent_form; /* instance of @form_class */ @@ -2018,7 +2044,7 @@ form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_elements_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2206,31 +2232,6 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval -static JSBool form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); - -static void form_finalize(JSFreeOp *op, JSObject *obj); - -/* Each @form_class object must have a @document_class parent. */ -static JSClass form_class = { - "form", - JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ - JS_PropertyStub, JS_PropertyStub, - form_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, form_finalize -}; - /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). * ECMAScript code should not use these directly as in form[-1]; @@ -2282,10 +2283,10 @@ form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv) /* @form_class.getProperty */ static JSBool -form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ JSObject *parent_doc; /* instance of @document_class */ JSObject *parent_win; /* instance of @window_class */ @@ -2419,7 +2420,7 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable static JSBool -form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2456,7 +2457,7 @@ form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2500,7 +2501,7 @@ form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2530,7 +2531,7 @@ form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2580,7 +2581,7 @@ form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, /* @form_class.setProperty */ static JSBool -form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2627,7 +2628,7 @@ form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2665,7 +2666,7 @@ form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2714,7 +2715,7 @@ form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS /* @form_class.setProperty */ static JSBool -form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2758,7 +2759,7 @@ form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2797,7 +2798,7 @@ form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu /* @form_class.setProperty */ static JSBool -form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2834,7 +2835,7 @@ form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2871,7 +2872,7 @@ form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_set_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -3062,8 +3063,8 @@ spidermonkey_detach_form_view(struct form_view *fv) } -static JSBool forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool forms_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @forms_class object must have a @document_class parent. */ JSClass forms_class = { @@ -3121,10 +3122,10 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc, /* @forms_class.getProperty */ static JSBool -forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); jsval idval; JSObject *parent_doc; /* instance of @document_class */ @@ -3177,7 +3178,7 @@ forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl } static JSBool -forms_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index a5a44bf5..33cc6b1d 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -52,7 +52,7 @@ static JSBool history_go(JSContext *ctx, unsigned int argc, jsval *rval); JSClass history_class = { "history", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -128,14 +128,14 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval) } -static JSBool location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool location_set_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); /* Each @location_class object must have a @window_class parent. */ JSClass location_class = { "location", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -154,7 +154,7 @@ JSPropertySpec location_props[] = { static JSBool -location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -179,7 +179,7 @@ location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -location_set_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSObject *parent_win; /* instance of @window_class */ diff --git a/src/ecmascript/spidermonkey/meson.build b/src/ecmascript/spidermonkey/meson.build index 2eaecc44..2d58e359 100644 --- a/src/ecmascript/spidermonkey/meson.build +++ b/src/ecmascript/spidermonkey/meson.build @@ -1,6 +1,3 @@ #INCLUDES += $(SPIDERMONKEY_CFLAGS) -if conf_data.get('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT') - srcs += files('heartbeat.c') -endif -srcs += files('document.c', 'form.c', 'location.c', 'navigator.c', 'unibar.c', 'window.c') +srcs += files('document.c', 'form.c', 'heartbeat.c', 'location.c', 'navigator.c', 'unibar.c', 'window.c') diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index e253af46..57f2dcce 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -44,17 +44,17 @@ #include "viewer/text/vs.h" -static JSBool navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_userAgent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); JSClass navigator_class = { "navigator", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -87,7 +87,7 @@ JSPropertySpec navigator_props[] = { /* @navigator_class.getProperty */ static JSBool -navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -98,7 +98,7 @@ navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandle } static JSBool -navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -109,7 +109,7 @@ navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId h } static JSBool -navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -120,7 +120,7 @@ navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleI } static JSBool -navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -135,7 +135,7 @@ navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -146,7 +146,7 @@ navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -navigator_get_property_userAgent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS unsigned char *optstr; diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index f26cb180..2a12829f 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -44,14 +44,14 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" -static JSBool unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool unibar_set_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); /* Each @menubar_class object must have a @window_class parent. */ JSClass menubar_class = { "menubar", JSCLASS_HAS_PRIVATE, /* const char * "t" */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -59,7 +59,7 @@ JSClass menubar_class = { JSClass statusbar_class = { "statusbar", JSCLASS_HAS_PRIVATE, /* const char * "s" */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -79,7 +79,7 @@ JSPropertySpec unibar_props[] = { static JSBool -unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -126,7 +126,7 @@ unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -unibar_set_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index bee163ab..517ab4b8 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -44,19 +44,19 @@ #include "viewer/text/vs.h" -static JSBool window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_window(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); JSClass window_class = { "window", JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS, /* struct view_state * */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, window_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -102,7 +102,7 @@ try_resolve_frame(struct document_view *doc_view, unsigned char *id) if (target->vs.ecmascript_fragile) ecmascript_reset_state(&target->vs); if (!target->vs.ecmascript) return NULL; - return JS_GetGlobalObject(target->vs.ecmascript->backend_data); + return JS_GetGlobalForScopeChain(target->vs.ecmascript->backend_data); } #if 0 @@ -128,10 +128,10 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe) /* @window_class.getProperty */ static JSBool -window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -211,7 +211,7 @@ found_parent: if (doc_view->vs.ecmascript_fragile) ecmascript_reset_state(&doc_view->vs); assert(doc_view->ecmascript); - object_to_jsval(ctx, vp, JS_GetGlobalObject(doc_view->ecmascript->backend_data)); + object_to_jsval(ctx, vp, JS_GetGlobalForScopeChain(doc_view->ecmascript->backend_data)); break; } #endif @@ -228,7 +228,7 @@ found_parent: ecmascript_reset_state(top_view->vs); if (!top_view->vs->ecmascript) break; - newjsframe = JS_GetGlobalObject(top_view->vs->ecmascript->backend_data); + newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -439,7 +439,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval) } static JSBool -window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -455,7 +455,7 @@ window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -482,7 +482,7 @@ window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -498,7 +498,7 @@ window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -514,7 +514,7 @@ window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -535,7 +535,7 @@ window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -561,7 +561,7 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM ecmascript_reset_state(top_view->vs); if (!top_view->vs->ecmascript) return JS_TRUE; - newjsframe = JS_GetGlobalObject(top_view->vs->ecmascript->backend_data); + newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -580,7 +580,7 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -window_get_property_window(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { return window_get_property_self(ctx, hobj, hid, hvp); } diff --git a/src/encoding/brotli.h b/src/encoding/brotli.h index 4f2b4247..b8972cb6 100644 --- a/src/encoding/brotli.h +++ b/src/encoding/brotli.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_BROTLI extern const struct decoding_backend brotli_decoding_backend; #else #define brotli_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/bzip2.h b/src/encoding/bzip2.h index 1367500e..b25a2ce1 100644 --- a/src/encoding/bzip2.h +++ b/src/encoding/bzip2.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_BZIP2 extern const struct decoding_backend bzip2_decoding_backend; #else #define bzip2_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/deflate.h b/src/encoding/deflate.h index 4d3d2c3a..b3b60b89 100644 --- a/src/encoding/deflate.h +++ b/src/encoding/deflate.h @@ -3,6 +3,10 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_GZIP extern const struct decoding_backend deflate_decoding_backend; extern const struct decoding_backend gzip_decoding_backend; @@ -11,4 +15,8 @@ extern const struct decoding_backend gzip_decoding_backend; #define gzip_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/encoding.h b/src/encoding/encoding.h index 2eee7d71..d24cbe64 100644 --- a/src/encoding/encoding.h +++ b/src/encoding/encoding.h @@ -4,6 +4,10 @@ #include "network/state.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + enum stream_encoding { ENCODING_NONE = 0, ENCODING_GZIP, @@ -47,4 +51,8 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page); /* Reads the file with the given @filename into the string @source. */ struct connection_state read_encoded_file(struct string *filename, struct string *source); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/lzma.h b/src/encoding/lzma.h index 9268aee1..08d28d99 100644 --- a/src/encoding/lzma.h +++ b/src/encoding/lzma.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_LZMA extern const struct decoding_backend lzma_decoding_backend; #else #define lzma_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/zstd.h b/src/encoding/zstd.h index 12aefb59..f67ad706 100644 --- a/src/encoding/zstd.h +++ b/src/encoding/zstd.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_ZSTD extern const struct decoding_backend zstd_decoding_backend; #else #define zstd_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/formhist/dialogs.h b/src/formhist/dialogs.h index e3a02455..a72cc234 100644 --- a/src/formhist/dialogs.h +++ b/src/formhist/dialogs.h @@ -3,9 +3,17 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; extern struct hierbox_browser formhist_browser; void formhist_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/formhist/formhist.h b/src/formhist/formhist.h index 7dcd7adc..a5c8a31d 100644 --- a/src/formhist/formhist.h +++ b/src/formhist/formhist.h @@ -7,6 +7,10 @@ #include "session/session.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct formhist_data { OBJECT_HEAD(struct formhist_data); @@ -36,4 +40,8 @@ int load_formhist_from_file(void); extern struct module forms_history_module; +#ifdef __cplusplus +} +#endif + #endif /* EL__FORMHIST_FORMHIST_H */ diff --git a/src/globhist/dialogs.h b/src/globhist/dialogs.h index 550bc3f8..338aaf30 100644 --- a/src/globhist/dialogs.h +++ b/src/globhist/dialogs.h @@ -4,7 +4,15 @@ #include "bfu/hierbox.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser globhist_browser; void history_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/globhist/globhist.h b/src/globhist/globhist.h index c3b5847f..92c8fee2 100644 --- a/src/globhist/globhist.h +++ b/src/globhist/globhist.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct input_history; @@ -31,4 +35,8 @@ struct global_history_item *get_global_history_item(unsigned char *); void add_global_history_item(unsigned char *, unsigned char *, time_t); int globhist_simple_search(unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 5b8fcb32..b2fc8b5f 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -1,6 +1,10 @@ #ifndef EL__INTL_CHARSETS_H #define EL__INTL_CHARSETS_H +#ifdef __cplusplus +extern "C" { +#endif + struct hash; /* The TRE check in configure.ac assumes unicode_val_T is uint32_t. */ @@ -193,4 +197,8 @@ void free_charsets_lookup(void); #define get_utf16_high_surrogate(u) (0xD800 + (((u) - 0x10000) >> 10)) #define get_utf16_low_surrogate(u) (0xDC00 + ((u) & 0x3FF)) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/gettext/dcigettext.c b/src/intl/gettext/dcigettext.c index 55a7b8e3..a683b628 100644 --- a/src/intl/gettext/dcigettext.c +++ b/src/intl/gettext/dcigettext.c @@ -46,6 +46,7 @@ extern int errno; #endif #include +#include #include #include diff --git a/src/intl/gettext/gettext.h b/src/intl/gettext/gettext.h index 1026a1cf..7ab6ba44 100644 --- a/src/intl/gettext/gettext.h +++ b/src/intl/gettext/gettext.h @@ -22,6 +22,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* The magic number of the GNU message catalog format. */ #define _MAGIC 0x950412de #define _MAGIC_SWAPPED 0xde120495 @@ -91,4 +95,8 @@ struct string_desc { nls_uint32 offset; }; +#ifdef __cplusplus +} +#endif + #endif /* gettext.h */ diff --git a/src/intl/gettext/gettextP.h b/src/intl/gettext/gettextP.h index 088671df..ee3f05fd 100644 --- a/src/intl/gettext/gettextP.h +++ b/src/intl/gettext/gettextP.h @@ -30,6 +30,11 @@ #include "intl/gettext/loadinfo.h" #include "intl/gettext/gettext.h" /* Get nls_uint32. */ +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef W #define W(flag, data) ((flag) ? SWAP (data) : (data)) #endif @@ -163,4 +168,8 @@ extern unsigned char *bind_textdomain_codeset__(const unsigned char *__domainnam extern void gettext_free_exp__(struct expression * exp); extern int gettext__parse(struct parse_args *arg); +#ifdef __cplusplus +} +#endif + #endif /* gettextP.h */ diff --git a/src/intl/gettext/libgettext.h b/src/intl/gettext/libgettext.h index 1b7447ec..630dc4b1 100644 --- a/src/intl/gettext/libgettext.h +++ b/src/intl/gettext/libgettext.h @@ -18,6 +18,10 @@ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* NLS can be disabled through the configure --disable-nls option. */ #if CONFIG_NLS @@ -45,4 +49,8 @@ translation is needed. Instead the string itself is the result. */ #define gettext_noop(Str) (Str) +#ifdef __cplusplus +} +#endif + #endif /* _LIBGETTEXT_H */ diff --git a/src/intl/gettext/libgnuintl.h b/src/intl/gettext/libgnuintl.h index 24ef5c65..cf3ae49f 100644 --- a/src/intl/gettext/libgnuintl.h +++ b/src/intl/gettext/libgnuintl.h @@ -25,6 +25,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef LC_MESSAGES #define LC_MESSAGES 1729 #endif @@ -103,4 +107,8 @@ #endif /* Optimizing. */ +#ifdef __cplusplus +} +#endif + #endif /* libintl.h */ diff --git a/src/intl/gettext/libintl.h b/src/intl/gettext/libintl.h index 15d6804b..0a3f00e8 100644 --- a/src/intl/gettext/libintl.h +++ b/src/intl/gettext/libintl.h @@ -17,6 +17,10 @@ #include "intl/charsets.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + /* no-op - just for marking */ #define N_(msg) (gettext_noop(msg)) @@ -196,4 +200,8 @@ extern void set_language(int language); #endif /* CONFIG_NLS */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/gettext/loadinfo.h b/src/intl/gettext/loadinfo.h index fe47c90c..d9d6ab81 100644 --- a/src/intl/gettext/loadinfo.h +++ b/src/intl/gettext/loadinfo.h @@ -19,6 +19,10 @@ #ifndef _LOADINFO_H #define _LOADINFO_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* Separator in PATH like lists of pathnames. */ #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ /* Win32, OS/2, DOS */ @@ -84,4 +88,8 @@ extern int _nl_explode_name(unsigned char *name, const unsigned char **language, extern unsigned char *_nl_find_language(const unsigned char *name); +#ifdef __cplusplus +} +#endif + #endif /* loadinfo.h */ diff --git a/src/intl/uni_7b.inc b/src/intl/uni_7b.inc index 44f525b4..2d90491f 100644 --- a/src/intl/uni_7b.inc +++ b/src/intl/uni_7b.inc @@ -2454,7 +2454,7 @@ static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { {0x0000ff62, "\""}, {0x0000ff63, "\""}, {0x0000ff64, ","}, - {-1, NULL} + {UINT32_MAX, NULL} }; #define N_UNICODE_7B 2452 diff --git a/src/main/event.h b/src/main/event.h index 145b95a3..4c865e3e 100644 --- a/src/main/event.h +++ b/src/main/event.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define EVENT_NONE (-1) @@ -119,5 +123,8 @@ void init_event(void); void done_event(void); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/main/interlink.h b/src/main/interlink.h index 5538e3e8..5d6a687b 100644 --- a/src/main/interlink.h +++ b/src/main/interlink.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_INTERLINK_H #define EL__MAIN_INTERLINK_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_INTERLINK int init_interlink(void); void done_interlink(void); @@ -9,4 +13,8 @@ void done_interlink(void); #define done_interlink() #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/main.c b/src/main/main.c index 22a90893..5b291be6 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -202,6 +202,7 @@ init(void) /* The ECMAScript code is not good at coping with this. And it * makes currently no sense to evaluate ECMAScript in this * context anyway. */ + printf("AAA\n"); get_opt_bool("ecmascript.enable", NULL) = 0; #endif if (!list_empty(url_list)) { diff --git a/src/main/main.h b/src/main/main.h index cddbb53f..5c330058 100644 --- a/src/main/main.h +++ b/src/main/main.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_MAIN_H #define EL__MAIN_MAIN_H +#ifdef __cplusplus +extern "C" { +#endif + enum retval { RET_OK, /* All is well */ RET_ERROR, /* Failed to fetch URL or write document when dumping */ @@ -23,4 +27,8 @@ extern struct program program; void shrink_memory(int); void parse_options_again(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/module.h b/src/main/module.h index 891bb7ad..002367c3 100644 --- a/src/main/module.h +++ b/src/main/module.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "main/event.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The module record */ struct module { @@ -87,4 +91,8 @@ void unregister_modules_options(struct module *modules[]); void init_modules(struct module *modules[]); void done_modules(struct module *modules[]); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/object.h b/src/main/object.h index 2d77b285..9218efde 100644 --- a/src/main/object.h +++ b/src/main/object.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + #if 0 #define DEBUG_REFCOUNT #endif @@ -81,4 +85,8 @@ struct object_head { object_lock_debug(obj, "initialized"); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/select.h b/src/main/select.h index a40b4861..02c48781 100644 --- a/src/main/select.h +++ b/src/main/select.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_SELECT_H #define EL__MAIN_SELECT_H +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*select_handler_T)(void *); /* Start the select loop after calling the passed @init() function. */ @@ -47,4 +51,9 @@ int can_read(int fd); int can_write(int fd); void terminate_select(void); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/timer.h b/src/main/timer.h index e5523afe..54cd6537 100644 --- a/src/main/timer.h +++ b/src/main/timer.h @@ -3,6 +3,10 @@ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Only available internally. */ struct timer; @@ -24,4 +28,8 @@ void kill_timer(timer_id_T *id); int get_next_timer_time(timeval_T *t); void set_events_for_timer(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/version.h b/src/main/version.h index 34c5a672..138b8b4a 100644 --- a/src/main/version.h +++ b/src/main/version.h @@ -1,9 +1,17 @@ #ifndef EL__MAIN_VERSION_H #define EL__MAIN_VERSION_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; unsigned char *get_dyn_full_version(struct terminal *term, int more); void init_static_version(void); +#ifdef __cplusplus +} +#endif + #endif /* EL__MODULES_VERSION_H */ diff --git a/src/meson.build b/src/meson.build index b7dfb704..6b09afbb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -41,7 +41,7 @@ srcs += files('vernum.c') incs = include_directories('..', '.') -extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] +extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] + extracflags elinks = executable( 'elinks', srcs, diff --git a/src/mime/backend/common.h b/src/mime/backend/common.h index 7c01443c..c4b5debd 100644 --- a/src/mime/backend/common.h +++ b/src/mime/backend/common.h @@ -4,6 +4,10 @@ #include "mime/mime.h" +#ifdef __cplusplus +extern "C" { +#endif + struct mime_backend { /* Resolve the content type from the @extension. */ unsigned char *(*get_content_type)(unsigned char *extension); @@ -29,4 +33,8 @@ struct mime_handler * init_mime_handler(unsigned char *program, unsigned char *description, unsigned char *backend_name, int ask, int block); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/default.h b/src/mime/backend/default.h index 73453107..45719471 100644 --- a/src/mime/backend/default.h +++ b/src/mime/backend/default.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend default_mime_backend; extern struct module default_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/mailcap.h b/src/mime/backend/mailcap.h index bf81fd37..639a7fd0 100644 --- a/src/mime/backend/mailcap.h +++ b/src/mime/backend/mailcap.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend mailcap_mime_backend; extern struct module mailcap_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/mimetypes.h b/src/mime/backend/mimetypes.h index f6a188c5..5ae04c32 100644 --- a/src/mime/backend/mimetypes.h +++ b/src/mime/backend/mimetypes.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend mimetypes_mime_backend; extern struct module mimetypes_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/dialogs.h b/src/mime/dialogs.h index 055eeab1..c6b3fd20 100644 --- a/src/mime/dialogs.h +++ b/src/mime/dialogs.h @@ -1,10 +1,18 @@ #ifndef EL__MIME_DIALOGS_H #define EL__MIME_DIALOGS_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; void menu_add_ext(struct terminal *, void *, void *); void menu_del_ext(struct terminal *, void *, void *); void menu_list_ext(struct terminal *, void *, void *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/mime.h b/src/mime/mime.h index 01524fdd..3e60c26c 100644 --- a/src/mime/mime.h +++ b/src/mime/mime.h @@ -3,6 +3,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct uri; @@ -33,4 +37,8 @@ get_mime_type_handler(unsigned char *content_type, int xwin); * empty ("") (ie. http://example.com/?crash=elinks). */ struct string *add_mime_filename_to_string(struct string *string, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/connection.h b/src/network/connection.h index 7c0a5d7c..1f5111f8 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -8,6 +8,10 @@ #include "util/lists.h" #include +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct socket; struct uri; @@ -119,4 +123,8 @@ int load_uri(struct uri *uri, struct uri *referrer, struct download *download, int is_entry_used(struct cache_entry *cached); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/dns.h b/src/network/dns.h index 588a853f..0f53d72a 100644 --- a/src/network/dns.h +++ b/src/network/dns.h @@ -6,6 +6,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + enum dns_result { DNS_ERROR = -1, /* DNS lookup failed. */ DNS_SUCCESS = 0, /* DNS lookup was successful. */ @@ -39,4 +43,8 @@ void kill_dns_request(void **queryref); * cache entries will be removed. */ void shrink_dns_cache(int whole); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/progress.h b/src/network/progress.h index 70b549b2..b8c90ad3 100644 --- a/src/network/progress.h +++ b/src/network/progress.h @@ -4,6 +4,10 @@ #include "main/timer.h" /* timer_id_T */ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + #define CURRENT_SPD_SEC 50 /* number of seconds */ struct progress { @@ -50,4 +54,8 @@ void start_update_progress(struct progress *progress, void (*timer_func)(void *) int has_progress(struct progress *progress); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/socket.h b/src/network/socket.h index e5ced365..99f6fbd8 100644 --- a/src/network/socket.h +++ b/src/network/socket.h @@ -8,6 +8,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connect_info; struct read_buffer; struct socket; @@ -171,4 +175,8 @@ struct read_buffer *alloc_read_buffer(struct socket *socket); /* Remove @bytes number of bytes from @buffer. */ void kill_buffer_data(struct read_buffer *buffer, int bytes); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/match-hostname.h b/src/network/ssl/match-hostname.h index 60d32b2d..fda7dee5 100644 --- a/src/network/ssl/match-hostname.h +++ b/src/network/ssl/match-hostname.h @@ -2,9 +2,17 @@ #ifndef EL__NETWORK_SSL_MATCH_HOSTNAME_H #define EL__NETWORK_SSL_MATCH_HOSTNAME_H +#ifdef __cplusplus +extern "C" { +#endif + int match_hostname_pattern(const unsigned char *hostname, size_t hostname_length, const unsigned char *pattern, size_t pattern_length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/socket.h b/src/network/ssl/socket.h index ed184d66..68f5b45e 100644 --- a/src/network/ssl/socket.h +++ b/src/network/ssl/socket.h @@ -2,6 +2,10 @@ #ifndef EL__NETWORK_SSL_SOCKET_H #define EL__NETWORK_SSL_SOCKET_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_SSL struct socket; @@ -12,4 +16,9 @@ ssize_t ssl_read(struct socket *socket, unsigned char *data, int len); int ssl_close(struct socket *socket); #endif + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/ssl.h b/src/network/ssl/ssl.h index 601fde1f..1a6151de 100644 --- a/src/network/ssl/ssl.h +++ b/src/network/ssl/ssl.h @@ -6,6 +6,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct socket; extern struct module ssl_module; @@ -41,5 +45,10 @@ extern int socket_SSL_ex_data_idx; #define ssl_t gnutls_session_t #endif -#endif /* CONFIG_SSL */ +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_SSL */ + #endif diff --git a/src/network/state.h b/src/network/state.h index 41f13378..edc9de93 100644 --- a/src/network/state.h +++ b/src/network/state.h @@ -3,6 +3,10 @@ #include "util/error.h" /* assert() */ +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; enum connection_priority { @@ -149,4 +153,8 @@ connection_state_for_errno(int syserr) return state; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/beos/beos.h b/src/osdep/beos/beos.h index 306fa550..05ec241e 100644 --- a/src/osdep/beos/beos.h +++ b/src/osdep/beos/beos.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_BEOS_BEOS_H #define EL__OSDEP_BEOS_BEOS_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_BEOS struct terminal; @@ -11,4 +15,8 @@ void open_in_new_be(struct terminal *term, unsigned char *exe_name, #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/beos/overrides.h b/src/osdep/beos/overrides.h index cd67b216..410d8ffb 100644 --- a/src/osdep/beos/overrides.h +++ b/src/osdep/beos/overrides.h @@ -8,6 +8,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + int be_socket(int, int, int); int be_connect(int, struct sockaddr *, int); int be_getpeername(int, struct sockaddr *, int *); @@ -42,6 +46,10 @@ int be_getsockopt(int, int, int, void *, int *); #define errno 1 #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/beos/sysinfo.h b/src/osdep/beos/sysinfo.h index 22c28a6b..5faa8863 100644 --- a/src/osdep/beos/sysinfo.h +++ b/src/osdep/beos/sysinfo.h @@ -9,8 +9,16 @@ #define DEFAULT_SHELL "/bin/sh" #define GETSHELL getenv("SHELL") +#ifdef __cplusplus +extern "C" { +#endif + static inline int dir_sep(char x) { return x == '/'; } +#ifdef __cplusplus +} +#endif + #define FS_UNIX_RIGHTS #define FS_UNIX_SOFTLINKS #define FS_UNIX_USERS diff --git a/src/osdep/generic.h b/src/osdep/generic.h index 1f72d531..914b3f1f 100644 --- a/src/osdep/generic.h +++ b/src/osdep/generic.h @@ -3,6 +3,8 @@ #ifndef EL__OSDEP_GENERIC_H #define EL__OSDEP_GENERIC_H +#include + #ifdef HAVE_LIMITS_H #include /* may contain PIPE_BUF definition on some systems */ #endif @@ -11,6 +13,10 @@ #include /* may contain offsetof() */ #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifndef PIPE_BUF #define PIPE_BUF 512 /* POSIX says that. -- Mikulas */ #endif @@ -92,9 +98,10 @@ safe_write(int fd, const void *buf, size_t count) { #define offsetof(type, ident) ((size_t) &(((type *) 0)->ident)) #endif +#if !defined(alignof) && ((!defined(__cplusplus) || __cplusplus < 201103L)) /* Alignment of types. */ -#define alignof(TYPE) \ - offsetof(struct { unsigned char dummy1; TYPE dummy2; }, dummy2) +#define alignof(TYPE) offsetof(struct { unsigned char dummy1; TYPE dummy; }, dummy2) +#endif /* Using this macro to copy structs is both faster and safer than * memcpy(destination, source, sizeof(source)). Please, use this macro instead @@ -104,4 +111,8 @@ safe_write(int fd, const void *buf, size_t count) { #define sizeof_array(array) (sizeof(array)/sizeof(*(array))) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/getifaddrs.h b/src/osdep/getifaddrs.h index 4966c034..d2216b3a 100644 --- a/src/osdep/getifaddrs.h +++ b/src/osdep/getifaddrs.h @@ -5,6 +5,10 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifndef HAVE_GETIFADDRS /* ELinksification by Zas. * This file was borrowed from dkftpbench-0.45 sources (http://www.kegel.com/dkftpbench). */ @@ -69,4 +73,8 @@ void freeifaddrs(struct ifaddrs *); #endif /* HAVE_GETIFADDRS */ +#ifdef __cplusplus +} +#endif + #endif /* EL__OSDEP_GETIFADDRS_H */ diff --git a/src/osdep/newwin.h b/src/osdep/newwin.h index daf65437..8747ad03 100644 --- a/src/osdep/newwin.h +++ b/src/osdep/newwin.h @@ -3,6 +3,10 @@ #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + /* {struct open_in_new} and @open_in_new is used for setting up menues * of how new windows can be opened. */ struct open_in_new { @@ -31,4 +35,8 @@ int can_open_in_new(struct terminal *term); void open_new_window(struct terminal *term, unsigned char *exe_name, enum term_env_type environment, unsigned char *param); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/os2/os2.h b/src/osdep/os2/os2.h index 99b3f6d9..d432df75 100644 --- a/src/osdep/os2/os2.h +++ b/src/osdep/os2/os2.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_OS2_OS2_H #define EL__OSDEP_OS2_OS2_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_OS2 struct terminal; @@ -13,4 +17,8 @@ void open_in_new_fullscreen(struct terminal *term, unsigned char *exe_name, #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/os2/sysinfo.h b/src/osdep/os2/sysinfo.h index 0c195c6e..beb5057e 100644 --- a/src/osdep/os2/sysinfo.h +++ b/src/osdep/os2/sysinfo.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_OS2_SYSINFO_H #define EL__OSDEP_OS2_SYSINFO_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_OS2 #define SYSTEM_NAME "OS/2" @@ -40,4 +44,8 @@ static inline int dir_sep(char x) { return x == '/' || x == '\\'; } #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/osdep.h b/src/osdep/osdep.h index c31d5ace..89763c1f 100644 --- a/src/osdep/osdep.h +++ b/src/osdep/osdep.h @@ -7,6 +7,10 @@ #include "osdep/unix/unix.h" #include "osdep/win32/win32.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef CHAR_DIR_SEP #define CHAR_DIR_SEP '/' #endif @@ -66,10 +70,18 @@ void set_cwd(unsigned char *); unsigned char *get_shell(void); +#ifdef __cplusplus +} +#endif + #ifdef HAVE_TERMIOS_H #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* We define own cfmakeraw() wrapper because cfmakeraw() is broken on AIX, * thus we fix it right away. We can also emulate cfmakeraw() if it is not * available at all. Face it, we are just cool. */ @@ -79,4 +91,8 @@ void elinks_cfmakeraw(struct termios *t); #define user_appdata_directory() NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/riscos/sysinfo.h b/src/osdep/riscos/sysinfo.h index 107ccf5f..c2c0d3ac 100644 --- a/src/osdep/riscos/sysinfo.h +++ b/src/osdep/riscos/sysinfo.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_RISCOS_SYSINFO_H #define EL__OSDEP_RISCOS_SYSINFO_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_RISCOS #define SYSTEM_NAME "RISC OS" @@ -17,4 +21,9 @@ static inline int dir_sep(char x) { return x == '/' || x == '\\'; } #endif +#ifdef __cplusplus +} +#endif + + #endif diff --git a/src/osdep/signals.h b/src/osdep/signals.h index 1742df05..37ba12e3 100644 --- a/src/osdep/signals.h +++ b/src/osdep/signals.h @@ -3,6 +3,10 @@ #ifndef EL__OSDEP_SIGNALS_H #define EL__OSDEP_SIGNALS_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; #define NUM_SIGNALS 32 @@ -18,4 +22,8 @@ void handle_basic_signals(struct terminal *term); void unhandle_terminal_signals(struct terminal *term); int check_signals(void); +#ifdef __cplusplus +} +#endif + #endif /* EL__LOWLEVEL_SIGNALS_H */ diff --git a/src/osdep/stub.h b/src/osdep/stub.h index 00986472..f2f7c580 100644 --- a/src/osdep/stub.h +++ b/src/osdep/stub.h @@ -4,6 +4,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if 0 #ifdef CONFIG_DEBUG #define CONFIG_OWN_LIBC @@ -161,4 +165,8 @@ extern void *__builtin_mempcpy(void *dest, const void *src, size_t n); #endif #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/sysname.h b/src/osdep/sysname.h index 9e3eaa54..1e0883a1 100644 --- a/src/osdep/sysname.h +++ b/src/osdep/sysname.h @@ -1,8 +1,16 @@ #ifndef EL__OSDEP_SYSNAME_H #define EL__OSDEP_SYSNAME_H +#ifdef __cplusplus +extern "C" { +#endif + extern unsigned char system_name[]; extern void get_system_name(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/unix/sysinfo.h b/src/osdep/unix/sysinfo.h index 7b4ef587..4a7c390e 100644 --- a/src/osdep/unix/sysinfo.h +++ b/src/osdep/unix/sysinfo.h @@ -9,8 +9,16 @@ #define DEFAULT_SHELL "/bin/sh" #define GETSHELL getenv("SHELL") +#ifdef __cplusplus +extern "C" { +#endif + static inline int dir_sep(char x) { return x == '/'; } +#ifdef __cplusplus +} +#endif + #define FS_UNIX_RIGHTS #define FS_UNIX_HARDLINKS #define FS_UNIX_SOFTLINKS diff --git a/src/osdep/win32/overrides.h b/src/osdep/win32/overrides.h index 5b5aa106..1d0040cb 100644 --- a/src/osdep/win32/overrides.h +++ b/src/osdep/win32/overrides.h @@ -8,6 +8,9 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif int win32_write(int fd, const void *buf, unsigned len); int win32_read(int fd, void *buf, unsigned len); @@ -47,5 +50,9 @@ char *win32_strerror(int err); #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/win32/vt100.h b/src/osdep/win32/vt100.h index 4fd393ad..f82a074e 100644 --- a/src/osdep/win32/vt100.h +++ b/src/osdep/win32/vt100.h @@ -7,8 +7,16 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + int VT100_decode(HANDLE, const void *, int); +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/win32/win32.h b/src/osdep/win32/win32.h index 3118e782..f634c4c7 100644 --- a/src/osdep/win32/win32.h +++ b/src/osdep/win32/win32.h @@ -4,6 +4,10 @@ #ifdef CONFIG_OS_WIN32 +#ifdef __cplusplus +extern "C" { +#endif + #undef CHAR_DIR_SEP #define CHAR_DIR_SEP '\\' #undef STRING_DIR_SEP @@ -66,5 +70,9 @@ int tcgetattr(int fd, struct termios *termios_p); int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); #endif /* __CYGWIN__ */ +#ifdef __cplusplus +} +#endif + #endif /* CONFIG_OS_WIN32 */ #endif diff --git a/src/protocol/about.h b/src/protocol/about.h index e36e99c3..8dc5578a 100644 --- a/src/protocol/about.h +++ b/src/protocol/about.h @@ -3,6 +3,14 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern protocol_handler_T about_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/auth.h b/src/protocol/auth/auth.h index 1ddba200..123cbbad 100644 --- a/src/protocol/auth/auth.h +++ b/src/protocol/auth/auth.h @@ -6,6 +6,10 @@ #include "protocol/uri.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct module; @@ -46,4 +50,8 @@ struct auth_entry *get_invalid_auth_entry(void); extern struct module auth_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/dialogs.h b/src/protocol/auth/dialogs.h index ff6e866d..7f6c2097 100644 --- a/src/protocol/auth/dialogs.h +++ b/src/protocol/auth/dialogs.h @@ -4,10 +4,18 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; void do_auth_dialog(struct session *ses, void *data); extern struct hierbox_browser auth_browser; void auth_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/digest.h b/src/protocol/auth/digest.h index 9798cc9f..d56bfc13 100644 --- a/src/protocol/auth/digest.h +++ b/src/protocol/auth/digest.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_AUTH_DIGEST_H #define EL__PROTOCOL_AUTH_DIGEST_H +#ifdef __cplusplus +extern "C" { +#endif + struct auth_entry; struct uri; unsigned char * get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/bencoding.h b/src/protocol/bittorrent/bencoding.h index fff35338..62bdf437 100644 --- a/src/protocol/bittorrent/bencoding.h +++ b/src/protocol/bittorrent/bencoding.h @@ -4,6 +4,10 @@ #include "protocol/bittorrent/common.h" +#ifdef __cplusplus +extern "C" { +#endif + enum bittorrent_state parse_bittorrent_metafile(struct bittorrent_meta *meta, struct bittorrent_const_string *metafile); @@ -12,4 +16,8 @@ enum bittorrent_state parse_bittorrent_tracker_response(struct bittorrent_connection *bittorrent, struct bittorrent_const_string *source); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/bittorrent.h b/src/protocol/bittorrent/bittorrent.h index 7ecfe002..c8c7ec11 100644 --- a/src/protocol/bittorrent/bittorrent.h +++ b/src/protocol/bittorrent/bittorrent.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bittorrent_const_string; struct uri; @@ -19,4 +23,8 @@ void add_bittorrent_selection(struct uri *uri, int *selection, size_t size); void add_bittorrent_message(struct uri *uri, struct connection_state state, struct bittorrent_const_string *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/common.h b/src/protocol/bittorrent/common.h index ab6eee2a..fccb0f4f 100644 --- a/src/protocol/bittorrent/common.h +++ b/src/protocol/bittorrent/common.h @@ -14,6 +14,10 @@ #include "util/sha1.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bitfield; struct bittorrent_fetcher; struct connection; @@ -231,6 +235,11 @@ struct bittorrent_file { unsigned char name[1]; /**< Filename converted from path list. */ }; +enum meta_type { + BITTORRENT_SINGLE_FILE, + BITTORRENT_MULTI_FILE +}; + /** Static information from the .torrent metafile. */ struct bittorrent_meta { /** The SHA1 info hash of the value of the info key from the metainfo @@ -260,7 +269,7 @@ struct bittorrent_meta { unsigned char *piece_hash; /** The type of the torrent. */ - enum { BITTORRENT_SINGLE_FILE, BITTORRENT_MULTI_FILE } type; + enum meta_type type; /** Potential bad file path detected. */ unsigned int malicious_paths:1; @@ -445,4 +454,8 @@ get_bittorrent_blacklist_flags(bittorrent_id_T peer_id); void done_bittorrent_blacklist(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/connection.h b/src/protocol/bittorrent/connection.h index 13aeca03..396a23d5 100644 --- a/src/protocol/bittorrent/connection.h +++ b/src/protocol/bittorrent/connection.h @@ -4,6 +4,10 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bittorrent_connection; struct connection; @@ -24,4 +28,8 @@ update_bittorrent_connection_stats(struct bittorrent_connection *bittorrent, void bittorrent_resume_callback(struct bittorrent_connection *bittorrent); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index 4b50a6ae..f181b47b 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -16,6 +16,7 @@ #include "protocol/bittorrent/bencoding.h" #include "protocol/bittorrent/bittorrent.h" #include "protocol/bittorrent/common.h" +#include "protocol/bittorrent/dialogs.h" #include "protocol/bittorrent/piececache.h" #include "protocol/uri.h" #include "session/download.h" diff --git a/src/protocol/bittorrent/dialogs.h b/src/protocol/bittorrent/dialogs.h index 3ef296c3..af547af9 100644 --- a/src/protocol/bittorrent/dialogs.h +++ b/src/protocol/bittorrent/dialogs.h @@ -4,6 +4,10 @@ #include "bfu/common.h" +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct bittorrent_connection; struct download; @@ -32,4 +36,8 @@ void bittorrent_message_dialog(struct session *ses, void *data); void query_bittorrent_dialog(struct type_query *type_query); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/peerconnect.h b/src/protocol/bittorrent/peerconnect.h index 08b695c2..b1883196 100644 --- a/src/protocol/bittorrent/peerconnect.h +++ b/src/protocol/bittorrent/peerconnect.h @@ -5,6 +5,10 @@ #include "network/state.h" #include "protocol/bittorrent/common.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* Sets up and tears down the peer listening socket. */ @@ -20,4 +24,8 @@ enum bittorrent_state make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent, struct bittorrent_peer *peer_info); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/peerwire.h b/src/protocol/bittorrent/peerwire.h index 95d5a7cf..79a957d8 100644 --- a/src/protocol/bittorrent/peerwire.h +++ b/src/protocol/bittorrent/peerwire.h @@ -5,6 +5,10 @@ #include "protocol/bittorrent/common.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct read_buffer; struct socket; @@ -80,4 +84,8 @@ cancel_bittorrent_peer_request(struct bittorrent_peer_connection *peer, request->length); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/piececache.h b/src/protocol/bittorrent/piececache.h index e8425a13..5a1b9cad 100644 --- a/src/protocol/bittorrent/piececache.h +++ b/src/protocol/bittorrent/piececache.h @@ -5,6 +5,10 @@ #include "protocol/bittorrent/common.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bitfield; struct bittorrent_piece_cache_entry { @@ -125,4 +129,8 @@ unsigned char * get_bittorrent_piece_cache_data(struct bittorrent_connection *bittorrent, uint32_t piece); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/tracker.h b/src/protocol/bittorrent/tracker.h index ba2803d4..ebe03534 100644 --- a/src/protocol/bittorrent/tracker.h +++ b/src/protocol/bittorrent/tracker.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_BITTORRENT_TRACKER_H #define EL__PROTOCOL_BITTORRENT_TRACKER_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* Once called it will periodically request information from the tracker. @@ -12,4 +16,8 @@ void send_bittorrent_tracker_request(struct connection *conn); /* Stops all tracker related activity. */ void done_bittorrent_tracker_connection(struct connection *conn); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/common.h b/src/protocol/common.h index 7dc259bb..286134a1 100644 --- a/src/protocol/common.h +++ b/src/protocol/common.h @@ -3,6 +3,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; struct uri; @@ -12,4 +16,8 @@ void close_all_non_term_fd(void); struct connection_state init_directory_listing(struct string *page, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/data.h b/src/protocol/data.h index 5e7e77ec..b86af3a2 100644 --- a/src/protocol/data.h +++ b/src/protocol/data.h @@ -3,10 +3,18 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_DATA extern protocol_handler_T data_protocol_handler; #else #define data_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/date.h b/src/protocol/date.h index b1018c86..a2debe97 100644 --- a/src/protocol/date.h +++ b/src/protocol/date.h @@ -3,6 +3,10 @@ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Parses YY and YYYY style years. Returns year value ready for tm.tm_year and * move @date pointer after the year if successful else returns -1. */ int parse_year(const unsigned char **date, unsigned char *end); @@ -27,4 +31,8 @@ int parse_time(const unsigned char **time, struct tm *tm, unsigned char *end); time_t parse_date(unsigned char **date_pos, unsigned char *end, int update_pos, int skip_week_day); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/cgi.h b/src/protocol/file/cgi.h index 72cd6a02..3793c192 100644 --- a/src/protocol/file/cgi.h +++ b/src/protocol/file/cgi.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_FILE_CGI_H #define EL__PROTOCOL_FILE_CGI_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct module; extern struct module cgi_protocol_module; int execute_cgi(struct connection *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/file.h b/src/protocol/file/file.h index 7a7f12d8..067df012 100644 --- a/src/protocol/file/file.h +++ b/src/protocol/file/file.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module file_protocol_module; extern protocol_handler_T file_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/mailcap.h b/src/protocol/file/mailcap.h index e3116be4..34082b38 100644 --- a/src/protocol/file/mailcap.h +++ b/src/protocol/file/mailcap.h @@ -4,7 +4,15 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module mailcap_protocol_module; extern protocol_handler_T mailcap_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/finger/finger.h b/src/protocol/finger/finger.h index d0ebc1bd..b412c7db 100644 --- a/src/protocol/finger/finger.h +++ b/src/protocol/finger/finger.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_FINGER extern protocol_handler_T finger_protocol_handler; #else @@ -13,5 +17,8 @@ extern protocol_handler_T finger_protocol_handler; extern struct module finger_protocol_module; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 8a0dee37..8c69f3e8 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -9,7 +9,15 @@ #endif #include + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + #include #include #include diff --git a/src/protocol/fsp/fsp.h b/src/protocol/fsp/fsp.h index b5b9087e..35acf494 100644 --- a/src/protocol/fsp/fsp.h +++ b/src/protocol/fsp/fsp.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module fsp_protocol_module; #ifdef CONFIG_FSP @@ -13,4 +17,8 @@ extern protocol_handler_T fsp_protocol_handler; #define fsp_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/ftp/ftp.h b/src/protocol/ftp/ftp.h index 10f4a2d5..b3f210c8 100644 --- a/src/protocol/ftp/ftp.h +++ b/src/protocol/ftp/ftp.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module ftp_protocol_module; #ifdef CONFIG_FTP @@ -13,4 +17,8 @@ extern protocol_handler_T ftp_protocol_handler; #define ftp_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/ftp/parse.h b/src/protocol/ftp/parse.h index 18cfacd8..07478a99 100644 --- a/src/protocol/ftp/parse.h +++ b/src/protocol/ftp/parse.h @@ -5,6 +5,10 @@ #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* File types. */ /* The value is the char value used when displaying the file type. */ enum ftp_file_type { @@ -38,4 +42,8 @@ struct ftp_file_info { struct ftp_file_info * parse_ftp_file_info(struct ftp_file_info *info, unsigned char *src, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/gopher/gopher.h b/src/protocol/gopher/gopher.h index 29bcede2..84c55689 100644 --- a/src/protocol/gopher/gopher.h +++ b/src/protocol/gopher/gopher.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_GOPHER extern protocol_handler_T gopher_protocol_handler; #else @@ -13,5 +17,8 @@ extern protocol_handler_T gopher_protocol_handler; extern struct module gopher_protocol_module; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/protocol/header.h b/src/protocol/header.h index 0bcec5a0..96f4ebc7 100644 --- a/src/protocol/header.h +++ b/src/protocol/header.h @@ -1,6 +1,10 @@ #ifndef EL__PROTOCOL_HEADER_H #define EL__PROTOCOL_HEADER_H +#ifdef __cplusplus +extern "C" { +#endif + enum parse_header_param { HEADER_PARAM_FOUND, HEADER_PARAM_NOT_FOUND, @@ -13,4 +17,8 @@ unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned cha enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **, int); unsigned char *get_header_param(unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/blacklist.h b/src/protocol/http/blacklist.h index 32fc3d26..676ac5ff 100644 --- a/src/protocol/http/blacklist.h +++ b/src/protocol/http/blacklist.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_HTTP_BLACKLIST_H #define EL__PROTOCOL_HTTP_BLACKLIST_H +#ifdef __cplusplus +extern "C" { +#endif + struct uri; enum blacklist_flags { @@ -17,4 +21,8 @@ void del_blacklist_entry(struct uri *, enum blacklist_flags); enum blacklist_flags get_blacklist_flags(struct uri *); void free_blacklist(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/codes.h b/src/protocol/http/codes.h index 3fada7bc..d9bbdf45 100644 --- a/src/protocol/http/codes.h +++ b/src/protocol/http/codes.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_HTTP_CODES_H #define EL__PROTOCOL_HTTP_CODES_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* HTTP response codes device. */ void http_error_document(struct connection *conn, int code); +#ifdef __cplusplus +} +#endif + #endif /* EL__PROTOCOL_HTTP_CODES_H */ diff --git a/src/protocol/http/http.h b/src/protocol/http/http.h index df7a9c9d..dff3ba33 100644 --- a/src/protocol/http/http.h +++ b/src/protocol/http/http.h @@ -7,6 +7,10 @@ #include "protocol/http/post.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct read_buffer; struct socket; @@ -48,4 +52,8 @@ void http_got_header(struct socket *, struct read_buffer *); unsigned char *subst_user_agent(unsigned char *fmt, unsigned char *version, unsigned char *sysname, unsigned char *termsize); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/http_negotiate.h b/src/protocol/http/http_negotiate.h index 5b7f3539..cf9d4237 100644 --- a/src/protocol/http/http_negotiate.h +++ b/src/protocol/http/http_negotiate.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_HTTP_HTTP_NEGOTIATE_H #define EL__PROTOCOL_HTTP_HTTP_NEGOTIATE_H +#ifdef __cplusplus +extern "C" { +#endif + #define HTTPNEG_GSS 1 #define HTTPNEG_NEG 2 @@ -16,6 +20,9 @@ int http_negotiate_input(struct connection *conn, struct uri *uri, int http_negotiate_output(struct uri *uri, struct string *header); +#ifdef __cplusplus +} +#endif #endif /* EL_PROTOCOL_HTTP_HTTP_NEGOTIATE_H */ diff --git a/src/protocol/http/post.h b/src/protocol/http/post.h index 77f90649..7c1fe91f 100644 --- a/src/protocol/http/post.h +++ b/src/protocol/http/post.h @@ -6,6 +6,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Information about a file to be uploaded in a POST request. * open_http_post() collects this information and done_http_post() * discards it. */ @@ -60,4 +64,8 @@ int read_http_post(struct http_post *http_post, unsigned char buffer[], int max, struct connection_state *error); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/connection.h b/src/protocol/nntp/connection.h index b2564673..ad2e9cf5 100644 --- a/src/protocol/nntp/connection.h +++ b/src/protocol/nntp/connection.h @@ -6,6 +6,10 @@ #include "protocol/protocol.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* An NNTP target is a mapping from a given URI which in short form tells what * the URI describes. Using the following tokens: * @@ -89,4 +93,8 @@ extern protocol_handler_T news_protocol_handler; #define news_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/nntp.h b/src/protocol/nntp/nntp.h index f993cff1..a414ee72 100644 --- a/src/protocol/nntp/nntp.h +++ b/src/protocol/nntp/nntp.h @@ -4,6 +4,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Returns the server that should be used when expanding news: URIs */ unsigned char *get_nntp_server(void); @@ -12,4 +16,8 @@ unsigned char *get_nntp_header_entries(void); extern struct module nntp_protocol_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/response.h b/src/protocol/nntp/response.h index dd1fc09b..5343a8e1 100644 --- a/src/protocol/nntp/response.h +++ b/src/protocol/nntp/response.h @@ -4,6 +4,10 @@ #include "protocol/nntp/connection.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct read_buffer; @@ -26,4 +30,8 @@ read_nntp_response_data(struct connection *conn, struct read_buffer *rb); enum nntp_code get_nntp_response_code(struct connection *conn, struct read_buffer *rb); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index aa994172..170a3f6a 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -3,6 +3,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct session; struct terminal; @@ -61,4 +65,8 @@ enum protocol get_protocol(unsigned char *name, int namelen); extern struct module protocol_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/proxy.h b/src/protocol/proxy.h index bb399567..f4d42f48 100644 --- a/src/protocol/proxy.h +++ b/src/protocol/proxy.h @@ -1,6 +1,10 @@ #ifndef EL__PROTOCOL_PROXY_H #define EL__PROTOCOL_PROXY_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection_state; struct uri; @@ -14,4 +18,8 @@ struct uri *get_proxy_uri(struct uri *uri, struct connection_state *connection_s * proxy:// URI it will return the URI with the fragment removed. */ struct uri *get_proxied_uri(struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/rewrite/rewrite.h b/src/protocol/rewrite/rewrite.h index 18cad68f..fcddb554 100644 --- a/src/protocol/rewrite/rewrite.h +++ b/src/protocol/rewrite/rewrite.h @@ -6,7 +6,15 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module uri_rewrite_module; +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/protocol/smb/smb.h b/src/protocol/smb/smb.h index af0d5c2c..e079c76e 100644 --- a/src/protocol/smb/smb.h +++ b/src/protocol/smb/smb.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module smb_protocol_module; #ifdef CONFIG_SMB @@ -13,4 +17,9 @@ extern protocol_handler_T smb_protocol_handler; #define smb_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + + #endif diff --git a/src/protocol/uri.h b/src/protocol/uri.h index 295e5109..7ff69ce8 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -3,6 +3,10 @@ #include "main/object.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; #define POST_CHAR 1 @@ -353,4 +357,8 @@ int is_ip_address(const unsigned char *address, int addresslen); */ int is_in_domain(unsigned char *domain, unsigned char *server, int server_len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/user.h b/src/protocol/user.h index 4d153b0f..817a8871 100644 --- a/src/protocol/user.h +++ b/src/protocol/user.h @@ -5,9 +5,17 @@ #include "protocol/protocol.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module user_protocol_module; extern protocol_external_handler_T user_protocol_handler; unsigned char *get_user_program(struct terminal *, unsigned char *, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/core.h b/src/scripting/guile/core.h index 1f06b4e1..bb559dad 100644 --- a/src/scripting/guile/core.h +++ b/src/scripting/guile/core.h @@ -2,6 +2,14 @@ #ifndef EL__SCRIPTING_GUILE_CORE_H #define EL__SCRIPTING_GUILE_CORE_H +#ifdef __cplusplus +extern "C" { +#endif + void init_guile(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/guile.h b/src/scripting/guile/guile.h index f6729dcf..440790e6 100644 --- a/src/scripting/guile/guile.h +++ b/src/scripting/guile/guile.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_GUILE_GUILE_H #define EL__SCRIPTING_GUILE_GUILE_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module guile_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/hooks.h b/src/scripting/guile/hooks.h index 23185b32..469f9cc1 100644 --- a/src/scripting/guile/hooks.h +++ b/src/scripting/guile/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_GUILE_HOOKS_H #define EL__SCRIPTING_GUILE_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info guile_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 6c7e1379..02d9e149 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -12,9 +12,29 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif #include "elinks.h" diff --git a/src/scripting/lua/core.h b/src/scripting/lua/core.h index 4e6c8f72..0dd92e9a 100644 --- a/src/scripting/lua/core.h +++ b/src/scripting/lua/core.h @@ -10,6 +10,10 @@ #define LUA_ALERT "_ALERT" #endif +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; @@ -27,4 +31,8 @@ enum evhook_status free_lua_console_history(va_list ap, void *data); void init_lua(struct module *module); void cleanup_lua(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c index 8b23f73b..f41fa98b 100644 --- a/src/scripting/lua/hooks.c +++ b/src/scripting/lua/hooks.c @@ -4,9 +4,29 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif #include "elinks.h" diff --git a/src/scripting/lua/hooks.h b/src/scripting/lua/hooks.h index 15ee5ae9..f5ca3898 100644 --- a/src/scripting/lua/hooks.h +++ b/src/scripting/lua/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_LUA_HOOKS_H #define EL__SCRIPTING_LUA_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info lua_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/lua.h b/src/scripting/lua/lua.h index d91d7d69..23b5aa80 100644 --- a/src/scripting/lua/lua.h +++ b/src/scripting/lua/lua.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_LUA_LUA_H #define EL__SCRIPTING_LUA_LUA_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module lua_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/core.h b/src/scripting/perl/core.h index b27adc9c..0ff21518 100644 --- a/src/scripting/perl/core.h +++ b/src/scripting/perl/core.h @@ -6,6 +6,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern PerlInterpreter *my_perl; @@ -13,4 +17,8 @@ extern PerlInterpreter *my_perl; void init_perl(struct module *module); void cleanup_perl(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/hooks.h b/src/scripting/perl/hooks.h index 8e2afcca..8ab64f97 100644 --- a/src/scripting/perl/hooks.h +++ b/src/scripting/perl/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PERL_HOOKS_H #define EL__SCRIPTING_PERL_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info perl_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/perl.h b/src/scripting/perl/perl.h index 59f3f47b..69b38018 100644 --- a/src/scripting/perl/perl.h +++ b/src/scripting/perl/perl.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PERL_PERL_H #define EL__SCRIPTING_PERL_PERL_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module perl_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/core.h b/src/scripting/python/core.h index 31b2c242..00f06c9c 100644 --- a/src/scripting/python/core.h +++ b/src/scripting/python/core.h @@ -6,6 +6,10 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + /* PyString_AsStringAndSize() takes a Py_ssize_t * in Python 2.5 but * an int * in Python 2.4. To be compatible with both, ELinks uses * Py_ssize_t and defines it here if necessary. The public-domain @@ -44,4 +48,8 @@ int add_python_methods(PyObject *dict, PyObject *name, PyMethodDef *methods); #define PYTHON_DOCSTRING(str) "" #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/dialogs.c b/src/scripting/python/dialogs.c index c3fa5946..8c968d9c 100644 --- a/src/scripting/python/dialogs.c +++ b/src/scripting/python/dialogs.c @@ -13,6 +13,7 @@ #include "bfu/msgbox.h" #include "intl/gettext/libintl.h" #include "scripting/python/core.h" +#include "scripting/python/dialogs.h" #include "session/session.h" #include "util/error.h" #include "util/memlist.h" diff --git a/src/scripting/python/dialogs.h b/src/scripting/python/dialogs.h index 5d50d3e7..d8dc83d3 100644 --- a/src/scripting/python/dialogs.h +++ b/src/scripting/python/dialogs.h @@ -3,9 +3,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_info_box(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_info_box_doc[]; PyObject *python_input_box(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_input_box_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/document.c b/src/scripting/python/document.c index 5da6e7e4..404985ef 100644 --- a/src/scripting/python/document.c +++ b/src/scripting/python/document.c @@ -13,6 +13,7 @@ #include "document/document.h" #include "document/view.h" #include "scripting/python/core.h" +#include "scripting/python/document.h" #include "session/session.h" /* Python interface to get the current document's body. */ diff --git a/src/scripting/python/document.h b/src/scripting/python/document.h index 47ca1ac6..0bc21c7a 100644 --- a/src/scripting/python/document.h +++ b/src/scripting/python/document.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_current_document(PyObject *self, PyObject *args); extern char python_current_document_doc[]; PyObject *python_current_header(PyObject *self, PyObject *args); @@ -14,4 +18,8 @@ extern char python_current_title_doc[]; PyObject *python_current_url(PyObject *self, PyObject *args); extern char python_current_url_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/hooks.h b/src/scripting/python/hooks.h index 619d5544..074ffd79 100644 --- a/src/scripting/python/hooks.h +++ b/src/scripting/python/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PYTHON_HOOKS_H #define EL__SCRIPTING_PYTHON_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info python_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/keybinding.c b/src/scripting/python/keybinding.c index a2cc1b57..8da7ff34 100644 --- a/src/scripting/python/keybinding.c +++ b/src/scripting/python/keybinding.c @@ -16,6 +16,7 @@ #include "intl/gettext/libintl.h" #include "main/event.h" #include "scripting/python/core.h" +#include "scripting/python/keybinding.h" #include "session/session.h" #include "util/error.h" #include "util/string.h" @@ -49,7 +50,7 @@ invoke_keybinding_callback(va_list ap, void *data) static int keymap_is_valid(const unsigned char *keymap) { - enum keymap_id keymap_id; + int keymap_id; for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) if (!strcmp(keymap, get_keymap_name(keymap_id))) diff --git a/src/scripting/python/keybinding.h b/src/scripting/python/keybinding.h index e3601182..b3f98796 100644 --- a/src/scripting/python/keybinding.h +++ b/src/scripting/python/keybinding.h @@ -3,9 +3,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern PyObject *keybindings; PyObject *python_bind_key(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_bind_key_doc[]; void python_done_keybinding_interface(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/load.c b/src/scripting/python/load.c index 44c290ce..54222b7a 100644 --- a/src/scripting/python/load.c +++ b/src/scripting/python/load.c @@ -15,6 +15,7 @@ #include "network/state.h" #include "protocol/uri.h" #include "scripting/python/core.h" +#include "scripting/python/load.h" #include "session/download.h" #include "session/session.h" #include "session/task.h" diff --git a/src/scripting/python/load.h b/src/scripting/python/load.h index a6603bf9..fcd177a3 100644 --- a/src/scripting/python/load.h +++ b/src/scripting/python/load.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_load(PyObject *self, PyObject *args); extern char python_load_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/menu.c b/src/scripting/python/menu.c index 6695289f..c454c33c 100644 --- a/src/scripting/python/menu.c +++ b/src/scripting/python/menu.c @@ -14,6 +14,7 @@ #include "document/view.h" #include "intl/gettext/libintl.h" #include "scripting/python/core.h" +#include "scripting/python/menu.h" #include "session/session.h" #include "terminal/window.h" #include "util/error.h" diff --git a/src/scripting/python/menu.h b/src/scripting/python/menu.h index cd4d56d1..3f695c17 100644 --- a/src/scripting/python/menu.h +++ b/src/scripting/python/menu.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_menu(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_menu_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/open.c b/src/scripting/python/open.c index f23acce5..166b42d0 100644 --- a/src/scripting/python/open.c +++ b/src/scripting/python/open.c @@ -12,6 +12,7 @@ #include "intl/gettext/libintl.h" #include "protocol/uri.h" #include "scripting/python/core.h" +#include "scripting/python/open.h" #include "session/task.h" #include "terminal/tab.h" #include "util/error.h" diff --git a/src/scripting/python/open.h b/src/scripting/python/open.h index 02635deb..35067e26 100644 --- a/src/scripting/python/open.h +++ b/src/scripting/python/open.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_open(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_open_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/python.h b/src/scripting/python/python.h index 268421ae..a856ee94 100644 --- a/src/scripting/python/python.h +++ b/src/scripting/python/python.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PYTHON_PYTHON_H #define EL__SCRIPTING_PYTHON_PYTHON_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module python_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/core.h b/src/scripting/ruby/core.h index 74b66cd9..aceada4c 100644 --- a/src/scripting/ruby/core.h +++ b/src/scripting/ruby/core.h @@ -2,11 +2,15 @@ #ifndef EL__SCRIPTING_RUBY_CORE_H #define EL__SCRIPTING_RUBY_CORE_H +#include /* for VALUE */ + +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; -#include /* for VALUE */ - #ifndef RSTRING_LEN #define RSTRING_LEN(string) (RSTRING(string)->len) #endif @@ -28,4 +32,8 @@ void erb_report_error(struct session *ses, int state); void init_ruby(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/hooks.h b/src/scripting/ruby/hooks.h index 30308a12..820c2bb5 100644 --- a/src/scripting/ruby/hooks.h +++ b/src/scripting/ruby/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_RUBY_HOOKS_H #define EL__SCRIPTING_RUBY_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info ruby_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/ruby.h b/src/scripting/ruby/ruby.h index 376057ce..0a96d3a8 100644 --- a/src/scripting/ruby/ruby.h +++ b/src/scripting/ruby/ruby.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_RUBY_RUBY_H #define EL__SCRIPTING_RUBY_RUBY_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module ruby_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/scripting.h b/src/scripting/scripting.h index a746517f..62d470a2 100644 --- a/src/scripting/scripting.h +++ b/src/scripting/scripting.h @@ -1,6 +1,10 @@ #ifndef EL__SCRIPTING_SCRIPTING_H #define EL__SCRIPTING_SCRIPTING_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_SCRIPTING struct module; @@ -14,4 +18,8 @@ extern struct module scripting_module; #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 86e9ed79..219e46b4 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -23,7 +23,19 @@ struct smjs_action_fn_callback_hop { action_id_T action_id; }; -static const JSClass action_fn_class; /* defined below */ +static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); +static JSBool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); + +static const JSClass action_fn_class = { + "action_fn", + JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_action_fn_finalize, + NULL, + smjs_action_fn_callback, +}; /* @action_fn_class.finalize */ static void @@ -114,16 +126,6 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) return JS_TRUE; } -static const JSClass action_fn_class = { - "action_fn", - JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_action_fn_finalize, - NULL, - smjs_action_fn_callback, -}; static JSObject * smjs_get_action_fn_object(unsigned char *action_str) @@ -163,10 +165,10 @@ smjs_get_action_fn_object(unsigned char *action_str) /* @action_class.getProperty */ static JSBool -action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); (void)obj; jsval val; @@ -190,7 +192,7 @@ action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab static const JSClass action_class = { "action", 0, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, action_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, }; diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index 057fbd56..c1e0087c 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -15,11 +15,27 @@ #include "util/memory.h" -static const JSClass bookmark_class, bookmark_folder_class; /* defined below */ - - /*** common code ***/ +static void bookmark_finalize(JSFreeOp *op, JSObject *obj); +static JSBool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); + +static const JSClass bookmark_class = { + "bookmark", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + +static const JSClass bookmark_folder_class = { + "bookmark_folder", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_PropertyStub, + bookmark_folder_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + static JSObject * smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp) { @@ -68,11 +84,11 @@ enum bookmark_prop { BOOKMARK_CHILDREN = -3, }; -static JSBool bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec bookmark_props[] = { { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(bookmark_get_property_title), JSOP_WRAPPER(bookmark_set_property_title) }, @@ -150,7 +166,7 @@ jsval_to_bookmark_string(JSContext *ctx, jsval val, unsigned char **result) } static JSBool -bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -171,7 +187,7 @@ bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -201,7 +217,7 @@ bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -222,7 +238,7 @@ bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -252,7 +268,7 @@ bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -274,13 +290,6 @@ bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId h return JS_TRUE; } -static const JSClass bookmark_class = { - "bookmark", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_object(struct bookmark *bookmark) @@ -303,10 +312,10 @@ smjs_get_bookmark_object(struct bookmark *bookmark) /* @bookmark_folder_class.getProperty */ static JSBool -bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct bookmark *bookmark; struct bookmark *folder; @@ -339,13 +348,6 @@ bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid return JS_TRUE; } -static const JSClass bookmark_folder_class = { - "bookmark_folder", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - bookmark_folder_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_folder_object(struct bookmark *bookmark) diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 9995370d..21fc4473 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -15,7 +15,15 @@ #include "util/error.h" #include "util/memory.h" -static const JSClass cache_entry_class; /* defined below */ +static void cache_entry_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass cache_entry_class = { + "cache_entry", + JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -29,14 +37,14 @@ enum cache_entry_prop { CACHE_ENTRY_URI = -5, }; -static JSBool cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_uri(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec cache_entry_props[] = { { "content", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(cache_entry_get_property_content), JSOP_WRAPPER(cache_entry_set_property_content) }, @@ -48,7 +56,7 @@ static const JSPropertySpec cache_entry_props[] = { }; static JSBool -cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -90,7 +98,7 @@ cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -129,7 +137,7 @@ cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -160,7 +168,7 @@ cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_set_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -222,13 +230,6 @@ cache_entry_finalize(JSFreeOp *op, JSObject *obj) cached->jsobject = NULL; } -static const JSClass cache_entry_class = { - "cache_entry", - JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize -}; /** Return an SMJS object through which scripts can access @a cached. * If there already is such an object, return that; otherwise create a @@ -288,7 +289,7 @@ smjs_detach_cache_entry_object(struct cache_entry *cached) } static JSBool -cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -319,7 +320,7 @@ cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -350,7 +351,7 @@ cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -387,7 +388,7 @@ cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_get_property_uri(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 11488033..04906142 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -82,7 +82,7 @@ smjs_do_file(unsigned char *path) if (!add_file_to_string(&script, path) || JS_FALSE == JS_EvaluateScript(smjs_ctx, - JS_GetGlobalObject(smjs_ctx), + JS_GetGlobalForScopeChain(smjs_ctx), script.source, script.length, path, 1, &rval)) { alert_smjs_error("error loading script file"); ret = 0; @@ -136,8 +136,7 @@ init_smjs(struct module *module) return; } - JS_SetOptions(smjs_ctx, JSOPTION_VAROBJFIX | JSOPTION_METHODJIT); - JS_SetVersion(smjs_ctx, JSVERSION_LATEST); + JS_SetOptions(smjs_ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS_SetErrorReporter(smjs_ctx, error_reporter); diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 69a71a67..88fd4d7b 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -95,10 +95,10 @@ enum elinks_prop { ELINKS_SESSION, }; -static JSBool elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool elinks_get_property_session(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec elinks_props[] = { { "home", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, JSOP_WRAPPER(elinks_get_property_home), JSOP_NULLWRAPPER }, @@ -107,14 +107,24 @@ static const JSPropertySpec elinks_props[] = { { NULL } }; -static const JSClass elinks_class; +static JSBool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); + +static const JSClass elinks_class = { + "elinks", + 0, + JS_PropertyStub, JS_DeletePropertyStub, + elinks_get_property, elinks_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL +}; + /* @elinks_class.getProperty */ static JSBool -elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -169,10 +179,10 @@ elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab } static JSBool -elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -211,13 +221,6 @@ elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool return JS_FALSE; } -static const JSClass elinks_class = { - "elinks", - 0, - JS_PropertyStub, JS_PropertyStub, - elinks_get_property, elinks_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL -}; static const spidermonkeyFunctionSpec elinks_funcs[] = { { "alert", elinks_alert, 1 }, @@ -275,7 +278,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, jsval argv[], int argc, } static JSBool -elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -291,7 +294,7 @@ elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS struct uri *uri; @@ -311,7 +314,7 @@ elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSString *jsstr; @@ -337,7 +340,7 @@ elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -elinks_get_property_session(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSObject *jsobj; diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 74050fde..80866b2a 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -11,13 +11,14 @@ #include "scripting/smjs/core.h" #include "scripting/smjs/global_object.h" +using namespace JS; JSObject *smjs_global_object; static const JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -25,14 +26,18 @@ static const JSClass global_class = { static JSObject * smjs_get_global_object(void) { - JSObject *jsobj; - assert(smjs_ctx); + JSAutoCompartment *acc = NULL; + + JSAutoRequest ar(smjs_ctx); + RootedObject jsobj(smjs_ctx); jsobj = JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL); if (!jsobj) return NULL; + acc = new JSAutoCompartment(smjs_ctx, jsobj); + JS_InitStandardClasses(smjs_ctx, jsobj); return jsobj; diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index fb7064b9..2f8e5bc7 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -12,9 +12,19 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" +static JSBool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static const JSClass smjs_globhist_item_class; /* defined below */ +static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); +static const JSClass smjs_globhist_item_class = { + "global_history_item", + JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ + JS_PropertyStub, JS_DeletePropertyStub, + smjs_globhist_item_get_property, smjs_globhist_item_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_globhist_item_finalize, +}; /* @smjs_globhist_item_class.finalize */ static void @@ -41,12 +51,12 @@ enum smjs_globhist_item_prop { GLOBHIST_LAST_VISIT = -3, }; -static JSBool smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); static const JSPropertySpec smjs_globhist_item_props[] = { { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(smjs_globhist_item_get_property_title), JSOP_WRAPPER(smjs_globhist_item_set_property_title) }, @@ -57,11 +67,11 @@ static const JSPropertySpec smjs_globhist_item_props[] = { /* @smjs_globhist_item_class.getProperty */ static JSBool -smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct global_history_item *history_item; @@ -126,10 +136,10 @@ smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId /* @smjs_globhist_item_class.setProperty */ static JSBool -smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct global_history_item *history_item; @@ -183,14 +193,6 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId } } -static const JSClass smjs_globhist_item_class = { - "global_history_item", - JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ - JS_PropertyStub, JS_PropertyStub, - smjs_globhist_item_get_property, smjs_globhist_item_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_globhist_item_finalize, -}; static JSObject * smjs_get_globhist_item_object(struct global_history_item *history_item) @@ -213,10 +215,10 @@ smjs_get_globhist_item_object(struct global_history_item *history_item) /* @smjs_globhist_class.getProperty */ static JSBool -smjs_globhist_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); (void)obj; JSObject *jsobj; @@ -283,8 +285,8 @@ smjs_init_globhist_interface(void) } static JSBool -smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -308,7 +310,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHan } static JSBool -smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -336,8 +338,8 @@ smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHan } static JSBool -smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -361,7 +363,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl } static JSBool -smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -389,8 +391,8 @@ smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl } static JSBool -smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -431,7 +433,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, /* @smjs_globhist_item_class.setProperty */ static JSBool -smjs_globhist_item_set_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 6a4c28a3..498ca4ac 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -13,14 +13,24 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" -static const JSClass keymap_class; /* defined below */ +static JSBool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void keymap_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass keymap_class = { + "keymap", + JSCLASS_HAS_PRIVATE, /* int * */ + JS_PropertyStub, JS_DeletePropertyStub, + keymap_get_property, keymap_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, +}; /* @keymap_class.getProperty */ static JSBool -keymap_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); unsigned char *action_str; const unsigned char *keystroke_str; @@ -77,10 +87,10 @@ smjs_keybinding_action_callback(va_list ap, void *data) /* @keymap_class.setProperty */ static JSBool -keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); int *data; unsigned char *keymap_str; @@ -179,14 +189,6 @@ keymap_finalize(JSFreeOp *op, JSObject *obj) mem_free(data); } -static const JSClass keymap_class = { - "keymap", - JSCLASS_HAS_PRIVATE, /* int * */ - JS_PropertyStub, JS_PropertyStub, - keymap_get_property, keymap_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, -}; - static JSObject * smjs_get_keymap_object(enum keymap_id keymap_id) { @@ -219,7 +221,7 @@ static JSObject * smjs_get_keymap_hash_object(void) { jsval val; - enum keymap_id keymap_id; + int keymap_id; JSObject *keymaps_hash; keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class, diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 41beda41..98f8f017 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -30,9 +30,30 @@ static JSObject *smjs_session_object; -static const JSClass session_class; /* Defined below. */ +static JSBool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void session_finalize(JSFreeOp *op, JSObject *obj); +static JSBool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); -static const JSClass location_array_class; /* Defined below. */ +static const JSClass session_class = { + "session", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + session_get_property, session_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, + NULL, NULL, NULL, session_construct +}; + +static JSBool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass location_array_class = { + "location_array", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + smjs_location_array_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, +}; /* location_array_class is the class for array object, the elements of which * correspond to the elements of session.history. @@ -42,10 +63,10 @@ static const JSClass location_array_class; /* Defined below. */ /* @location_array.getProperty */ static JSBool -smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; int index; @@ -112,13 +133,6 @@ smjs_location_array_finalize(JSFreeOp *op, JSObject *obj) ses->history_jsobject = NULL; } -static const JSClass location_array_class = { - "location_array", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - smjs_location_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, -}; /** Return an SMJS object through which scripts can access @a ses.history. If * there already is such an object, return that; otherwise create a new one. @@ -191,10 +205,10 @@ static const JSPropertySpec session_props[] = { /* @session_class.getProperty */ static JSBool -session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; @@ -300,10 +314,10 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta } static JSBool -session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; @@ -512,14 +526,6 @@ session_finalize(JSFreeOp *op, JSObject *obj) ses->jsobject = NULL; } -static const JSClass session_class = { - "session", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - session_get_property, session_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, - NULL, NULL, NULL, session_construct -}; /** Return an SMJS object through which scripts can access @a ses. * If there already is such an object, return that; otherwise create a @@ -590,10 +596,10 @@ smjs_detach_session_object(struct session *ses) * previously attached to the session object, the object will remain in * memory but it will no longer be able to access the session object. */ static JSBool -session_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *tabobj; struct terminal *term = JS_GetPrivate(obj); @@ -678,15 +684,15 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) JSString *jsstr; unsigned char *url; struct session *ses; - struct JSObject *this; + struct JSObject *this_o; if (argc != 1) return JS_FALSE; - this = JS_THIS_OBJECT(ctx, rval); - if (!JS_InstanceOf(ctx, this, (JSClass *) &session_class, NULL)) + this_o = JS_THIS_OBJECT(ctx, rval); + if (!JS_InstanceOf(ctx, this_o, (JSClass *) &session_class, NULL)) return JS_FALSE; - ses = JS_GetInstancePrivate(ctx, this, + ses = JS_GetInstancePrivate(ctx, this_o, (JSClass *) &session_class, NULL); if (!ses) return JS_FALSE; /* detached */ diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index e47ba87f..c1cf3e2d 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -17,7 +17,16 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass terminal_class; /* Defined below. */ +static JSBool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static void terminal_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass terminal_class = { + "terminal", + JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ + JS_PropertyStub, JS_DeletePropertyStub, + terminal_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize +}; enum terminal_prop { TERMINAL_TAB, @@ -30,10 +39,10 @@ static const JSPropertySpec terminal_props[] = { /* @terminal_class.getProperty */ static JSBool -terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct terminal *term; @@ -88,13 +97,6 @@ terminal_finalize(JSFreeOp *op, JSObject *obj) term->jsobject = NULL; } -static const JSClass terminal_class = { - "terminal", - JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ - JS_PropertyStub, JS_PropertyStub, - terminal_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize -}; /** Return an SMJS object through which scripts can access @a term. * If there already is such an object, return that; otherwise create a @@ -153,10 +155,10 @@ smjs_detach_terminal_object(struct terminal *term) /* @terminal_array_class.getProperty */ static JSBool -terminal_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +terminal_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); int index; struct terminal *term; diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index 1f23a9b3..158d08e7 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -20,7 +20,17 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass view_state_class; /* defined below */ +static JSBool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void view_state_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass view_state_class = { + "view_state", + JSCLASS_HAS_PRIVATE, /* struct view_state * */ + JS_PropertyStub, JS_DeletePropertyStub, + view_state_get_property, view_state_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -39,10 +49,10 @@ static const JSPropertySpec view_state_props[] = { /* @view_state_class.getProperty */ static JSBool -view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -84,10 +94,10 @@ view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM /* @view_state_class.setProperty */ static JSBool -view_state_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -144,13 +154,6 @@ view_state_finalize(JSFreeOp *op, JSObject *obj) vs->jsobject = NULL; } -static const JSClass view_state_class = { - "view_state", - JSCLASS_HAS_PRIVATE, /* struct view_state * */ - JS_PropertyStub, JS_PropertyStub, - view_state_get_property, view_state_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize -}; /** Return an SMJS object through which scripts can access @a vs. If there * already is such an object, return that; otherwise create a new one. */ @@ -184,7 +187,7 @@ smjs_get_view_state_object(struct view_state *vs) } static JSBool -smjs_elinks_get_view_state(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_elinks_get_view_state(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; diff --git a/src/session/download.h b/src/session/download.h index a4de701e..3d165961 100644 --- a/src/session/download.h +++ b/src/session/download.h @@ -6,6 +6,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Silly BFU stuff */ struct dialog_data; struct listbox_item; @@ -222,4 +226,8 @@ void tp_save(struct type_query *type_query); void tp_cancel(void *data); struct file_download *init_file_download(struct uri *uri, struct session *ses, unsigned char *file, int fd); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/history.h b/src/session/history.h index ed28bf4a..566bc322 100644 --- a/src/session/history.h +++ b/src/session/history.h @@ -1,6 +1,10 @@ #ifndef EL__SESSION_HISTORY_H #define EL__SESSION_HISTORY_H +#ifdef __cplusplus +extern "C" { +#endif + struct location; struct session; @@ -43,4 +47,8 @@ void go_unback(struct session *ses); void ses_history_move(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/location.h b/src/session/location.h index a534b739..52b36526 100644 --- a/src/session/location.h +++ b/src/session/location.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "viewer/text/vs.h" +#ifdef __cplusplus +extern "C" { +#endif + struct location { LIST_HEAD(struct location); @@ -20,4 +24,8 @@ void copy_location(struct location *, struct location *); * @relates location */ void destroy_location(struct location *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/session.h b/src/session/session.h index 04fffedf..c4743fa3 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -10,6 +10,10 @@ #include "util/lists.h" #include "viewer/text/vs.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct link; struct location; @@ -315,4 +319,8 @@ int eat_kbd_repeat_count(struct session *ses); * highlighting and status bar. */ int set_kbd_repeat_count(struct session *ses, int new_count); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/task.h b/src/session/task.h index 1b335bac..0288776e 100644 --- a/src/session/task.h +++ b/src/session/task.h @@ -4,6 +4,10 @@ #include "cache/cache.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct location; struct terminal; @@ -38,4 +42,8 @@ int goto_url_home(struct session *ses); void goto_imgmap(struct session *, struct uri *, unsigned char *); void map_selected(struct terminal *term, void *ld, void *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/color.h b/src/terminal/color.h index 1d4c2834..6302130b 100644 --- a/src/terminal/color.h +++ b/src/terminal/color.h @@ -2,6 +2,11 @@ #define EL__TERMINAL_COLOR_H #include "util/color.h" + +#ifdef __cplusplus +extern "C" { +#endif + struct screen_char; /* Terminal color encoding: */ @@ -86,4 +91,8 @@ void get_screen_char_color(struct screen_char *schar, struct color_pair *pair, void set_term_color(struct screen_char *schar, struct color_pair *pair, enum color_flags flags, enum color_mode mode); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/draw.h b/src/terminal/draw.h index 4d802d00..c8ab9c9c 100644 --- a/src/terminal/draw.h +++ b/src/terminal/draw.h @@ -3,6 +3,10 @@ #include "intl/charsets.h" /* unicode_val_T */ +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct dialog_data; struct el_box; @@ -306,4 +310,8 @@ void set_dlg_cursor(struct terminal *term, struct dialog_data *dlg_data, int x, /** Blanks the screen. */ void clear_terminal(struct terminal *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/event.h b/src/terminal/event.h index 32abc1d1..b098a001 100644 --- a/src/terminal/event.h +++ b/src/terminal/event.h @@ -4,6 +4,10 @@ #include "terminal/kbd.h" #include "terminal/mouse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; /* Some constants for the strings inside of {struct terminal}. */ @@ -202,5 +206,8 @@ void in_term(struct terminal *); mouse_is_in_box(&(event)->info.mouse, box) /** @} */ +#ifdef __cplusplus +} +#endif #endif /* EL__TERMINAL_EVENT_H */ diff --git a/src/terminal/hardio.h b/src/terminal/hardio.h index c3915b0c..29629200 100644 --- a/src/terminal/hardio.h +++ b/src/terminal/hardio.h @@ -1,7 +1,15 @@ #ifndef EL__TERMINAL_HARDIO_H #define EL__TERMINAL_HARDIO_H +#ifdef __cplusplus +extern "C" { +#endif + ssize_t hard_write(int fd, unsigned char *data, size_t datalen); ssize_t hard_read(int fd, unsigned char *data, size_t datalen); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/itrm.h b/src/terminal/itrm.h index c88a37f5..d8a175e2 100644 --- a/src/terminal/itrm.h +++ b/src/terminal/itrm.h @@ -1,6 +1,9 @@ #ifndef EL__TERMINAL_ITRM_H #define EL__TERMINAL_ITRM_H +#ifdef __cplusplus +extern "C" { +#endif #define ITRM_OUT_QUEUE_SIZE 16384 @@ -113,4 +116,8 @@ struct itrm { unsigned int bracketed_pasting:1;/**< Received bracketed-paste escape*/ }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/kbd.h b/src/terminal/kbd.h index e277988f..d80b8b86 100644 --- a/src/terminal/kbd.h +++ b/src/terminal/kbd.h @@ -3,6 +3,10 @@ #include "intl/charsets.h" +#ifdef __cplusplus +extern "C" { +#endif + struct itrm; /** A character received from a terminal. */ @@ -144,5 +148,8 @@ void get_terminal_name(unsigned char *); (kbd_)->modifier = (modifier_); \ } while (0) +#ifdef __cplusplus +} +#endif #endif diff --git a/src/terminal/mouse.h b/src/terminal/mouse.h index 3e650121..272c00a0 100644 --- a/src/terminal/mouse.h +++ b/src/terminal/mouse.h @@ -1,6 +1,10 @@ #ifndef EL__TERMINAL_MOUSE_H #define EL__TERMINAL_MOUSE_H +#ifdef __cplusplus +extern "C" { +#endif + struct interlink_event; struct itrm; @@ -119,5 +123,8 @@ void enable_mouse(void); void toggle_mouse(void); int decode_terminal_mouse_escape_sequence(struct itrm *itrm, struct interlink_event *ev, int el, int v); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/terminal/screen.h b/src/terminal/screen.h index 9513a51e..7ed3bf2f 100644 --- a/src/terminal/screen.h +++ b/src/terminal/screen.h @@ -1,6 +1,9 @@ #ifndef EL__TERMINAL_SCREEN_H #define EL__TERMINAL_SCREEN_H +#ifdef __cplusplus +extern "C" { +#endif struct module; struct screen_char; @@ -52,4 +55,8 @@ void beep_terminal(struct terminal *term); extern struct module terminal_screen_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/tab.h b/src/terminal/tab.h index 1ee1554b..2f2679ed 100644 --- a/src/terminal/tab.h +++ b/src/terminal/tab.h @@ -4,6 +4,10 @@ #include "terminal/terminal.h" #include "terminal/window.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct uri; @@ -37,4 +41,8 @@ void move_current_tab(struct session *ses, int direction); #define foreachback_tab(tab, terminal) \ foreachback (tab, terminal) if (tab->type == WINDOW_TAB) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index 1dddfdb3..16548254 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -5,6 +5,10 @@ #include "terminal/event.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct option; struct terminal_screen; @@ -235,4 +239,8 @@ struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len); extern struct module terminal_module; +#ifdef __cplusplus +} +#endif + #endif /* EL__TERMINAL_TERMINAL_H */ diff --git a/src/terminal/terminfo.h b/src/terminal/terminfo.h index ccf427a8..afbba0c0 100644 --- a/src/terminal/terminfo.h +++ b/src/terminal/terminfo.h @@ -1,6 +1,10 @@ #ifndef EL__TERMINAL_TERMINFO_H #define EL__TERMINAL_TERMINFO_H +#ifdef __cplusplus +extern "C" { +#endif + int terminfo_setupterm(char *term, int fildes); char *terminfo_clear_screen(void); char *terminfo_set_bold(int arg); @@ -10,4 +14,9 @@ char *terminfo_set_foreground(int arg); char *terminfo_set_background(int arg); int terminfo_max_colors(void); char *terminfo_cursor_address(int y, int x); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/window.c b/src/terminal/window.c index f64c6dde..02b2ba06 100644 --- a/src/terminal/window.c +++ b/src/terminal/window.c @@ -220,7 +220,7 @@ set_dlg_window_ptr(struct dialog_data *dlg_data, struct window *window, int x, i set_window_ptr(window, x, y); } -#if CONFIG_SCRIPTING_SPIDERMONKEY +#ifdef CONFIG_SCRIPTING_SPIDERMONKEY /** Check whether keypress events would be directed to @a win. */ int would_window_receive_keypresses(const struct window *win) diff --git a/src/terminal/window.h b/src/terminal/window.h index 14651a81..ce6a666c 100644 --- a/src/terminal/window.h +++ b/src/terminal/window.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct term_event; struct terminal; @@ -100,8 +104,12 @@ void assert_window_stacking(struct terminal *); #define assert_window_stacking(t) ((void) (t)) #endif -#if CONFIG_SCRIPTING_SPIDERMONKEY +#ifdef CONFIG_SCRIPTING_SPIDERMONKEY int would_window_receive_keypresses(const struct window *); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/base64.h b/src/util/base64.h index 2bdf0e42..9e3e71bf 100644 --- a/src/util/base64.h +++ b/src/util/base64.h @@ -1,10 +1,18 @@ #ifndef EL__UTIL_BASE64_H #define EL__UTIL_BASE64_H +#ifdef __cplusplus +extern "C" { +#endif + unsigned char *base64_encode(unsigned char *); unsigned char *base64_decode(unsigned char *); unsigned char *base64_encode_bin(unsigned char *, int, int *); unsigned char *base64_decode_bin(unsigned char *, int, int *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/bitfield.h b/src/util/bitfield.h index 53086104..31fbe26f 100644 --- a/src/util/bitfield.h +++ b/src/util/bitfield.h @@ -2,9 +2,12 @@ #define EL__UTIL_BITFIELD_H #include - #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Bitfield operations: */ /** A vector of bits. The size is fixed at initialization time. */ @@ -161,4 +164,8 @@ bitfield_is_cleared(struct bitfield *bitfield) return 1; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/box.h b/src/util/box.h index 854424f2..050a9ab3 100644 --- a/src/util/box.h +++ b/src/util/box.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_BOX_H #define EL__UTIL_BOX_H +#ifdef __cplusplus +extern "C" { +#endif + /** A rectangular part of a drawing surface, such as the screen. */ struct el_box { int x; @@ -62,5 +66,8 @@ copy_box(struct el_box *dst, struct el_box *src) #define dbg_show_box(box) DBG("x=%i y=%i width=%i height=%i", (box)->x, (box)->y, (box)->width, (box)->height) #define dbg_show_xy(x_, y_) DBG("x=%i y=%i", x_, y_) +#ifdef __cplusplus +} +#endif #endif diff --git a/src/util/color.h b/src/util/color.h index 52f7353c..9ebfe2bc 100644 --- a/src/util/color.h +++ b/src/util/color.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_COLOR_H #define EL__UTIL_COLOR_H +#ifdef __cplusplus +extern "C" { +#endif + typedef uint32_t color_T; struct color_pair { @@ -29,4 +33,8 @@ void init_colors_lookup(void); void free_colors_lookup(void); /** @} */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/conv.h b/src/util/conv.h index 31831463..5c243c10 100644 --- a/src/util/conv.h +++ b/src/util/conv.h @@ -4,6 +4,10 @@ #include "util/string.h" #include "util/time.h" /* timeval_T types */ +#ifdef __cplusplus +extern "C" { +#endif + static inline int is_safe_in_shell(unsigned char c) { @@ -224,4 +228,8 @@ void sanitize_title(unsigned char *title); * It trims starting/ending spaces. */ int sanitize_url(unsigned char *url); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/env.h b/src/util/env.h index 4b40be89..bb49fa19 100644 --- a/src/util/env.h +++ b/src/util/env.h @@ -1,7 +1,14 @@ #ifndef EL__UTIL_ENV_H #define EL__UTIL_ENV_H +#ifdef __cplusplus +extern "C" { +#endif int env_set(unsigned char *name, unsigned char *value, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/error.h b/src/util/error.h index 0a8867f1..4db5de3e 100644 --- a/src/util/error.h +++ b/src/util/error.h @@ -9,6 +9,10 @@ #ifndef EL__UTIL_ERROR_H #define EL__UTIL_ERROR_H +#ifdef __cplusplus +extern "C" { +#endif + /* This errfile thing is needed, as we don't have var-arg macros in standart, * only as gcc extension :(. */ extern int errline; @@ -224,6 +228,9 @@ void do_not_optimize_here(void *x); #define do_not_optimize_here_gcc_3_3(x) #endif +#ifdef __cplusplus +} +#endif /** This function dumps backtrace (or whatever similar it founds on the stack) * nicely formatted and with symbols resolved to @a f. When @a trouble is set, @@ -235,7 +242,17 @@ void do_not_optimize_here(void *x); * if it is available on yours. */ #ifdef CONFIG_BACKTRACE #include + +#ifdef __cplusplus +extern "C" { +#endif + void dump_backtrace(FILE *f, int trouble); + +#ifdef __cplusplus +} +#endif + #endif /** This is needed for providing info about features when dumping core */ diff --git a/src/util/fastfind.h b/src/util/fastfind.h index b0142782..6cde7435 100644 --- a/src/util/fastfind.h +++ b/src/util/fastfind.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_FASTFIND_H #define EL__UTIL_FASTFIND_H +#ifdef __cplusplus +extern "C" { +#endif + /** Whether to use these routines or not. */ #ifndef CONFIG_SMALL #define USE_FASTFIND 1 @@ -61,4 +65,8 @@ void fastfind_done(struct fastfind_index *index); #endif +#ifdef __cplusplus +} +#endif + #endif /* EL__UTIL_FASTFIND_H */ diff --git a/src/util/file.h b/src/util/file.h index b8ffa082..b93ea76c 100644 --- a/src/util/file.h +++ b/src/util/file.h @@ -7,6 +7,10 @@ #include "util/conv.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Data read about an entry in a directory. * The strings pointed to by this structure are in the system * charset (i.e. LC_CTYPE) and must be freed with mem_free(). */ @@ -260,5 +264,9 @@ stat_date(struct string *string, struct stat *stp) add_to_string(string, " "); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/hash.h b/src/util/hash.h index fd306a77..45225f4c 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /** This should be hopefully always 32bit at least. I'm not sure what will * happen when this will be of other length, but it should still work ok. * --pasky */ @@ -36,4 +40,8 @@ void del_hash_item(struct hash *hash, struct hash_item *item); for (iterator = 0; iterator < (1 << (hash_table).width); iterator++) \ foreach (item, (hash_table).hash[iterator]) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/lists.h b/src/util/lists.h index b577c9fc..67e423e6 100644 --- a/src/util/lists.h +++ b/src/util/lists.h @@ -3,6 +3,10 @@ #include "util/error.h" /* do_not_optimize_here() */ +#ifdef __cplusplus +extern "C" { +#endif + /* BEWARE! You MAY NOT use ternary operator as parameter to there functions, * because they are likely to take & of the parameter. Worst of all, it will * work with gcc. But nowhere else (at least not w/ tcc). */ @@ -237,5 +241,8 @@ list_size(struct list_head *list) } \ } while (0) +#ifdef __cplusplus +} +#endif #endif /* EL__UTIL_LISTS_H */ diff --git a/src/util/math.h b/src/util/math.h index 0d5c0f3a..00c4f478 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -1,6 +1,9 @@ #ifndef EL__UTIL_MATH_H #define EL__UTIL_MATH_H +#ifdef __cplusplus +extern "C" { +#endif /* It's evil to include this directly, elinks.h includes it for you * at the right time. */ @@ -74,4 +77,8 @@ int_bounds(register int *what, register int lower_limit, (b) = (swap_register_); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/md5.h b/src/util/md5.h index f23caf8b..61e371a4 100644 --- a/src/util/md5.h +++ b/src/util/md5.h @@ -1,6 +1,7 @@ #ifndef EL__UTIL_MD5_H #define EL__UTIL_MD5_H + /* Optionally MD5 support can depend on external implementation when linking * against a SSL library that supports it. */ #if defined(CONFIG_OWN_LIBC) @@ -13,6 +14,10 @@ #define CONFIG_MD5 1 #endif +#ifdef __cplusplus +extern "C" { +#endif + /* GNU TLS doesn't define this */ #ifndef MD5_DIGEST_LENGTH #define MD5_DIGEST_LENGTH 16 @@ -55,4 +60,8 @@ typedef struct md5_context MD5_CTX; /** @} */ #endif /* CONFIG_MD5 */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memdebug.h b/src/util/memdebug.h index bcccd41a..553a1f1f 100644 --- a/src/util/memdebug.h +++ b/src/util/memdebug.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_MEMDEBUG_H #define EL__UTIL_MEMDEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef DEBUG_MEMLEAK /* TODO: Another file? */ @@ -24,4 +28,8 @@ void check_memory_leaks(void); #define set_mem_comment(p, c, l) #endif /* DEBUG_MEMLEAK */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memlist.h b/src/util/memlist.h index 5fe34ba1..0c1dd785 100644 --- a/src/util/memlist.h +++ b/src/util/memlist.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_MEMLIST_H #define EL__UTIL_MEMLIST_H +#ifdef __cplusplus +extern "C" { +#endif + struct memory_list { int n; void *p[1]; @@ -30,4 +34,8 @@ void add_one_to_ml(struct memory_list **ml, void *p); void freeml(struct memory_list *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memory.h b/src/util/memory.h index 5b531f5e..e41eee1b 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -20,6 +20,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef HAVE_MMAP void *mem_mmap_alloc(size_t size); void mem_mmap_free(void *p, size_t size); @@ -191,4 +195,8 @@ intdup__( return p; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/profile.h b/src/util/profile.h index 4570e9b0..edc6aa4d 100644 --- a/src/util/profile.h +++ b/src/util/profile.h @@ -11,6 +11,10 @@ #ifdef CONFIG_DEBUG #include +#ifdef __cplusplus +extern "C" { +#endif + /** @c CLK_DECL(n) declares an array of @a n clock_t to be used by * CLK_* macros. Must occur before any CLK_* macros call. */ #define CLK_DECL(n) clock_t clk_start[n], clk_end[n], clk_diff[n]; int clk_start_line[n], clk_stop_line[n] @@ -37,6 +41,10 @@ #define CLK_STA() CLK_DECL(1); CLK_START(0) #define CLK_STO() CLK_STOP(0); CLK_DUMP(0) +#ifdef __cplusplus +} +#endif + #else /* Dummy macros. */ #define CLK_DECL(n) @@ -47,4 +55,5 @@ #define CLK_STO() #endif + #endif diff --git a/src/util/random.h b/src/util/random.h index bd4bb49e..65da34d9 100644 --- a/src/util/random.h +++ b/src/util/random.h @@ -4,8 +4,16 @@ #ifndef EL__UTIL_RANDOM_H #define EL__UTIL_RANDOM_H +#ifdef __cplusplus +extern "C" { +#endif + void seed_rand_once(void); void random_nonce(unsigned char buf[], size_t size); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/scanner.h b/src/util/scanner.h index 1af37d60..51fa8fcd 100644 --- a/src/util/scanner.h +++ b/src/util/scanner.h @@ -4,6 +4,10 @@ #include "util/error.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Define if you want a talking scanner */ /* #define DEBUG_SCANNER */ @@ -260,4 +264,8 @@ end_token_scanning(struct scanner *scanner, struct scanner_token *end) return get_scanner_token(scanner); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/secsave.h b/src/util/secsave.h index e1e38305..d606c641 100644 --- a/src/util/secsave.h +++ b/src/util/secsave.h @@ -7,6 +7,10 @@ #include #include /* mode_t */ +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; enum secsave_errno { @@ -45,4 +49,8 @@ int secure_fprintf(struct secure_save_info *, const char *, ...); unsigned char *secsave_strerror(enum secsave_errno, struct terminal *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/sha1.h b/src/util/sha1.h index 9948a3a7..f1de5ad0 100644 --- a/src/util/sha1.h +++ b/src/util/sha1.h @@ -44,6 +44,11 @@ #define CONFIG_SHA1 1 #endif +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef SHA_DIGEST_LENGTH #define SHA_DIGEST_LENGTH 20 #endif @@ -78,4 +83,8 @@ typedef struct sha1_context SHA_CTX; #endif /* CONFIG_SHA1 */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/snprintf.h b/src/util/snprintf.h index de222453..116160cd 100644 --- a/src/util/snprintf.h +++ b/src/util/snprintf.h @@ -9,6 +9,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* XXX: This is not quite the best place for it, perhaps. But do we have * a better one now? --pasky */ #ifndef va_copy @@ -56,6 +60,9 @@ int elinks_vasprintf(char **ptr, const char *fmt, va_list ap); int elinks_asprintf(char **ptr, const char *fmt, ...); #endif +#ifdef __cplusplus +} +#endif /* These are wrappers for (v)asprintf() which return the strings allocated by * ELinks' own memory allocation routines, thus it is usable in the context of @@ -68,6 +75,10 @@ int elinks_asprintf(char **ptr, const char *fmt, ...); #include #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + int vasprintf(char **ptr, const char *fmt, va_list ap); static inline unsigned char * @@ -89,5 +100,8 @@ vasprintfa(const char *fmt, va_list ap) { unsigned char *asprintfa(const char *fmt, ...); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/util/string.h b/src/util/string.h index 509453da..4f3cef53 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -1,6 +1,7 @@ #ifndef EL__UTIL_STRING_H #define EL__UTIL_STRING_H + /* To these two functions, same remark applies as to copy_string() or * straconcat(). */ @@ -13,6 +14,9 @@ #include "util/memdebug.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif #ifndef DEBUG_MEMLEAK @@ -297,4 +301,8 @@ void free_string_list(LIST_OF(struct string_list_item) *list); /** Allocated copy if not NULL or returns NULL. */ #define null_or_stracpy(str) ((str) ? stracpy(str) : NULL) +#ifdef __cplusplus +} +#endif + #endif /* EL__UTIL_STRING_H */ diff --git a/src/util/test.h b/src/util/test.h index cdb1b403..2aa374d4 100644 --- a/src/util/test.h +++ b/src/util/test.h @@ -5,6 +5,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + static inline void #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || __GNUC__ > 2 __attribute__((noreturn)) @@ -50,4 +54,8 @@ get_test_opt(char **argref, const char *name, int *argi, int argc, char *argv[], return 1; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/time.h b/src/util/time.h index 06e88e26..d2653aa8 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -11,6 +11,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef long milliseconds_T; #define MILLISECONDS_MAX ((milliseconds_T) (LONG_MAX / 1000L)) #define ms_max(a, b) ((a) < (b) ? (b) : (a)) @@ -56,4 +60,8 @@ int timeval_div_off_t(off_t n, timeval_T *t); /** @relates timeval_T */ #define timeval_copy(dst, src) copy_struct(dst, src) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/action.h b/src/viewer/action.h index 54977d42..e3a95d27 100644 --- a/src/viewer/action.h +++ b/src/viewer/action.h @@ -3,6 +3,10 @@ #include "config/kbdbind.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; enum frame_event_status { @@ -19,4 +23,8 @@ enum frame_event_status { enum frame_event_status do_action(struct session *ses, enum main_action action_id, int verbose); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/dump/dump-color-mode.h b/src/viewer/dump/dump-color-mode.h index c0c472db..7d4d54f1 100644 --- a/src/viewer/dump/dump-color-mode.h +++ b/src/viewer/dump/dump-color-mode.h @@ -22,6 +22,8 @@ * - DUMP_COLOR_MODE_TRUE */ + + #define DUMP_FUNCTION_SPECIALIZED DUMP_FUNCTION_UNIBYTE #include "dump-specialized.h" #undef DUMP_FUNCTION_SPECIALIZED @@ -34,6 +36,11 @@ # undef DUMP_CHARSET_UTF8 #endif /* CONFIG_UTF8 */ + +#ifdef __cplusplus +extern "C" { +#endif + static int DUMP_FUNCTION_COLOR(struct document *document, struct dump_output *out) { @@ -44,3 +51,7 @@ DUMP_FUNCTION_COLOR(struct document *document, struct dump_output *out) return DUMP_FUNCTION_UNIBYTE(document, out); } + +#ifdef __cplusplus +} +#endif diff --git a/src/viewer/dump/dump-specialized.h b/src/viewer/dump/dump-specialized.h index cf0baa38..668542a6 100644 --- a/src/viewer/dump/dump-specialized.h +++ b/src/viewer/dump/dump-specialized.h @@ -23,6 +23,10 @@ * - DUMP_CHARSET_UTF8 */ +#ifdef __cplusplus +extern "C" { +#endif + static int DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out) { @@ -180,3 +184,7 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out) return 0; } + +#ifdef __cplusplus +} +#endif diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index c3f1fa32..2a04dc24 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -408,6 +408,7 @@ dump_formatted(int fd, struct download *download, struct cache_entry *cached) o.plain = 0; o.frames = 0; o.links_numbering = get_opt_bool("document.dump.numbering", NULL); + o.dump = 1; init_vs(&vs, cached->uri, -1); diff --git a/src/viewer/dump/dump.h b/src/viewer/dump/dump.h index cf60acfe..85ade6cc 100644 --- a/src/viewer/dump/dump.h +++ b/src/viewer/dump/dump.h @@ -4,6 +4,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; struct document; @@ -14,4 +18,8 @@ add_document_to_string(struct string *string, struct document *document); int dump_to_file(struct document *, int); void dump_next(LIST_OF(struct string_list_item) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/draw.h b/src/viewer/text/draw.h index a8009c38..a286475e 100644 --- a/src/viewer/text/draw.h +++ b/src/viewer/text/draw.h @@ -2,6 +2,10 @@ #ifndef EL__VIEWER_TEXT_DRAW_H #define EL__VIEWER_TEXT_DRAW_H +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct session; @@ -15,4 +19,8 @@ void draw_formatted(struct session *ses, int rerender); /** Update the document view, including frames and the status messages */ void refresh_view(struct session *ses, struct document_view *doc_view, int frames); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/form.h b/src/viewer/text/form.h index 2281d054..7ea6859f 100644 --- a/src/viewer/text/form.h +++ b/src/viewer/text/form.h @@ -6,6 +6,10 @@ #include "util/lists.h" /* LIST_HEAD */ #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct document_view; struct link; @@ -130,4 +134,8 @@ void do_reset_form(struct document_view *doc_view, struct form *form); void link_form_menu(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/link.h b/src/viewer/text/link.h index 9a88bb99..50ce4a11 100644 --- a/src/viewer/text/link.h +++ b/src/viewer/text/link.h @@ -4,6 +4,10 @@ #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct document_view; struct link; @@ -61,4 +65,8 @@ enum frame_event_status try_document_key(struct session *ses, struct uri *get_link_uri(struct session *ses, struct document_view *doc_view, struct link *link); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/marks.h b/src/viewer/text/marks.h index 17185248..9c8397d8 100644 --- a/src/viewer/text/marks.h +++ b/src/viewer/text/marks.h @@ -2,6 +2,10 @@ #ifndef EL__VIEWER_TEXT_MARKS_H #define EL__VIEWER_TEXT_MARKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct view_state; @@ -10,4 +14,8 @@ void set_mark(unsigned char mark, struct view_state *vs); extern struct module viewer_marks_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index af6986ea..ac9ed220 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -982,7 +982,8 @@ get_searched_all(struct session *ses, struct document_view *doc_view, struct poi if (*pt == NULL) return FIND_ERROR_NOT_FOUND; - return move_search_do(ses, doc_view, 0); + move_search_do(ses, doc_view, 0); + return FIND_ERROR_NONE; } static enum find_error @@ -1093,6 +1094,10 @@ static int find_next_link_in_search(struct document_view *doc_view, int direction) { int utf8 = 0; + struct point *pt = NULL; + struct link *link; + int len; + #ifdef CONFIG_UTF8 utf8 = doc_view->document->options.utf8; #endif @@ -1114,10 +1119,6 @@ find_next_link_in_search(struct document_view *doc_view, int direction) while (doc_view->vs->current_link != -1 && next_link_in_view(doc_view, doc_view->vs->current_link + direction, direction)) { - struct point *pt = NULL; - struct link *link; - int len; - nt: link = &doc_view->document->links[doc_view->vs->current_link]; get_searched(doc_view, &pt, &len, utf8); diff --git a/src/viewer/text/search.h b/src/viewer/text/search.h index 0839fbea..54d8327d 100644 --- a/src/viewer/text/search.h +++ b/src/viewer/text/search.h @@ -6,6 +6,10 @@ #include "document/view.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; struct terminal; @@ -29,4 +33,8 @@ static inline int has_search_word(struct document_view *doc_view) && (*doc_view->search_word)[0]); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/textarea.h b/src/viewer/text/textarea.h index 80c8773f..c70faf11 100644 --- a/src/viewer/text/textarea.h +++ b/src/viewer/text/textarea.h @@ -7,6 +7,10 @@ #include "viewer/action.h" #include "viewer/text/form.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct el_form_control; struct link; @@ -47,4 +51,8 @@ enum frame_event_status textarea_op_enter(struct form_state *fs, struct el_form_ void set_textarea(struct document_view *doc_view, int direction); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/view.h b/src/viewer/text/view.h index 5934b15b..ad3b5a09 100644 --- a/src/viewer/text/view.h +++ b/src/viewer/text/view.h @@ -5,6 +5,10 @@ #include "config/kbdbind.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct session; struct term_event; @@ -105,4 +109,8 @@ void open_link_dialog(struct session *ses); /** @} */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/vs.h b/src/viewer/text/vs.h index f9a0a417..047d6cc0 100644 --- a/src/viewer/text/vs.h +++ b/src/viewer/text/vs.h @@ -4,6 +4,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Crossdeps are evil. */ struct document_view; struct form_state; @@ -64,4 +68,8 @@ void check_vs(struct document_view *); void next_frame(struct session *, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/timer.h b/src/viewer/timer.h index ef623871..2b07c12b 100644 --- a/src/viewer/timer.h +++ b/src/viewer/timer.h @@ -1,6 +1,10 @@ #ifndef EL__VIEWER_TIMER_H #define EL__VIEWER_TIMER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; int get_timer_duration(void); @@ -8,4 +12,8 @@ void reset_timer(void); extern struct module timer_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/viewer.h b/src/viewer/viewer.h index c32f92e8..90f3924f 100644 --- a/src/viewer/viewer.h +++ b/src/viewer/viewer.h @@ -1,8 +1,16 @@ #ifndef EL__VIEWER_VIEWER_H #define EL__VIEWER_VIEWER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module viewer_module; +#ifdef __cplusplus +} +#endif + #endif