1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-01 02:05:33 +00:00
Commit Graph

352 Commits

Author SHA1 Message Date
Miciah Dashiel Butler Masters
8617d69872 SMJS: keymap_set_property: fix build error
Fix an error in the order of variable initialisation that was introduced
in commit bbf0d478e9.
2006-11-26 12:43:45 +00:00
Kalle Olavi Niemitalo
15ea2b9b50 Bug 846: Add two more comments about how SMJS calls functions.
They should have been in commit 670ad939c3.
The corresponding commit fcebd6d111 in the
elinks-0.11 branch does include them.
2006-11-25 23:25:52 +02:00
Kalle Olavi Niemitalo
47dce0922b Bug 846: Add plenty of JS_InstanceOf assertions and checks. 2006-11-25 16:09:38 +02:00
Kalle Olavi Niemitalo
bbf0d478e9 Bug 846: Separate JS_GetParent & JS_GetPrivate calls from initializations.
This will allow the types of objects to be checked before those calls.
2006-11-25 15:55:25 +02:00
Kalle Olavi Niemitalo
356678dd80 Bug 846: Document the JSClass assumed in each JS_{Set,Get}Private call. 2006-11-25 14:52:58 +02:00
Kalle Olavi Niemitalo
670ad939c3 Bug 846: Comments on the relations between JSClasses and functions. 2006-11-25 13:36:28 +02:00
Kalle Olavi Niemitalo
d6ea143f36 Bug 846: Document the private data in each SMJS class. 2006-11-25 13:19:35 +02:00
Petr Baudis
5af21a8d29 Fix perl pre_format_html hook wrt. binary files
When trying to view a binary file, this hook would cut it at the first
'\0'.
2006-11-03 19:22:58 +01:00
M. Levinson
50b6a61f31 Another fix for Python backend. 2006-10-22 18:45:45 +02:00
Witold Filipczyk
68913c8c7d Oh, sorry. I forgot about these. 2006-10-19 16:20:26 +02:00
M. Levinson
ebadc9bf9e Additional functionality for Python backend. 2006-10-19 15:21:39 +02:00
Kalle Olavi Niemitalo
c33d195ff4 Garbage-collect SMJS objects before flushing caches. 2006-09-25 23:43:32 +03:00
Kalle Olavi Niemitalo
359b131c6b Bug 810: Add a few comments pointing to the bug. 2006-09-24 00:21:03 +03:00
Kalle Olavi Niemitalo
2eeb14f95c Key name strings are const in read_key() and in its (indirect) callers. 2006-08-13 14:44:01 +03:00
Witold Filipczyk
6c8f532692 Fixes to the Python scripting by M. Levinson 2006-07-24 18:52:25 +02:00
Petr Baudis
250669b0e9 Merge with /srv/git/elinks.git 2006-07-13 02:49:41 +02:00
Witold Filipczyk
d1e5e0b7d2 Introduced STRING_DIR_SEP for better portability 2006-07-02 08:44:52 +02:00
Petr Baudis
0f8ee055db Fix compilation of perl hooks
It complains here that n_a might be used uninitialized and POPpx doesn't
set anything like it.
2006-06-30 00:54:06 +02:00
Laurent MONIN
bd38ed5b17 LUA: use long instead of int with OPT_LONG. 2006-06-26 17:55:42 +02:00
Laurent MONIN
2454ceffb7 config/options: use struct option big_number field instead of number
field where OPT_LONG is used.
2006-06-26 17:49:59 +02:00
Miciah Dashiel Butler Masters
52bd1ea01b SMJS: Fix crash with elinks.vs and no document loaded
Make sure that there really is a view_state before creating a wrapper
object with a bad pointer for it.
2006-06-11 02:33:41 +00:00
Miciah Dashiel Butler Masters
5899c281ce SMJS: bookmark_folder_get_property: Reflow some code. 2006-06-11 00:37:31 +00:00
Miciah Dashiel Butler Masters
1a3b718f98 SMJS: bookmark_folder_get_property: Reflow some code.
Set the return value to JSVAL_NULL up front instead of in every error
handling block.
2006-06-11 00:33:19 +00:00
Miciah Dashiel Butler Masters
ec1ab9fbe9 SMJS: Better handle when the C code tries to call a badly defined method
Before, when one assigned a value other than a function to
elinks.preformat_html, elinks.goto_url_hook, or elinks.follow_url_hook,
an assertion failure was triggered (and probably worse happened in
non-DEBUG builds). Now just fail silently.
2006-06-10 18:11:37 +00:00
Miciah Dashiel Butler Masters
355cbebaad SMJS: Add elinks.vs
E.g., elinks.vs.plain = 0; elinks.action.rerender(); forces ELinks to
rerender the current document as HTML.
2006-06-10 18:11:37 +00:00
Miciah Dashiel Butler Masters
1df39d5068 SMJS: Add elinks.action
E.g., elinks.action.link_follow(20) follows the twentieth link.
The argument is optional.
2006-06-10 18:11:37 +00:00
Jonas Fonseca
4433438f92 SMJS: Add execute method to the elinks object
It is similar to lua's execute and let's you run a command line in
'non-blocking' mode. Example:

	elinks.keymaps.main["F"] = function () {
		elinks.execute("firefox " + elinks.location);
	};
2006-06-06 16:30:24 +02:00
Miciah Dashiel Butler Masters
6ab4eee456 SMJS: Introduce elinks.globhist.
Items can be accessed via elinks.globhist["http://www.foo.net/"]. The
resulting object has title, url, and last_visit properties. last_visit
is the seconds since the epoch. See comments in the code for why I don't
provide a nicer interface for last_visit.
2006-05-03 13:52:58 +00:00
Miciah Dashiel Butler Masters
e27596c5dc SMJS: Add the elinks.load_uri(uri, callback) interface.
|callback| will be applied to the cache object when the download of
|uri| completes.
2006-04-30 04:22:11 +00:00
Witold Filipczyk
4f15dd9a2d Python.h must be included as last to satisfy tcc, but Python redefines
_POSIX_C_SOURCE macro, so #undef here to avoid warnings
2006-04-06 00:52:17 +02:00
Kalle Olavi Niemitalo
3dcb386b81 Merge with http://elinks.cz/elinks.git 2006-02-12 23:42:05 +02:00
Miciah Dashiel Butler Masters
8ce8740359 SMJS: Return JS_FALSE if one specifies an invalid type of action for
a keybinding.
2006-02-12 21:20:36 +00:00
Kalle Olavi Niemitalo
e7dfe6d5da Merge with http://elinks.cz/elinks.git 2006-02-12 23:15:59 +02:00
Miciah Dashiel Butler Masters
3dfa237982 Include bfu/msgbox.h for info_box.
This is clearly unnecessary as the code already builds, but it is more
proper to include the header file explicitely.
2006-02-12 21:07:15 +00:00
Miciah Dashiel Butler Masters
3bd14d8392 SMJS: elinks.alert: drop the extra 'error' text
Use info_box directly instead of via report_scripting_error by way of
alert_smjs_error, thereby avoiding the addition of extra text saying
that an error has occurred.
2006-02-12 21:05:35 +00:00
Miciah Dashiel Butler Masters
d5fe12b5f4 Merge script_hook_goto_url and script_hook_follow_url
Combine the two into the new script_hook_url and use the hook data field
to store the name of the appropriate ECMAScript routine.
2006-02-12 20:55:25 +00:00
Kalle Olavi Niemitalo
37bea9cfdb Merge with /home/kalle/src/MIRROR/elinks/.git 2006-02-11 09:39:41 +02:00
Laurent MONIN
baf7b0e91d Fix segfaults caused by ruby scripting (gentoo bug #121247). Backported
from gentoo portage tree.
2006-02-10 21:28:50 +01:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
87e27b9b3e goto_url_hook takes 2 params not 1. Some dumbprefixes defined in hooks.py 2006-01-29 14:58:03 +01:00
8cc828bf7c Compilation fix 2006-01-29 12:28:05 +01:00
669d4af154 Compilation fixes 2006-01-28 20:54:11 +01:00
Miciah Dashiel Butler Masters
495fb2805b SMJS: Give user scripts access to the view_state
Introduce the view_state object to ECMAScript with properties .uri and
.plain and pass the current view_state to preformat hooks.
2006-01-28 03:27:45 +00:00
Jonas Fonseca
ba45514339 Change the SMJS scripting module name to Spidermonkey ECMAScript 2006-01-19 00:14:50 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
5a5d223020 Merge with http://elinks.cz/elinks.git 2006-01-15 15:06:08 +02:00
Laurent MONIN
c1305b3e5b #define filenames. 2006-01-15 09:56:19 +01:00
Jonas Fonseca
53dea9c89e Change the Guile hooks file name from internal-hooks.scm to hooks.scm 2006-01-14 22:36:23 +01:00
Kalle Olavi Niemitalo
a7e465d785 Merge with http://elinks.cz/elinks.git 2006-01-14 21:38:13 +02:00
Kalle Olavi Niemitalo
556f933728 Merge with 80b0607167
(via http://elinks.cz/elinks.git)
2006-01-14 21:33:04 +02:00
Kalle Olavi Niemitalo
c31450e862 Merge with 76751d1935
(via http://elinks.cz/elinks.git)
2006-01-14 21:31:24 +02:00
Kalle Olavi Niemitalo
89fe822f70 Merge with 6a9ea02f3a
(via http://elinks.cz/elinks.git)
2006-01-14 21:30:12 +02:00
Laurent MONIN
7cc17f7dce Cosmetic change. 2006-01-12 18:44:26 +01:00
Laurent MONIN
2965be7721 There is no SEE scripting anymore so fix that conditionnal. 2006-01-12 17:23:05 +01:00
Laurent MONIN
a9b8abb70c 2006-01-11 14:14:11 +01:00
Laurent MONIN
52537b6733 2006-01-11 14:10:58 +01:00
Laurent MONIN
76751d1935 2006-01-11 14:10:51 +01:00
Laurent MONIN
5805586f0f 2006-01-11 14:10:41 +01:00
Laurent MONIN
4b2b5798ab 2006-01-11 14:07:17 +01:00
Laurent MONIN
f7a2dfc12a CONFIG_LUA -> CONFIG_SCRIPTING_LUA 2006-01-11 14:06:13 +01:00
Jonas Fonseca
ccc6527bba Fix smjs scripting #ifdefs to use CONFIG_SM_SCRIPTING 2006-01-11 01:55:24 +01:00
Kalle Olavi Niemitalo
93714a3e35 Merge with http://elinks.cz/elinks.git 2006-01-06 02:13:11 +02:00
Miciah Dashiel Butler Masters
97b5b9cfe1 Check for hooks.js before trying to load it.
Check file_exists(path) before calling smjs_do_file(path)
in smjs_load_hooks to fix an error message when there is no hooks.js,
reported by zas.
2006-01-02 18:53:13 +00:00
Laurent MONIN
54997c506f Drop trailing whitespaces. 2006-01-02 00:15:20 +01:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Miciah Dashiel Butler Masters
6a44d5192d Fix a typo in an error message in cache_entry_set_property: s/get/set/ 2005-12-29 22:31:25 +00:00
Miciah Dashiel Butler Masters
7f1711471f Drop an extra object_lock in bookmark_folder_get_property:
smjs_get_bookmark_object will lock the bookmark for us.
2005-12-29 22:19:19 +00:00
Miciah Dashiel Butler Masters
9e06b709d4 Return NULL when a script tries to get a bookmark that does not exist
in the given folder. (What was I thinking before?)
2005-12-29 22:18:45 +00:00
Miciah Dashiel Butler Masters
684bac3b22 Define do_file before loading hooks.js in case hooks.js wants to use
do_file immediately.
2005-12-29 14:24:00 +00:00
Miciah Dashiel Butler Masters
ae42c586f8 Add elinks.home property. 2005-12-29 14:19:09 +00:00
Miciah Dashiel Butler Masters
a4be153703 Generalise the error message from smjs_do_file by dropping 'default'
from 'error loading default script file'.
2005-12-29 13:54:26 +00:00
Miciah Dashiel Butler Masters
b52a29f8c0 Let smjs_do_file return 0 to indicate failure and 1 to indicate
success. Add smjs_do_file_wrapper and let ECMAScript load files with
do_file(path).
2005-12-29 13:48:02 +00:00
Miciah Dashiel Butler Masters
cb506ea412 Factor smjs_do_file out of smjs_load_hooks. 2005-12-29 13:27:12 +00:00
Miciah Dashiel Butler Masters
9d4893e384 Mark smjs_load_hooks static. 2005-12-29 13:26:38 +00:00
Miciah Dashiel Butler Masters
79cf499cf9 Use JS_PropertyStub instead of NULL where applicable in JSClass
definitions.
2005-12-29 07:25:04 +00:00
Miciah Dashiel Butler Masters
46b1db47a2 Check JS_TRUE == ... instead of JS_FALSE != ... in smjs_get_keymap_object. 2005-12-29 07:20:33 +00:00
Miciah Dashiel Butler Masters
1ba2b6931a Don't check CACHE_ENTRY_LENGTH in cache_entry_set_property since, as
Jonas pointed out, .length is read-only, so SpiderMonkey will never
pass the setter CACHE_ENTRY_LENGTH. Anyway, .uri is also read-only and
is not handled in the setter.
2005-12-29 07:19:15 +00:00
Miciah Dashiel Butler Masters
17b7ffc7df Add elinks.bookmarks interface for reading bookmarks. 2005-12-29 07:05:31 +00:00
Miciah Dashiel Butler Masters
81be17108b Understand a boolean true from elinks.goto_url_hook and
elinks.follow_url_hook to mean that the URI should be unchanged and that
further hooks should be permitted to run.
2005-12-28 07:12:09 +00:00
Miciah Dashiel Butler Masters
76d9b9de91 Add elinks.follow_url_hook. 2005-12-28 07:07:21 +00:00
Miciah Dashiel Butler Masters
d7c7736008 Add elinks.goto_url_hook. 2005-12-28 07:06:42 +00:00
Miciah Dashiel Butler Masters
c0fd25b368 Add a read-only .uri property to the cache_entry class. 2005-12-28 06:37:00 +00:00
Miciah Dashiel Butler Masters
1602bd5d29 Factor intdup out of smjs_get_keymap_object. 2005-12-26 11:07:15 +00:00
Jonas Fonseca
61185ff34e Make ECMAScript browser scripting configurable
Either set CONFIG_SM_SCRIPTING in features.conf or pass to ./configure the
option --disable-sm-scripting. Now scripting is also enabled when needed
and not only if some other scripting backend is enabled.

Remove some remnants of SEE scripting backend.
2005-12-25 02:23:54 +01:00
Miciah Dashiel Butler Masters
309f3d26f3 In smjs_get_keymap_object, free the private data JS_SetPrivate fails,
per fonseca's suggestion.
2005-12-24 18:07:55 +00:00
Miciah Dashiel Butler Masters
f46cdd8f03 Add elinks.location property to get and set the current URL. 2005-12-24 18:05:32 +00:00
Miciah Dashiel Butler Masters
d44a24050c Undo in favour of a nicer API... 2005-12-24 07:17:36 +00:00
Miciah Dashiel Butler Masters
054fb15ff0 Add an elinks.goto_url method. 2005-12-24 07:14:51 +00:00
Miciah Dashiel Butler Masters
330cd6b7ce Assign the given ses to smjs_ses while the ECMAScript callback runs in
smjs_keybinding_action_callback.
2005-12-24 07:01:17 +00:00
Miciah Dashiel Butler Masters
80a5467b8d Introduce get_action_from_keystroke and get_action_name_from_keystroke.
Introduce smjs_init_keybinding_interface, which creates elinks.keymaps.<map>
for <map> in "main", "edit", and "menu". elinks.keymaps.<map> is a hash
indexed by string representations of keystrokes, and can be used to get the
current action for a key and to set the action either to an internal ELinks
action or to an ECMAScript function.
2005-12-24 06:54:01 +00:00
Miciah Dashiel Butler Masters
92da153e13 Lock the struct cache_entry when creating the corresponding ECMAScript
object in smjs_get_cache_entry_object and unlock it in the new finalizer
cache_entry_finalize.
2005-12-24 04:07:32 +00:00
Miciah Dashiel Butler Masters
f8de70b8f6 Comment smjs_elinks_object. 2005-12-24 03:49:06 +00:00
Miciah Dashiel Butler Masters
9b645f9b66 Move smjs_elinks_object to elinks_object.h. 2005-12-24 03:48:57 +00:00
Miciah Dashiel Butler Masters
8743ec74d8 Factor the initialisation of smjs_elinks_global out of init_smjs and
into the new smjs_init_elinks_object.
2005-12-24 03:47:34 +00:00
Miciah Dashiel Butler Masters
60dd7515f9 Change smjs_get_elinks_object to use smjs_global_object instead of
an argument.
2005-12-24 03:43:53 +00:00
Miciah Dashiel Butler Masters
d6ecf895ce Make global_object a global with the new name smjs_global_object and
create smjs_init_global_object to initialise the global.
2005-12-24 03:40:59 +00:00
Miciah Dashiel Butler Masters
3174c533b0 Factor smjs_get_global_object out of init_smjs. 2005-12-24 03:39:24 +00:00
Miciah Dashiel Butler Masters
2a0653a9f2 Fix the comment heading to say ECMAScript instead of Ruby. 2005-12-22 23:45:12 +00:00
Miciah Dashiel Butler Masters
f6ce6c84f7 Rename get_cache_entry_object to smjs_get_cache_entry_object for great
consistency.
2005-12-20 22:13:29 +00:00
Miciah Dashiel Butler Masters
9e15d09340 NULL-terminate cache_entry_props. This and the last change resolves
crashes with GCC 2.x and 3.x reported by zas.
2005-12-20 22:10:59 +00:00
Miciah Dashiel Butler Masters
bb4f08172b In init_smjs, mark global_class static. 2005-12-20 22:09:56 +00:00
Miciah Dashiel Butler Masters
be76bed022 Check the return values of JS_SetPrivate and JS_DefineProperties in
get_cache_entry_object.
2005-12-20 10:44:51 +00:00
Miciah Dashiel Butler Masters
71fb9a1db7 Move smjs_invoke_elinks_object_method from hooks.c to elinks_object.c. 2005-12-20 05:26:55 +00:00
Miciah Dashiel Butler Masters
3302baca35 Rename call_script_hook to smjs_invoke_elinks_object_method and rename
its hook parameter to method.
2005-12-20 05:25:36 +00:00
Miciah Dashiel Butler Masters
f5b102cfea Assert smjs_ctx in get_cache_entry_object. 2005-12-19 21:33:10 +00:00
Miciah Dashiel Butler Masters
2e0907ff8d In script_hook_pre_format_html, check whether get_cache_entry_object
returns NULL.
2005-12-19 21:28:52 +00:00
Miciah Dashiel Butler Masters
2b6ef067be In init_smjs, destroy the runtime if JS_NewContext returns NULL. 2005-12-19 21:26:05 +00:00
Miciah Dashiel Butler Masters
fcd13e35cb Do nothing in cleanup_smjs is smjs_ctx is NULL. 2005-12-19 21:24:54 +00:00
Miciah Dashiel Butler Masters
11c90e7205 Add some assertions. 2005-12-19 21:24:27 +00:00
Miciah Dashiel Butler Masters
5ca5381fbc Rework smjs_load_hooks not to free path until it is done and to always
call done_string on the script string, even when add_file_to_string fails.
2005-12-19 19:08:34 +00:00
Jonas Fonseca
9bc71ec8a9 Retire the SEE-based *.js scripting backend 2005-12-19 01:22:32 +01:00
Miciah Dashiel Butler Masters
9fb9e8700d Predicate the SpiderMonkey scripting backend on CONFIG_SPIDERMONKEY
rather than on CONFIG_ECMASCRIPT.
2005-12-18 22:51:47 +00:00
Jonas Fonseca
fa124d0988 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2005-12-18 23:49:15 +01:00
Miciah Dashiel Butler Masters
2fef4bd531 In cache_entry_get_property and cache_entry_set_property, use
cache_entry_is_valid to check that the reference to the struct cache_entry
is still valid. Thanks to fonseca for the reminder.
2005-12-18 22:47:58 +00:00
Jonas Fonseca
8ea7f202b1 #include "src/scripting/smjs/cache_object.h" 2005-12-18 22:17:48 +01:00
Jonas Fonseca
838e2ea0c9 Make all global variables exported by src/scripting/smjs/core.h extern 2005-12-18 19:57:03 +01:00
Miciah Dashiel Butler Masters
51322649fe Load the default script. 2005-12-18 18:02:32 +00:00
Miciah Dashiel Butler Masters
e3fed7e19e Add a pre-format-html hook. 2005-12-18 17:58:42 +00:00
Miciah Dashiel Butler Masters
30ccbaaf21 Add the elinks.alert method. 2005-12-18 17:49:21 +00:00
Miciah Dashiel Butler Masters
6e0d4374c1 Add the "elinks" object. 2005-12-18 17:47:54 +00:00
Miciah Dashiel Butler Masters
acb2bb80be Create a global object. 2005-12-18 17:40:13 +00:00
Miciah Dashiel Butler Masters
60d40b7f50 Initial skeleton for SpiderMonkey scripting backend. 2005-12-18 17:40:00 +00:00
Miciah Dashiel Butler Masters
dc29fa0a0b Add a missing bracket in report_scripting_error. 2005-12-18 15:32:11 +00:00
Jonas Fonseca
3dadc0ad46 Fix order of args passed to SEE_string_sprintf("%.*s") 2005-12-17 19:19:42 +01:00
Jonas Fonseca
6251884765 One more compile fix for evhook_use_param() macro usage 2005-12-17 18:36:46 +01:00
Jonas Fonseca
1e60feacb4 Compile fix for arg usage macro 2005-12-17 18:27:49 +01:00
Miciah Dashiel Butler Masters
5145ae266a Follow-up for commit fdacffd11323cee95f62dd8ab4b5760817c8097a: change
the Python, Ruby, and SEE hooks for pre-format-html to work properly
now that they are given a non-NUL-terminated string. Thanks to fonseca
for noticing this problem as well as that fixed by the previous commit.
2005-12-17 16:38:24 +00:00
Miciah Dashiel Butler Masters
fdacffd113 Change the pre-format event so that hooks are given the cache entry
instead of the URI, content, and length of the entry. Change the hooks
to use add_fragment. This should fix the memory leakage when multiple
hooks change the same document, closing bug 703.
2005-12-17 06:32:08 +00:00
Miciah Dashiel Butler Masters
35aa8119e3 In run_lua_func, pass handle_ref 0 for the unref flag so that bindings
will work more than once.
2005-12-17 01:42:20 +00:00
Miciah Dashiel Butler Masters
717b440f62 Add an unref flag to handle_ref so that the unreferencing is optional. 2005-12-17 01:36:26 +00:00
Miciah Dashiel Butler Masters
8edcb292cb In l_set_option, use lua_toboolean for boolean options instead of
lua_tonumber. Now set_option(opt, not get_option(opt)) will always work
to toggle a boolean option.
2005-12-17 00:31:45 +00:00
Laurent MONIN
3dd81f003e Fix trailing whitespaces. 2005-11-25 09:38:32 +01:00
Jonas Fonseca
acf2ec806b Remove empty lines in start of header files
A left over from the CVS Id removal. Also, for a few files, normalize the
order in which things are declared in headers.
2005-11-15 11:33:27 +01:00
Jonas Fonseca
aa07c4d848 Tidy up a bit 2005-10-26 22:39:12 +02:00
Jonas Fonseca
d7f002c8a1 Move code for the SEE object interface 2005-10-26 22:11:34 +02:00
Jonas Fonseca
1f69d4b931 Add support for navigator.preference() and navigator.savePreferences()
It required that the 'context' session was saved in see_ses (similarly to
the lua_ses variable)

Anyway, now you can use

	var opt_value = navigator.preference("ui.window_title)
	navigator.preference("ui.window_title", false)
	navigator.savePreferences()

to get and set optinos + save the changes.
2005-10-25 19:13:33 +02:00
Jonas Fonseca
7659f284ac Try to comply to the client-side javascript interface and not our own
Renames the following things:
ELinks.write() -> alert() or navigator.alert()
ELinks.version -> navigator.appVersion
ELinks.home    -> navigator.appHome

The last one is not defined by the client-side javascript interface.
2005-10-25 17:43:33 +02:00
Jonas Fonseca
bc0cc67fd9 Cleanup and improve error messaging
Script errors are now reported either with WDBG() at startup, ERROR()
if SEE decides to abort and using info_box() for everything else, including
script runtime errors.
2005-10-24 00:57:47 +02:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Jonas Fonseca
03118059ee Move and make sense of the common code 2005-10-21 04:07:43 +02:00
Jonas Fonseca
0ba773e7a5 Add the basics for _browser_ (ecma)scripting ELinks with SEE
SEE is David Leonard's Simple Ecmascript Engine.  The SEE scripting backend
is very raw and not tested very much. The idea was to see what kind of
creature SEE is (and contradict pasky's aired opinion that no new features
are added anymore ;).

echo 'function goto_url() { return 'localhost'; }' > ~/.elinks/hooks.js
and get local for maximum security ...

FYI: SEE is smaller than Spidermonkey but doesn't have the same kind of
data-driven interface, although it looks like it is possible to build that.
2005-10-20 20:38:01 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00
Jonas Fonseca
c76586e6b8 Simplify the conditional building
Use the very cool 'VAR-$(CONFIG_FOO) += foo.o' feature instead of the more
verbose current ifeq($(CONFIG_FOO),yes) wrapping.
2005-09-27 22:49:47 +02:00
Jonas Fonseca
68de9e35d3 Automagically link in subdir lib.o files
It is a little ugly since I couldn't get $(wildcard) to expand *.o files
so it just checks if there are any *.c files and then link in the lib.o
based on that.
2005-09-27 22:38:00 +02:00
Jonas Fonseca
1efab31581 Simplify building of and linking with directories
Ditch the building of an archive (.a) in favour of linking all objects in a
directory into a lib.o file. This makes it easy to link in subdirectories
and more importantly keeps the build logic in the local subdirectories.

Note: after updating you will have to rm **/*.a if you do not make clean
before updating.
2005-09-27 21:38:58 +02:00
Jonas Fonseca
b30064c0d0 Rename targets: *-l -> *-local 2005-09-27 21:11:28 +02:00
Petr Baudis
c89190e0bf ELBuildized scripting/. 2005-09-16 13:29:06 +02:00
Petr Baudis
1f0cd14e91 Converted another bunch of submakefiles to ELBuild 2005-09-16 04:07:37 +02:00
Jonas Fonseca
7462f22635 Remove now obsolete .cvsignore files. 2005-09-15 18:33:20 +02:00
Petr Baudis
0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00